add argument passing via TEST_ARGS environment variable to all tests with an explicit main function

This commit is contained in:
Axel Kohlmeyer
2020-06-24 09:53:56 -04:00
parent 6824b69ae9
commit 2af8d7a751
5 changed files with 59 additions and 9 deletions

View File

@ -82,15 +82,17 @@ int main(int argc, char **argv)
}
// handle arguments passed via environment variable
std::vector<std::string> env = split_words(getenv("TEST_ARGS"));
for (auto arg : env) {
if (arg == "-u") {
generate_yaml_file(argv[1], test_config);
return 0;
} else if (arg == "-s") {
print_stats = true;
} else if (arg == "-v") {
verbose = true;
if (const char *var = getenv("TEST_ARGS")) {
std::vector<std::string> env = split_words(var);
for (auto arg : env) {
if (arg == "-u") {
generate_yaml_file(argv[1], test_config);
return 0;
} else if (arg == "-s") {
print_stats = true;
} else if (arg == "-v") {
verbose = true;
}
}
}