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.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('-'))