1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

test-compiler: fix sporadic fails for vpm/v install

This commit is contained in:
Delyan Angelov 2020-10-14 18:20:19 +03:00
parent d1e52620c7
commit e02f25a108
2 changed files with 16 additions and 8 deletions

View File

@ -69,10 +69,7 @@ pub fn (mut ts TestSession) test() {
if current_wd == os.wd_at_startup && current_wd == ts.vroot { if current_wd == os.wd_at_startup && current_wd == ts.vroot {
ts.root_relative = true ts.root_relative = true
} }
now := time.sys_mono_now() new_vtmp_dir := setup_new_vtmp_folder()
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)
// //
ts.init() ts.init()
mut remaining_files := []string{} mut remaining_files := []string{}
@ -333,3 +330,11 @@ pub fn eheader(msg string) {
pub fn header(msg string) { pub fn header(msg string) {
println(term.header(msg, '-')) 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
}

View File

@ -24,7 +24,6 @@ fn v_test_compiler(vargs string) {
exit(1) exit(1)
} }
*/ */
// Make sure v.c can be compiled without warnings // Make sure v.c can be compiled without warnings
$if macos { $if macos {
if os.exists('/cmd/v') { if os.exists('/cmd/v') {
@ -46,8 +45,11 @@ fn v_test_compiler(vargs string) {
eprintln('') eprintln('')
building_examples_failed := testing.v_build_failing(vargs, 'examples') building_examples_failed := testing.v_build_failing(vargs, 'examples')
eprintln('') 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('') eprintln('')
//
testing.setup_new_vtmp_folder()
v_module_install_cmd := '$vexe install nedpals.args' v_module_install_cmd := '$vexe install nedpals.args'
eprintln('') eprintln('')
testing.eheader('Installing a v module with: $v_module_install_cmd') testing.eheader('Installing a v module with: $v_module_install_cmd')
@ -56,12 +58,13 @@ fn v_test_compiler(vargs string) {
if ret != 0 { if ret != 0 {
eprintln('failed to run v install') eprintln('failed to run v install')
} }
desired_path := os.join_path(pref.default_module_path, 'nedpals', 'args') desired_path := os.join_path(pref.default_module_path, 'nedpals', 'args')
if !(os.exists( desired_path ) && os.is_dir( desired_path )) { if !(os.exists(desired_path) && os.is_dir(desired_path)) {
eprintln('v failed to install a test module') eprintln('v failed to install a test module')
} }
vmark.stop() vmark.stop()
eprintln('Installing a v module took: ' + vmark.total_duration().str() + 'ms') 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 { if building_tools_failed || compiler_test_session.failed || building_examples_failed || building_live_failed {
exit(1) exit(1)
} }