@@ -29,10 +29,21 @@ pub const test_only = os.getenv('VTEST_ONLY').split_any(',')
29
29
30
30
pub const test_only_fn = os.getenv ('VTEST_ONLY_FN' ).split_any (',' )
31
31
32
+ // TODO: this !!!*reliably*!!! fails compilation of `v cmd/tools/vbuild-examples.v` with a cgen error, without `-no-parallel`:
33
+ // pub const fail_retry_delay_ms = os.getenv_opt('VTEST_FAIL_RETRY_DELAY_MS') or { '500' }.int() * time.millisecond
34
+ // Note, it works with `-no-parallel`, and it works when that whole expr is inside a function, like below:
35
+ pub const fail_retry_delay_ms = get_fail_retry_delay_ms ()
36
+
32
37
pub const is_node_present = os.execute ('node --version' ).exit_code == 0
33
38
34
39
pub const all_processes = get_all_processes ()
35
40
41
+ pub const header_bytes_to_search_for_module_main = 500
42
+
43
+ fn get_fail_retry_delay_ms () time.Duration {
44
+ return os.getenv_opt ('VTEST_FAIL_RETRY_DELAY_MS' ) or { '500' }.int () * time.millisecond
45
+ }
46
+
36
47
fn get_all_processes () []string {
37
48
$if windows {
38
49
// TODO
@@ -504,7 +515,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
504
515
goto test_passed_system
505
516
}
506
517
}
507
- time.sleep (500 * time.millisecond )
518
+ time.sleep (testing.fail_retry_delay_ms )
508
519
}
509
520
if details.flaky && ! testing.fail_flaky {
510
521
ts.append_message (.info, ' *FAILURE* of the known flaky test file ${relative_file} is ignored, since VTEST_FAIL_FLAKY is 0 . Retry count: ${details.retry} .' ,
@@ -566,6 +577,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
566
577
goto test_passed_execute
567
578
}
568
579
}
580
+ time.sleep (testing.fail_retry_delay_ms)
569
581
}
570
582
if details.flaky && ! testing.fail_flaky {
571
583
ts.append_message (.info, ' *FAILURE* of the known flaky test file ${relative_file} is ignored, since VTEST_FAIL_FLAKY is 0 . Retry count: ${details.retry} .' ,
@@ -628,14 +640,13 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main
628
640
continue
629
641
}
630
642
$if windows {
631
- // skip process/command examples on windows
643
+ // skip process/command examples on windows. TODO: remove the need for this, fix os.Command
632
644
if fnormalised.ends_with ('examples/process/command.v' ) {
633
645
continue
634
646
}
635
647
}
636
648
c := os.read_file (f) or { panic (err) }
637
- maxc := if c.len > 500 { 500 } else { c.len }
638
- start := c[0 ..maxc]
649
+ start := c#[0 ..testing.header_bytes_to_search_for_module_main]
639
650
if start.contains ('module ' ) && ! start.contains ('module main' ) {
640
651
skipped_f := f.replace (os.join_path_single (parent_dir, '' ), '' )
641
652
skipped << skipped_f
0 commit comments