Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: improve test robustness on windows #21116

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/tools/vpm/settings.v
Original file line number Diff line number Diff line change
Expand Up @@ -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') != ''
}
Expand Down
2 changes: 1 addition & 1 deletion vlib/io/util/util_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down
2 changes: 1 addition & 1 deletion vlib/os/file_buffering_test.v
Original file line number Diff line number Diff line change
@@ -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 {}
Expand Down
6 changes: 2 additions & 4 deletions vlib/os/file_test.v
Original file line number Diff line number Diff line change
@@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion vlib/os/find_abs_path_of_executable_test.v
Original file line number Diff line number Diff line change
@@ -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)!
Expand Down
2 changes: 1 addition & 1 deletion vlib/os/inode_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down
2 changes: 1 addition & 1 deletion vlib/os/os_test.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion vlib/os/process_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
2 changes: 1 addition & 1 deletion vlib/toml/tests/alexcrichton_toml_rs_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion vlib/toml/tests/burntsushi_toml_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion vlib/toml/tests/iarna_toml_spec_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions vlib/v/gen/c/coutput_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down Expand Up @@ -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 {}
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/gen/golang/tests/golang_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/gen/native/tests/native_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/gen/wasm/tests/wasm_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/live/live_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/slow_tests/valgrind/valgrind_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
//
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/tests/closure_generator_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/tests/run_v_code_from_stdin_test.v
Original file line number Diff line number Diff line change
@@ -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 != ''
Expand Down