GCC Code Coverage Report


Directory: ../
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 0 / 22 / 22
Functions: -% 0 / 3 / 3
Branches: -% 0 / 50 / 50

test/driver/TestDriver.cpp
Line Branch Exec Source
1 // Copyright (c) 2021-2026 ChilliBits. All rights reserved.
2
3 #include "TestDriver.h"
4
5 #include "util/CommonUtil.h"
6
7 // GCOV_EXCL_START
8 namespace spice::testing {
9
10 TestDriverCliOptions testDriverCliOptions;
11
12 void TestDriver::createInterface() {
13 // Allow positional args
14 app.allow_non_standard_option_names();
15 app.positionals_at_end();
16 app.require_subcommand(0);
17 app.allow_extras(false);
18 app.footer("(c) Marc Auberer 2021-2026");
19
20 // Add version flag
21 app.set_version_flag("--version,-v", compiler::CommonUtil::buildVersionInfo());
22 }
23
24 void TestDriver::addOptions() {
25 // --update-refs
26 app.add_flag<bool>("--update-refs", testDriverCliOptions.updateRefs, "Update test reference files");
27 // --run-benchmarks
28 app.add_flag<bool>("--run-benchmarks", testDriverCliOptions.runBenchmarks, "Also run benchmarks and check baseline values");
29 // --leak-detection
30 app.add_flag<bool>("--leak-detection", testDriverCliOptions.enableLeakDetection, "Use Valgrind on tests to detect memory leaks");
31 // --is-github-actions
32 app.add_flag<bool>("--is-github-actions", testDriverCliOptions.isGitHubActions, "Skip tests that are not supported to run on GitHub Actions");
33 // --skip-sanitizer-tests
34 app.add_flag<bool>("--skip-sanitizer-tests", testDriverCliOptions.skipSanitizerTests, "Skip tests that exercise Spice language sanitizers (e.g. ASAN, TSAN, MSAN, TYSAN)");
35 // --verbose
36 app.add_flag<bool>("--verbose", testDriverCliOptions.isVerbose, "Print debug output for the test runner");
37 }
38
39 /**
40 * Start the parsing process
41 *
42 * @param argc Argument count
43 * @param argv Argument vector
44 * @return Return code
45 */
46 int TestDriver::parse(int argc, char **argv) {
47 try {
48 app.parse(argc, argv);
49 return 0;
50 } catch (const CLI::ParseError &parseError) {
51 return app.exit(parseError);
52 }
53 }
54
55 } // namespace spice::testing
56
57 // GCOV_EXCL_STOP
58