From e02f25a108aca539d85fcaeb384d12ad95f2ce92 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 14 Oct 2020 18:20:19 +0300 Subject: [PATCH] test-compiler: fix sporadic fails for vpm/v install --- cmd/tools/modules/testing/common.v | 13 +++++++++---- cmd/tools/vtest-compiler.v | 11 +++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index 38ddf0d815..8bafc72b39 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -69,10 +69,7 @@ pub fn (mut ts TestSession) test() { if current_wd == os.wd_at_startup && current_wd == ts.vroot { ts.root_relative = true } - now := time.sys_mono_now() - new_vtmp_dir := os.join_path(os.temp_dir(), 'v', 'test_session_$now') - os.mkdir_all(new_vtmp_dir) - os.setenv('VTMP', new_vtmp_dir, true) + new_vtmp_dir := setup_new_vtmp_folder() // ts.init() mut remaining_files := []string{} @@ -333,3 +330,11 @@ pub fn eheader(msg string) { pub fn header(msg string) { println(term.header(msg, '-')) } + +pub fn setup_new_vtmp_folder() string { + now := time.sys_mono_now() + new_vtmp_dir := os.join_path(os.temp_dir(), 'v', 'test_session_$now') + os.mkdir_all(new_vtmp_dir) + os.setenv('VTMP', new_vtmp_dir, true) + return new_vtmp_dir +} diff --git a/cmd/tools/vtest-compiler.v b/cmd/tools/vtest-compiler.v index 3f1232b415..94623c8efd 100644 --- a/cmd/tools/vtest-compiler.v +++ b/cmd/tools/vtest-compiler.v @@ -24,7 +24,6 @@ fn v_test_compiler(vargs string) { exit(1) } */ - // Make sure v.c can be compiled without warnings $if macos { if os.exists('/cmd/v') { @@ -46,8 +45,11 @@ fn v_test_compiler(vargs string) { eprintln('') building_examples_failed := testing.v_build_failing(vargs, 'examples') eprintln('') - building_live_failed := testing.v_build_failing(vargs + '-live', os.join_path('examples', 'hot_reload')) + building_live_failed := testing.v_build_failing(vargs + '-live', os.join_path('examples', + 'hot_reload')) eprintln('') + // + testing.setup_new_vtmp_folder() v_module_install_cmd := '$vexe install nedpals.args' eprintln('') testing.eheader('Installing a v module with: $v_module_install_cmd') @@ -56,12 +58,13 @@ fn v_test_compiler(vargs string) { if ret != 0 { eprintln('failed to run v install') } - desired_path := os.join_path(pref.default_module_path, 'nedpals', 'args') - if !(os.exists( desired_path ) && os.is_dir( desired_path )) { + desired_path := os.join_path(pref.default_module_path, 'nedpals', 'args') + if !(os.exists(desired_path) && os.is_dir(desired_path)) { eprintln('v failed to install a test module') } vmark.stop() eprintln('Installing a v module took: ' + vmark.total_duration().str() + 'ms') + // if building_tools_failed || compiler_test_session.failed || building_examples_failed || building_live_failed { exit(1) }