From 1cd561feb489e338c932c9d47a19c8e02225d0c4 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 24 May 2024 12:29:32 +0300 Subject: [PATCH] tests: reduce the likelyhood of naming collisions for `v test` session folders, started at the exact same time (the time resolution on windows is much lower) --- cmd/tools/modules/testing/common.v | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index 147395a2d8..d23dcdc763 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -303,7 +303,7 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession { vargs := _vargs.replace('-progress', '') vexe := pref.vexe_path() vroot := os.dir(vexe) - hash := '${sync.thread_id().hex()}_${time.sys_mono_now()}' + hash := '${sync.thread_id().hex()}_${rand.ulid()}' new_vtmp_dir := setup_new_vtmp_folder(hash) if term.can_show_color_on_stderr() { os.setenv('VCOLORS', 'always', true) @@ -504,7 +504,8 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr { // where an executable is not writable, if it is running). // Note, that the common session temporary folder ts.vtmp_dir, // will be removed after all tests are done. - mut test_folder_path := os.join_path(ts.vtmp_dir, rand.ulid()) + test_id := '${idx}_${thread_id}' + mut test_folder_path := os.join_path(ts.vtmp_dir, test_id) if ts.build_tools { // `v build-tools`, produce all executables in the same session folder, so that they can be copied later: test_folder_path = ts.vtmp_dir