From baf72a7459770c3510073ff1eec6da32b99a87c5 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 15 May 2022 12:54:22 +0300 Subject: [PATCH] tests: simplify cmd/tools/modules/testing/common.v --- cmd/tools/modules/testing/common.v | 8 ++------ cmd/tools/vbuild-tools.v | 2 +- cmd/tools/vtest.v | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index b7de224684..2287e48be6 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -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 { diff --git a/cmd/tools/vbuild-tools.v b/cmd/tools/vbuild-tools.v index d8c34c85f8..3182cf0e48 100644 --- a/cmd/tools/vbuild-tools.v +++ b/cmd/tools/vbuild-tools.v @@ -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) } // diff --git a/cmd/tools/vtest.v b/cmd/tools/vtest.v index d087a10307..93de683bc4 100644 --- a/cmd/tools/vtest.v +++ b/cmd/tools/vtest.v @@ -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) } }