From c8b3cd2957f6a82a4bb3662a6399a4455b58dafa Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 25 Aug 2020 13:58:21 +0200 Subject: [PATCH] tests: simplify valgrind tests, remove .vv --- ...g_param.vv => fn_returning_string_param.v} | 0 vlib/v/tests/valgrind/valgrind_test.v | 26 +++++++------------ 2 files changed, 10 insertions(+), 16 deletions(-) rename vlib/v/tests/valgrind/{fn_returning_string_param.vv => fn_returning_string_param.v} (100%) diff --git a/vlib/v/tests/valgrind/fn_returning_string_param.vv b/vlib/v/tests/valgrind/fn_returning_string_param.v similarity index 100% rename from vlib/v/tests/valgrind/fn_returning_string_param.vv rename to vlib/v/tests/valgrind/fn_returning_string_param.v diff --git a/vlib/v/tests/valgrind/valgrind_test.v b/vlib/v/tests/valgrind/valgrind_test.v index 2d5c89f568..624c56928d 100644 --- a/vlib/v/tests/valgrind/valgrind_test.v +++ b/vlib/v/tests/valgrind/valgrind_test.v @@ -43,38 +43,32 @@ fn test_all() { os.mkdir_all(wrkdir) os.chdir(wrkdir) // - tests := vtest.filter_vtest_only(files.filter(it.ends_with('.vv')), { + tests := vtest.filter_vtest_only(files.filter(it.ends_with('.v') && !it.ends_with('_test.v')), { basepath: valgrind_test_path }) bench.set_total_expected_steps(tests.len) - for dir_test_path in tests { + for test in tests { bench.step() - test_basename := os.file_name(dir_test_path).replace('.vv', '') - v_filename := '$wrkdir/${test_basename}.v' - exe_filename := '$wrkdir/$test_basename' - full_test_path := os.real_path(os.join_path(vroot, dir_test_path)) + exe_filename := '$wrkdir/x' // - if dir_test_path in skip_valgrind_files { + if test in skip_valgrind_files { $if !noskip ? { bench.skip() - eprintln(bench.step_message_skip(dir_test_path)) + eprintln(bench.step_message_skip(test)) continue } } - vprintln('$dir_test_path => $v_filename') // - vprintln('cp $full_test_path $v_filename') - os.cp(full_test_path, v_filename) - compile_cmd := '$vexe -cg -cflags "-w" -autofree $v_filename' + compile_cmd := '$vexe -o $exe_filename -cg -cflags "-w" -autofree $test' vprintln('compile cmd: ${util.bold(compile_cmd)}') res := os.exec(compile_cmd) or { bench.fail() - eprintln(bench.step_message_fail('valgrind $dir_test_path failed')) + eprintln(bench.step_message_fail('valgrind $test failed')) continue } if res.exit_code != 0 { bench.fail() - eprintln(bench.step_message_fail('file: $dir_test_path could not be compiled.')) + eprintln(bench.step_message_fail('file: $test could not be compiled.')) eprintln(res.output) continue } @@ -87,12 +81,12 @@ fn test_all() { } if valgrind_res.exit_code != 0 { bench.fail() - eprintln(bench.step_message_fail('failed valgrind check for ${util.bold(dir_test_path)}')) + eprintln(bench.step_message_fail('failed valgrind check for ${util.bold(test)}')) eprintln(valgrind_res.output) continue } bench.ok() - eprintln(bench.step_message_ok(dir_test_path)) + eprintln(bench.step_message_ok(test)) } bench.stop() eprintln(term.h_divider('-'))