avoid having to use external test runner script by parsing environment variables directly

This commit is contained in:
Axel Kohlmeyer
2020-06-24 09:32:59 -04:00
parent 8cec13a038
commit ee5be42026
6 changed files with 137 additions and 28 deletions

View File

@ -17,9 +17,11 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <mpi.h>
#include <vector>
// common read_yaml_file function
bool read_yaml_file(const char *infile, TestConfig &config)
@ -76,6 +78,19 @@ int main(int argc, char **argv)
return 2;
}
// handle arguments passed via environment variable
std::vector<std::string> env = utils::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;
}
}
int iarg = 2;
while (iarg < argc) {