From ad776c76a74c224ca2416437ce4cb34ef22e272b Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Sat, 23 Sep 2023 00:20:15 +0200 Subject: [PATCH] Add benchfn and testfn allowing easy overwrite of test and benchmark runners. #990 --- lib/std/core/runtime.c3 | 4 +- src/build/build_options.c | 14 +++++++ src/build/build_options.h | 4 ++ src/build/builder.c | 4 +- src/build/project.c | 12 ++++++ src/compiler/compiler_internal.h | 2 - src/compiler/sema_decls.c | 20 --------- src/compiler/semantic_analyser.c | 69 ++++++++++++++++++++++++++++++++ src/compiler/symtab.c | 4 -- src/version.h | 2 +- 10 files changed, 105 insertions(+), 30 deletions(-) diff --git a/lib/std/core/runtime.c3 b/lib/std/core/runtime.c3 index 61486e0ce..b80250a84 100644 --- a/lib/std/core/runtime.c3 +++ b/lib/std/core/runtime.c3 @@ -136,7 +136,7 @@ fn bool run_benchmarks(BenchmarkUnit[] benchmarks) return benchmark_count == benchmarks_passed; } -fn bool __run_default_benchmark_runner() +fn bool default_benchmark_runner() { @pool() { @@ -245,7 +245,7 @@ fn bool run_tests(TestUnit[] tests) return test_count == tests_passed; } -fn bool __run_default_test_runner() +fn bool default_test_runner() { @pool() { diff --git a/src/build/build_options.c b/src/build/build_options.c index 3cb42ad56..040a940c8 100644 --- a/src/build/build_options.c +++ b/src/build/build_options.c @@ -137,6 +137,8 @@ static void usage(void) OUTPUT(" --link-libc= - Link libc other default libraries (default: yes)."); OUTPUT(" --emit-stdlib= - Output files for the standard library. (default: yes)"); OUTPUT(" --panicfn - Override the panic function name."); + OUTPUT(" --testfn - Override the test runner function name."); + OUTPUT(" --benchfn - Override the benchmark runner function name."); OUTPUT(""); OUTPUT(" --reloc=