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

tests: simplify cmd/tools/modules/testing/common.v

This commit is contained in:
Delyan Angelov 2022-05-15 12:54:22 +03:00
parent cbb24d34c9
commit b4c529066a
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
3 changed files with 4 additions and 8 deletions

View File

@ -37,7 +37,6 @@ pub mut:
vroot string
vtmp_dir string
vargs string
failed bool
fail_fast bool
benchmark benchmark.Benchmark
rm_binaries bool = true
@ -288,7 +287,7 @@ pub fn (mut ts TestSession) test() {
fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
mut ts := &TestSession(p.get_shared_context())
if ts.fail_fast {
if ts.failed {
if ts.failed_cmds.len > 0 {
return pool.no_result
}
}
@ -380,7 +379,6 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
goto test_passed_system
}
}
ts.failed = true
ts.benchmark.fail()
tls_bench.fail()
ts.add_failed_cmd(cmd)
@ -396,7 +394,6 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
}
mut r := os.execute(cmd)
if r.exit_code < 0 {
ts.failed = true
ts.benchmark.fail()
tls_bench.fail()
ts.append_message(.fail, tls_bench.step_message_fail(normalised_relative_file))
@ -422,7 +419,6 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
goto test_passed_execute
}
}
ts.failed = true
ts.benchmark.fail()
tls_bench.fail()
ending_newline := if r.output.ends_with('\n') { '\n' } else { '' }
@ -510,7 +506,7 @@ pub fn v_build_failing_skipped(zargs string, folder string, oskipped []string, c
cb(mut session)
session.test()
eprintln(session.benchmark.total_message(finish_label))
return session.failed
return session.failed_cmds.len > 0
}
pub fn build_v_cmd_failed(cmd string) bool {

View File

@ -43,7 +43,7 @@ fn main() {
// eprintln('> session.skip_files: $session.skip_files')
session.test()
eprintln(session.benchmark.total_message(finish_label))
if session.failed {
if session.failed_cmds.len > 0 {
exit(1)
}
//

View File

@ -69,7 +69,7 @@ fn main() {
testing.header('Testing...')
ts.test()
println(ts.benchmark.total_message('all V _test.v files'))
if ts.failed {
if ts.failed_cmds.len > 0 {
exit(1)
}
}