Skip to content

Commit 770a2db

Browse files
committed
ci: set VTMP too in set_test_env/1, to avoid cloning conflicts during parallel test executions
1 parent 59e3302 commit 770a2db

8 files changed

Lines changed: 18 additions & 11 deletions

File tree

‎cmd/tools/vpm/dependency_test.v‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ fn testsuite_begin() {
1212
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1313
exit(0)
1414
}
15-
unbuffer_stdout()
16-
os.setenv('VMODULES', test_path, true)
17-
os.setenv('VPM_DEBUG', '', true)
18-
os.setenv('VPM_NO_INCREMENT', '1', true)
15+
dump(test_path)
16+
test_utils.set_test_env(test_path)
17+
os.mkdir_all(test_path) or {}
18+
os.chdir(test_path)!
1919
}
2020

2121
fn testsuite_end() {
22+
dump(os.system('find ${test_path}'))
2223
os.rmdir_all(test_path) or {}
2324
}
2425

@@ -32,7 +33,6 @@ fn get_mod_name(path string) string {
3233

3334
// Case: running `v install` without specifying modules in a V project directory.
3435
fn test_install_dependencies_in_module_dir() {
35-
os.mkdir_all(test_path) or {}
3636
mod := 'my_module'
3737
mod_path := os.join_path(test_path, mod)
3838
os.mkdir(mod_path)!

‎cmd/tools/vpm/install_test.v‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn testsuite_begin() {
1616
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1717
exit(0)
1818
}
19-
unbuffer_stdout()
19+
dump(test_path)
2020
test_utils.set_test_env(test_path)
2121
}
2222

‎cmd/tools/vpm/install_version_input_test.v‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ fn testsuite_begin() {
1818
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1919
exit(0)
2020
}
21+
dump(test_path)
2122
test_utils.set_test_env(test_path)
22-
eprintln('>> test_path: ${test_path}')
2323
// Explicitly disable fail on prompt.
2424
os.setenv('VPM_FAIL_ON_PROMPT', '', true)
2525
os.mkdir_all(test_path) or {}

‎cmd/tools/vpm/install_version_test.v‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ fn testsuite_begin() {
1414
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1515
exit(0)
1616
}
17+
dump(test_path)
1718
test_utils.set_test_env(test_path)
1819
}
1920

‎cmd/tools/vpm/outdated_test.v‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ fn testsuite_begin() {
1212
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1313
exit(0)
1414
}
15-
unbuffer_stdout()
15+
dump(test_path)
1616
test_utils.set_test_env(test_path)
1717
os.mkdir_all(test_path)!
1818
os.chdir(test_path)!
19-
println('test_path: ${test_path}')
2019
}
2120

2221
fn testsuite_end() {

‎cmd/tools/vpm/remove_test.v‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ fn testsuite_begin() {
1111
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1212
exit(0)
1313
}
14+
dump(test_path)
1415
test_utils.set_test_env(test_path)
1516
}
1617

‎cmd/tools/vpm/test_utils/utils.v‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ import net
55
import time
66

77
pub fn set_test_env(test_path string) {
8+
unbuffer_stdout()
89
os.setenv('VMODULES', test_path, true)
910
os.setenv('VPM_DEBUG', '', true)
1011
os.setenv('VPM_NO_INCREMENT', '1', true)
1112
os.setenv('VPM_FAIL_ON_PROMPT', '1', true)
12-
unbuffer_stdout()
13+
// Note: setting a local VTMP here, is *very important*, because VTMP is used for
14+
// the destination of the temporary clones done by the child `v install` processes.
15+
// If it is not done, then there is a small chance, that multiple parallel tests
16+
// can do clones to the same exact folders at the same time, which can make them
17+
// fail on the CI, with hard to diagnose spurious errors.
18+
os.setenv('VTMP', os.join_path(test_path, 'vtmp'), true)
1319
}
1420

1521
pub fn hg_serve(hg_path string, path string, start_port int) (&os.Process, int) {

‎cmd/tools/vpm/update_test.v‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn testsuite_begin() {
1212
eprintln('> skipping ${@FILE}, when `-d network` is missing')
1313
exit(0)
1414
}
15-
unbuffer_stdout()
15+
dump(test_path)
1616
test_utils.set_test_env(test_path)
1717
}
1818

0 commit comments

Comments
 (0)