From 770a2db50333dcd987317fdbbe75456758336b89 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 7 Dec 2025 23:59:30 +0200 Subject: [PATCH] ci: set VTMP too in set_test_env/1, to avoid cloning conflicts during parallel test executions --- cmd/tools/vpm/dependency_test.v | 10 +++++----- cmd/tools/vpm/install_test.v | 2 +- cmd/tools/vpm/install_version_input_test.v | 2 +- cmd/tools/vpm/install_version_test.v | 1 + cmd/tools/vpm/outdated_test.v | 3 +-- cmd/tools/vpm/remove_test.v | 1 + cmd/tools/vpm/test_utils/utils.v | 8 +++++++- cmd/tools/vpm/update_test.v | 2 +- 8 files changed, 18 insertions(+), 11 deletions(-) diff --git a/cmd/tools/vpm/dependency_test.v b/cmd/tools/vpm/dependency_test.v index 8125a441c..73c9eff20 100644 --- a/cmd/tools/vpm/dependency_test.v +++ b/cmd/tools/vpm/dependency_test.v @@ -12,13 +12,14 @@ fn testsuite_begin() { eprintln('> skipping ${@FILE}, when `-d network` is missing') exit(0) } - unbuffer_stdout() - os.setenv('VMODULES', test_path, true) - os.setenv('VPM_DEBUG', '', true) - os.setenv('VPM_NO_INCREMENT', '1', true) + dump(test_path) + test_utils.set_test_env(test_path) + os.mkdir_all(test_path) or {} + os.chdir(test_path)! } fn testsuite_end() { + dump(os.system('find ${test_path}')) os.rmdir_all(test_path) or {} } @@ -32,7 +33,6 @@ fn get_mod_name(path string) string { // Case: running `v install` without specifying modules in a V project directory. fn test_install_dependencies_in_module_dir() { - os.mkdir_all(test_path) or {} mod := 'my_module' mod_path := os.join_path(test_path, mod) os.mkdir(mod_path)! diff --git a/cmd/tools/vpm/install_test.v b/cmd/tools/vpm/install_test.v index f83b7b01b..9191ac87e 100644 --- a/cmd/tools/vpm/install_test.v +++ b/cmd/tools/vpm/install_test.v @@ -16,7 +16,7 @@ fn testsuite_begin() { eprintln('> skipping ${@FILE}, when `-d network` is missing') exit(0) } - unbuffer_stdout() + dump(test_path) test_utils.set_test_env(test_path) } diff --git a/cmd/tools/vpm/install_version_input_test.v b/cmd/tools/vpm/install_version_input_test.v index efd8d8be8..7277fb7de 100644 --- a/cmd/tools/vpm/install_version_input_test.v +++ b/cmd/tools/vpm/install_version_input_test.v @@ -18,8 +18,8 @@ fn testsuite_begin() { eprintln('> skipping ${@FILE}, when `-d network` is missing') exit(0) } + dump(test_path) test_utils.set_test_env(test_path) - eprintln('>> test_path: ${test_path}') // Explicitly disable fail on prompt. os.setenv('VPM_FAIL_ON_PROMPT', '', true) os.mkdir_all(test_path) or {} diff --git a/cmd/tools/vpm/install_version_test.v b/cmd/tools/vpm/install_version_test.v index 8437fafb7..5f92a6fb0 100644 --- a/cmd/tools/vpm/install_version_test.v +++ b/cmd/tools/vpm/install_version_test.v @@ -14,6 +14,7 @@ fn testsuite_begin() { eprintln('> skipping ${@FILE}, when `-d network` is missing') exit(0) } + dump(test_path) test_utils.set_test_env(test_path) } diff --git a/cmd/tools/vpm/outdated_test.v b/cmd/tools/vpm/outdated_test.v index 8e0061b26..f9332b831 100644 --- a/cmd/tools/vpm/outdated_test.v +++ b/cmd/tools/vpm/outdated_test.v @@ -12,11 +12,10 @@ fn testsuite_begin() { eprintln('> skipping ${@FILE}, when `-d network` is missing') exit(0) } - unbuffer_stdout() + dump(test_path) test_utils.set_test_env(test_path) os.mkdir_all(test_path)! os.chdir(test_path)! - println('test_path: ${test_path}') } fn testsuite_end() { diff --git a/cmd/tools/vpm/remove_test.v b/cmd/tools/vpm/remove_test.v index c7f56ad12..ac6d26c76 100644 --- a/cmd/tools/vpm/remove_test.v +++ b/cmd/tools/vpm/remove_test.v @@ -11,6 +11,7 @@ fn testsuite_begin() { eprintln('> skipping ${@FILE}, when `-d network` is missing') exit(0) } + dump(test_path) test_utils.set_test_env(test_path) } diff --git a/cmd/tools/vpm/test_utils/utils.v b/cmd/tools/vpm/test_utils/utils.v index 1c70d8b83..bd84b8a0b 100644 --- a/cmd/tools/vpm/test_utils/utils.v +++ b/cmd/tools/vpm/test_utils/utils.v @@ -5,11 +5,17 @@ import net import time pub fn set_test_env(test_path string) { + unbuffer_stdout() os.setenv('VMODULES', test_path, true) os.setenv('VPM_DEBUG', '', true) os.setenv('VPM_NO_INCREMENT', '1', true) os.setenv('VPM_FAIL_ON_PROMPT', '1', true) - unbuffer_stdout() + // Note: setting a local VTMP here, is *very important*, because VTMP is used for + // the destination of the temporary clones done by the child `v install` processes. + // If it is not done, then there is a small chance, that multiple parallel tests + // can do clones to the same exact folders at the same time, which can make them + // fail on the CI, with hard to diagnose spurious errors. + os.setenv('VTMP', os.join_path(test_path, 'vtmp'), true) } pub fn hg_serve(hg_path string, path string, start_port int) (&os.Process, int) { diff --git a/cmd/tools/vpm/update_test.v b/cmd/tools/vpm/update_test.v index 209c82df9..583239c92 100644 --- a/cmd/tools/vpm/update_test.v +++ b/cmd/tools/vpm/update_test.v @@ -12,7 +12,7 @@ fn testsuite_begin() { eprintln('> skipping ${@FILE}, when `-d network` is missing') exit(0) } - unbuffer_stdout() + dump(test_path) test_utils.set_test_env(test_path) } -- 2.39.5