ci: improve test robustness on windows (#21116)

This commit is contained in:
Delyan Angelov 2024-03-28 07:29:17 +02:00 committed by GitHub
parent f1fba25e49
commit f172a040ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 21 additions and 23 deletions

View File

@ -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') != ''
}

View File

@ -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}')

View File

@ -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 {}

View File

@ -1,12 +1,10 @@
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() {
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)
}

View File

@ -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)!

View File

@ -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}')

View File

@ -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:

View File

@ -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')

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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 {}

View File

@ -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')

View File

@ -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 {}
//

View File

@ -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')

View File

@ -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 != ''