add support for passing arguments via environment variable
This commit is contained in:
@ -30,6 +30,8 @@
|
|||||||
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
|
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
|
||||||
|
using LAMMPS_NS::utils::split_words;
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
|
|
||||||
@ -261,6 +263,16 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
MPI_Init(&argc, &argv);
|
MPI_Init(&argc, &argv);
|
||||||
::testing::InitGoogleMock(&argc, argv);
|
::testing::InitGoogleMock(&argc, argv);
|
||||||
|
|
||||||
|
// handle arguments passed via environment variable
|
||||||
|
if (const char *var = getenv("TEST_ARGS")) {
|
||||||
|
std::vector<std::string> env = split_words(var);
|
||||||
|
for (auto arg : env) {
|
||||||
|
if (arg == "-v") {
|
||||||
|
verbose = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true;
|
if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true;
|
||||||
|
|
||||||
int rv = RUN_ALL_TESTS();
|
int rv = RUN_ALL_TESTS();
|
||||||
|
|||||||
Reference in New Issue
Block a user