tests: simplify valgrind tests, remove .vv

pull/6219/head
Alexander Medvednikov 2020-08-25 13:58:21 +02:00
parent 33b4ff75d0
commit c8b3cd2957
2 changed files with 10 additions and 16 deletions

View File

@ -43,38 +43,32 @@ fn test_all() {
os.mkdir_all(wrkdir) os.mkdir_all(wrkdir)
os.chdir(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 basepath: valgrind_test_path
}) })
bench.set_total_expected_steps(tests.len) bench.set_total_expected_steps(tests.len)
for dir_test_path in tests { for test in tests {
bench.step() bench.step()
test_basename := os.file_name(dir_test_path).replace('.vv', '') exe_filename := '$wrkdir/x'
v_filename := '$wrkdir/${test_basename}.v'
exe_filename := '$wrkdir/$test_basename'
full_test_path := os.real_path(os.join_path(vroot, dir_test_path))
// //
if dir_test_path in skip_valgrind_files { if test in skip_valgrind_files {
$if !noskip ? { $if !noskip ? {
bench.skip() bench.skip()
eprintln(bench.step_message_skip(dir_test_path)) eprintln(bench.step_message_skip(test))
continue continue
} }
} }
vprintln('$dir_test_path => $v_filename')
// //
vprintln('cp $full_test_path $v_filename') compile_cmd := '$vexe -o $exe_filename -cg -cflags "-w" -autofree $test'
os.cp(full_test_path, v_filename)
compile_cmd := '$vexe -cg -cflags "-w" -autofree $v_filename'
vprintln('compile cmd: ${util.bold(compile_cmd)}') vprintln('compile cmd: ${util.bold(compile_cmd)}')
res := os.exec(compile_cmd) or { res := os.exec(compile_cmd) or {
bench.fail() bench.fail()
eprintln(bench.step_message_fail('valgrind $dir_test_path failed')) eprintln(bench.step_message_fail('valgrind $test failed'))
continue continue
} }
if res.exit_code != 0 { if res.exit_code != 0 {
bench.fail() 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) eprintln(res.output)
continue continue
} }
@ -87,12 +81,12 @@ fn test_all() {
} }
if valgrind_res.exit_code != 0 { if valgrind_res.exit_code != 0 {
bench.fail() 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) eprintln(valgrind_res.output)
continue continue
} }
bench.ok() bench.ok()
eprintln(bench.step_message_ok(dir_test_path)) eprintln(bench.step_message_ok(test))
} }
bench.stop() bench.stop()
eprintln(term.h_divider('-')) eprintln(term.h_divider('-'))