Skip to content

Commit

Permalink
fixed argc and argv not being set in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoessbauer committed May 18, 2017
1 parent 4b482fb commit ba71fd8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dash/test/TestBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class TestBase : public ::testing::Test {
::testing::UnitTest::GetInstance()->current_test_info();
LOG_MESSAGE("===> Running test case %s.%s ...",
test_info->test_case_name(), test_info->name());
dash::init(&TESTENV.argc, &TESTENV.argv);
dash::init(&TESTENV::argc, &TESTENV::argv);

LOG_MESSAGE("-==- DASH initialized with %lu units", dash::size());
dash::barrier();
Expand Down
9 changes: 5 additions & 4 deletions dash/test/TestGlobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define DASH__TEST__TEST_GLOBALS_H_

// store program arguments to pass to dash::init
static struct testenv_t {
int argc;
char ** argv;
} TESTENV;
class TESTENV {
public:
static int argc;
static char ** argv;
};

#endif // DASH__TEST__TEST_GLOBALS_H_
6 changes: 4 additions & 2 deletions dash/test/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
using ::testing::UnitTest;
using ::testing::TestEventListeners;

int TESTENV::argc;
char ** TESTENV::argv;

int main(int argc, char * argv[])
{
char hostname[100];
int team_myid = -1;
int team_size = -1;
TESTENV.argc = argc;
TESTENV.argv = argv;
TESTENV::argc = argc;
TESTENV::argv = argv;

gethostname(hostname, 100);
std::string host(hostname);
Expand Down

0 comments on commit ba71fd8

Please sign in to comment.