-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2120db4
commit dc27e8c
Showing
12 changed files
with
99 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) 2021-2022 ChilliBits. All rights reserved. | ||
|
||
#include "CLIInterface.h" | ||
|
||
// GCOV_EXCL_START | ||
|
||
void CLIInterface::createInterface() { | ||
// Allow positional args | ||
app.allow_windows_style_options(); | ||
app.allow_extras(); | ||
app.positionals_at_end(); | ||
app.footer("(c) Marc Auberer 2021-2022"); | ||
|
||
// Add version flag | ||
std::string versionName = std::string(SPICE_VERSION); | ||
std::string builtBy = std::string(SPICE_BUILT_BY); | ||
std::string versionString = "Spice version " + versionName + "\nbuilt by: " + builtBy + "\n\n(c) Marc Auberer 2021-2022"; | ||
app.set_version_flag("--version,-v", versionString); | ||
} | ||
|
||
void CLIInterface::addOptions(bool &updateRefs, bool &runBenchmarks, bool &skipNonGitHubTests) { | ||
// --update-refs | ||
app.add_flag<bool>("--update-refs,-u", updateRefs, "Update test reference files"); | ||
// --run-benchmarks | ||
app.add_flag<bool>("--run-benchmarks,-b", runBenchmarks, "Also run benchmarks and check baseline values"); | ||
// --skip-github-tests | ||
app.add_flag<bool>("--skip-github-tests,-gh", skipNonGitHubTests, "Skip non-working tests on GitHub Actions"); | ||
} | ||
|
||
/** | ||
* Start the parsing process | ||
* | ||
* @param argc Argument count | ||
* @param argv Argument vector | ||
* @return Return code | ||
*/ | ||
int CLIInterface::parse(int argc, char **argv) { | ||
try { | ||
app.parse(argc, argv); | ||
} catch (const CLI::ParseError &parseError) { | ||
return app.exit(parseError); | ||
} | ||
return 0; | ||
} | ||
|
||
// GCOV_EXCL_STOP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) 2021-2022 ChilliBits. All rights reserved. | ||
|
||
#pragma once | ||
|
||
#include "../../lib/cli11/CLI11.hpp" | ||
|
||
// GCOV_EXCL_START | ||
|
||
/** | ||
* Helper class to setup the cli interface and command line parser | ||
*/ | ||
class CLIInterface { | ||
public: | ||
// Constructors | ||
explicit CLIInterface() = default; | ||
|
||
// Public methods | ||
void createInterface(); | ||
void addOptions(bool &updateRefs, bool &runBenchmarks, bool &skipNonGitHubTests); | ||
int parse(int argc, char **argv); | ||
|
||
private: | ||
// Private members | ||
CLI::App app = CLI::App{"Spice Test Runner", "spice"}; | ||
}; | ||
|
||
// GCOV_EXCL_STOP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters