From 77579f129064daee9e0758c5a1ede4b64b8ca21a Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 27 Mar 2024 15:13:54 +0200 Subject: [PATCH 1/2] ci: fix spurious test failures on the space-paths-windows job --- vlib/os/file_test.v | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vlib/os/file_test.v b/vlib/os/file_test.v index ed489d5492ccbf..47873d5f588d33 100644 --- a/vlib/os/file_test.v +++ b/vlib/os/file_test.v @@ -4,9 +4,7 @@ const tfolder = os.join_path(os.vtmp_dir(), 'tests', 'os_file_test') const tfile = os.join_path_single(tfolder, 'test_file') fn testsuite_begin() { - os.rmdir_all(tfolder) or {} - assert !os.is_dir(tfolder) - os.mkdir_all(tfolder)! + os.mkdir_all(tfolder) or {} os.chdir(tfolder)! assert os.is_dir(tfolder) } From 7e0e2aaa460e78e630e74e020d7e3a1f80c6d200 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 27 Mar 2024 15:26:36 +0200 Subject: [PATCH 2/2] ci: make tests more robust to CI failures on windows --- cmd/tools/vpm/settings.v | 2 +- vlib/io/util/util_test.v | 2 +- vlib/os/file_buffering_test.v | 2 +- vlib/os/file_test.v | 2 +- vlib/os/find_abs_path_of_executable_test.v | 2 +- vlib/os/inode_test.v | 2 +- vlib/os/os_test.c.v | 2 +- vlib/os/process_test.v | 2 +- vlib/toml/tests/alexcrichton_toml_rs_test.v | 2 +- vlib/toml/tests/burntsushi_toml_test.v | 2 +- vlib/toml/tests/iarna_toml_spec_test.v | 2 +- vlib/v/gen/c/coutput_test.v | 4 ++-- vlib/v/gen/golang/tests/golang_test.v | 2 +- vlib/v/gen/native/tests/native_test.v | 2 +- vlib/v/gen/wasm/tests/wasm_test.v | 2 +- vlib/v/live/live_test.v | 2 +- vlib/v/slow_tests/valgrind/valgrind_test.v | 2 +- vlib/v/tests/closure_generator_test.v | 2 +- vlib/v/tests/run_v_code_from_stdin_test.v | 2 +- 19 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cmd/tools/vpm/settings.v b/cmd/tools/vpm/settings.v index c4612fdbf854b1..2af8b26e0240fe 100644 --- a/cmd/tools/vpm/settings.v +++ b/cmd/tools/vpm/settings.v @@ -38,7 +38,7 @@ fn init_settings() VpmSettings { server_urls: cmdline.options(args, '--server-urls') vcs: if '--hg' in opts { .hg } else { .git } vmodules_path: os.vmodules_dir() - tmp_path: os.join_path(os.vtmp_dir(), 'vpm', 'modules') + tmp_path: os.join_path(os.vtmp_dir(), 'vpm_modules') no_dl_count_increment: os.getenv('CI') != '' || (no_inc_env != '' && no_inc_env != '0') fail_on_prompt: os.getenv('VPM_FAIL_ON_PROMPT') != '' } diff --git a/vlib/io/util/util_test.v b/vlib/io/util/util_test.v index 150ab49c065b20..00376959e14400 100644 --- a/vlib/io/util/util_test.v +++ b/vlib/io/util/util_test.v @@ -4,7 +4,7 @@ import io.util // tfolder will contain all the temporary files/subfolders made by // the different tests. It would be removed in testsuite_end(), so // individual os tests do not need to clean up after themselves. -const tfolder = os.join_path(os.vtmp_dir(), 'tests', 'io_util_test') +const tfolder = os.join_path(os.vtmp_dir(), 'io_util_tests') fn testsuite_begin() { eprintln('testsuite_begin, tfolder = ${tfolder}') diff --git a/vlib/os/file_buffering_test.v b/vlib/os/file_buffering_test.v index 0a1e24f78bc3aa..ff1740b541b5fe 100644 --- a/vlib/os/file_buffering_test.v +++ b/vlib/os/file_buffering_test.v @@ -1,6 +1,6 @@ import os -const tfolder = os.join_path(os.vtmp_dir(), 'tests', 'os_file_buffering_test') +const tfolder = os.join_path(os.vtmp_dir(), 'os_file_buffering_tests') fn testsuite_begin() { os.rmdir_all(tfolder) or {} diff --git a/vlib/os/file_test.v b/vlib/os/file_test.v index 47873d5f588d33..af0ea9d500126a 100644 --- a/vlib/os/file_test.v +++ b/vlib/os/file_test.v @@ -1,6 +1,6 @@ import os -const tfolder = os.join_path(os.vtmp_dir(), 'tests', 'os_file_test') +const tfolder = os.join_path(os.vtmp_dir(), 'os_file_tests') const tfile = os.join_path_single(tfolder, 'test_file') fn testsuite_begin() { diff --git a/vlib/os/find_abs_path_of_executable_test.v b/vlib/os/find_abs_path_of_executable_test.v index fbc31e8ca88a4e..5eda01b58f402c 100644 --- a/vlib/os/find_abs_path_of_executable_test.v +++ b/vlib/os/find_abs_path_of_executable_test.v @@ -1,7 +1,7 @@ import os fn test_find_abs_path_of_executable() { - tfolder := os.join_path(os.vtmp_dir(), 'tests', 'filepath_test') + tfolder := os.join_path(os.vtmp_dir(), 'filepath_tests') os.rmdir_all(tfolder) or {} assert !os.is_dir(tfolder) os.mkdir_all(tfolder)! diff --git a/vlib/os/inode_test.v b/vlib/os/inode_test.v index 93bfd77861c006..e505be5474d535 100644 --- a/vlib/os/inode_test.v +++ b/vlib/os/inode_test.v @@ -3,7 +3,7 @@ import os // tfolder will contain all the temporary files/subfolders made by // the different tests. It would be removed in testsuite_end(), so // individual os tests do not need to clean up after themselves. -const tfolder = os.join_path(os.vtmp_dir(), 'tests', 'inode_test') +const tfolder = os.join_path(os.vtmp_dir(), 'inode_tests') fn testsuite_begin() { eprintln('testsuite_begin, tfolder = ${tfolder}') diff --git a/vlib/os/os_test.c.v b/vlib/os/os_test.c.v index 5e36b6f0214270..87b7674ad22ee3 100644 --- a/vlib/os/os_test.c.v +++ b/vlib/os/os_test.c.v @@ -4,7 +4,7 @@ import time // tfolder will contain all the temporary files/subfolders made by // the different tests. It would be removed in testsuite_end(), so // individual os tests do not need to clean up after themselves. -const tfolder = os.join_path(os.vtmp_dir(), 'tests', 'os_test') +const tfolder = os.join_path(os.vtmp_dir(), 'os_tests') // os.args has to be *already initialized* with the program's argc/argv at this point // thus it can be used for other consts too: diff --git a/vlib/os/process_test.v b/vlib/os/process_test.v index c278e70258f975..271bc77e5c4b58 100644 --- a/vlib/os/process_test.v +++ b/vlib/os/process_test.v @@ -5,7 +5,7 @@ import time const vexe = os.getenv('VEXE') const vroot = os.dir(vexe) -const tfolder = os.join_path(os.vtmp_dir(), 'tests', 'os_process') +const tfolder = os.join_path(os.vtmp_dir(), 'os_process_tests') const test_os_process = os.join_path(tfolder, 'test_os_process.exe') const test_os_process_source = os.join_path(vroot, 'cmd/tools/test_os_process.v') diff --git a/vlib/toml/tests/alexcrichton_toml_rs_test.v b/vlib/toml/tests/alexcrichton_toml_rs_test.v index 187473654727dc..5df604dd2d8eb0 100644 --- a/vlib/toml/tests/alexcrichton_toml_rs_test.v +++ b/vlib/toml/tests/alexcrichton_toml_rs_test.v @@ -36,7 +36,7 @@ const use_type_2_arrays = [ ] const tests_folder = os.join_path('test-suite', 'tests') const jq = os.find_abs_path_of_executable('jq') or { '' } -const compare_work_dir_root = os.join_path(os.vtmp_dir(), 'toml', 'alexcrichton') +const compare_work_dir_root = os.join_path(os.vtmp_dir(), 'toml_alexcrichton') // From: https://stackoverflow.com/a/38266731/1904615 const jq_normalize = r'# Apply f to composite entities recursively using keys[], and to atoms def sorted_walk(f): diff --git a/vlib/toml/tests/burntsushi_toml_test.v b/vlib/toml/tests/burntsushi_toml_test.v index 72b8961a71f4f3..7339ee0e9b6386 100644 --- a/vlib/toml/tests/burntsushi_toml_test.v +++ b/vlib/toml/tests/burntsushi_toml_test.v @@ -28,7 +28,7 @@ const valid_value_exceptions = []string{} //'integer/long.toml', // TODO: https://github.com/vlang/v/issues/9507 const jq = os.find_abs_path_of_executable('jq') or { '' } -const compare_work_dir_root = os.join_path(os.vtmp_dir(), 'toml', 'burntsushi') +const compare_work_dir_root = os.join_path(os.vtmp_dir(), 'toml_burntsushi') // From: https://stackoverflow.com/a/38266731/1904615 const jq_normalize = r'# Apply f to composite entities recursively using keys[], and to atoms def sorted_walk(f): diff --git a/vlib/toml/tests/iarna_toml_spec_test.v b/vlib/toml/tests/iarna_toml_spec_test.v index 4ce7f2bf7b34c5..f810eddf41d84a 100644 --- a/vlib/toml/tests/iarna_toml_spec_test.v +++ b/vlib/toml/tests/iarna_toml_spec_test.v @@ -42,7 +42,7 @@ const yaml_value_exceptions = [ const jq = os.find_abs_path_of_executable('jq') or { '' } const python = os.find_abs_path_of_executable('python') or { '' } -const compare_work_dir_root = os.join_path(os.vtmp_dir(), 'toml', 'iarna') +const compare_work_dir_root = os.join_path(os.vtmp_dir(), 'toml_iarna') // From: https://stackoverflow.com/a/38266731/1904615 const jq_normalize = r'# Apply f to composite entities recursively using keys[], and to atoms def sorted_walk(f): diff --git a/vlib/v/gen/c/coutput_test.v b/vlib/v/gen/c/coutput_test.v index 85f0167c2bfb0d..26d2c55eaf37e6 100644 --- a/vlib/v/gen/c/coutput_test.v +++ b/vlib/v/gen/c/coutput_test.v @@ -30,7 +30,7 @@ fn mj(input ...string) string { fn test_out_files() { println(term.colorize(term.green, '> testing whether .out files match:')) os.chdir(vroot) or {} - output_path := os.join_path(os.vtmp_dir(), 'coutput', 'out') + output_path := os.join_path(os.vtmp_dir(), 'coutput_outs') os.mkdir_all(output_path)! defer { os.rmdir_all(output_path) or {} @@ -110,7 +110,7 @@ fn test_out_files() { fn test_c_must_have_files() { println(term.colorize(term.green, '> testing whether all line patterns in `.c.must_have` files match:')) os.chdir(vroot) or {} - output_path := os.join_path(os.vtmp_dir(), 'coutput', 'c_must_have') + output_path := os.join_path(os.vtmp_dir(), 'coutput_c_must_haves') os.mkdir_all(output_path)! defer { os.rmdir_all(output_path) or {} diff --git a/vlib/v/gen/golang/tests/golang_test.v b/vlib/v/gen/golang/tests/golang_test.v index 010613ca2c008d..4561362900b92f 100644 --- a/vlib/v/gen/golang/tests/golang_test.v +++ b/vlib/v/gen/golang/tests/golang_test.v @@ -19,7 +19,7 @@ fn test_golang() { dir := os.join_path(vroot, 'vlib/v/gen/golang/tests') files := os.ls(dir) or { panic(err) } // - wrkdir := os.join_path(os.vtmp_dir(), 'tests', 'golang') + wrkdir := os.join_path(os.vtmp_dir(), 'golang_tests') os.mkdir_all(wrkdir) or { panic(err) } defer { os.rmdir_all(wrkdir) or {} diff --git a/vlib/v/gen/native/tests/native_test.v b/vlib/v/gen/native/tests/native_test.v index ca5115ccc829e5..b029843827e76b 100644 --- a/vlib/v/gen/native/tests/native_test.v +++ b/vlib/v/gen/native/tests/native_test.v @@ -21,7 +21,7 @@ fn test_native() { dir := os.join_path(vroot, 'vlib', 'v', 'gen', 'native', 'tests') files := os.ls(dir) or { panic(err) } // - wrkdir := os.join_path(os.vtmp_dir(), 'tests', 'native') + wrkdir := os.join_path(os.vtmp_dir(), 'native_tests') os.mkdir_all(wrkdir) or { panic(err) } defer { os.rmdir_all(wrkdir) or {} diff --git a/vlib/v/gen/wasm/tests/wasm_test.v b/vlib/v/gen/wasm/tests/wasm_test.v index f5cc4f5470bc8f..c8f02edb7345da 100644 --- a/vlib/v/gen/wasm/tests/wasm_test.v +++ b/vlib/v/gen/wasm/tests/wasm_test.v @@ -29,7 +29,7 @@ fn test_wasm() { dir := os.join_path(vroot, 'vlib/v/gen/wasm/tests') files := os.ls(dir) or { panic(err) } // - wrkdir := os.join_path(os.vtmp_dir(), 'tests', 'wasm') + wrkdir := os.join_path(os.vtmp_dir(), 'wasm_tests') os.mkdir_all(wrkdir) or { panic(err) } defer { os.rmdir_all(wrkdir) or {} diff --git a/vlib/v/live/live_test.v b/vlib/v/live/live_test.v index 788fb4b8db7c35..44dcc2f26014a1 100644 --- a/vlib/v/live/live_test.v +++ b/vlib/v/live/live_test.v @@ -32,7 +32,7 @@ not very flaky way. TODO: Cleanup this when/if v has better process control/communication primitives. */ const vexe = os.getenv('VEXE') -const vtmp_folder = os.join_path(os.vtmp_dir(), 'tests', 'live') +const vtmp_folder = os.join_path(os.vtmp_dir(), 'live_tests') const main_source_file = os.join_path(vtmp_folder, 'main.v') const tmp_file = os.join_path(vtmp_folder, 'mymodule', 'generated_live_module.tmp') const source_file = os.join_path(vtmp_folder, 'mymodule', 'mymodule.v') diff --git a/vlib/v/slow_tests/valgrind/valgrind_test.v b/vlib/v/slow_tests/valgrind/valgrind_test.v index e9339fb690a5e8..2fa53748a9b286 100644 --- a/vlib/v/slow_tests/valgrind/valgrind_test.v +++ b/vlib/v/slow_tests/valgrind/valgrind_test.v @@ -67,7 +67,7 @@ fn test_all() { mut files := os.ls(dir) or { panic(err) } files.sort() // - wrkdir := os.join_path(os.vtmp_dir(), 'tests', 'valgrind') + wrkdir := os.join_path(os.vtmp_dir(), 'valgrind_tests') os.mkdir_all(wrkdir) or { panic(err) } os.chdir(wrkdir) or {} // diff --git a/vlib/v/tests/closure_generator_test.v b/vlib/v/tests/closure_generator_test.v index 0f9af297788281..5038579b31b98e 100644 --- a/vlib/v/tests/closure_generator_test.v +++ b/vlib/v/tests/closure_generator_test.v @@ -168,7 +168,7 @@ fn test_closure_return_${styp}_${i}() ! { code := v_code.str() println('Compiling V code (${code.count('\n')} lines) ...') - wrkdir := os.join_path(os.vtmp_dir(), 'tests', 'closures') + wrkdir := os.join_path(os.vtmp_dir(), 'closure_generator_tests') os.mkdir_all(wrkdir)! os.chdir(wrkdir)! full_path_to_target := os.join_path(wrkdir, 'closure_return_test.v') diff --git a/vlib/v/tests/run_v_code_from_stdin_test.v b/vlib/v/tests/run_v_code_from_stdin_test.v index a26a437a928663..4e873922aff18a 100644 --- a/vlib/v/tests/run_v_code_from_stdin_test.v +++ b/vlib/v/tests/run_v_code_from_stdin_test.v @@ -1,8 +1,8 @@ import os +const vtmp_folder = os.join_path(os.vtmp_dir(), 'run_v_code_tests') const vexe = os.getenv('VEXE') const turn_off_vcolors = os.setenv('VCOLORS', 'never', true) -const vtmp_folder = os.join_path(os.vtmp_dir(), 'tests', 'run_v_code') fn test_vexe_is_set() { assert vexe != ''