GCC Code Coverage Report


Directory: ../
File: test/driver/Driver.cpp
Date: 2025-02-05 01:09:36
Exec Total Coverage
Lines: 0 0 100.0%
Functions: 0 0 -%
Branches: 0 0 -%

Line Branch Exec Source
1 // Copyright (c) 2021-2025 ChilliBits. All rights reserved.
2
3 #include "Driver.h"
4
5 #include "util/CommonUtil.h"
6
7 // GCOV_EXCL_START
8
9 void Driver::createInterface() {
10 // Allow positional args
11 app.positionals_at_end();
12 app.require_subcommand(0);
13 app.allow_extras(false);
14 app.footer("(c) Marc Auberer 2021-2025");
15
16 // Add version flag
17 const std::string versionName(SPICE_VERSION);
18 const std::string builtBy(SPICE_BUILT_BY);
19 app.set_version_flag("--version,-v", spice::compiler::CommonUtil::buildVersionInfo());
20 }
21
22 void Driver::addOptions(bool &updateRefs, bool &runBenchmarks, bool &enableLeakDetection, bool &skipNonGitHubTests) {
23 // --update-refs
24 app.add_flag<bool>("--update-refs,-u", updateRefs, "Update test reference files");
25 // --run-benchmarks
26 app.add_flag<bool>("--run-benchmarks,-b", runBenchmarks, "Also run benchmarks and check baseline values");
27 // --leak-detection
28 app.add_flag<bool>("--leak-detection,-l", enableLeakDetection, "Use Valgrind on tests to detect memory leaks");
29 // --skip-github-tests
30 app.add_flag<bool>("--skip-github-tests,-gh", skipNonGitHubTests, "Skip non-working tests on GitHub Actions");
31 }
32
33 /**
34 * Start the parsing process
35 *
36 * @param argc Argument count
37 * @param argv Argument vector
38 * @return Return code
39 */
40 int Driver::parse(int argc, char **argv) {
41 try {
42 app.parse(argc, argv);
43 } catch (const CLI::ParseError &parseError) {
44 return app.exit(parseError);
45 }
46 return 0;
47 }
48
49 // GCOV_EXCL_STOP
50