Skip to content

Commit

Permalink
#1199: tests: end argv vector with nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Dec 30, 2020
1 parent 8a81163 commit 02d77c3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/unit/test_parallel_harness.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ struct TestParallelHarnessAny : TestHarnessAny<TestBase> {
auto const new_args = injectAdditionalArgs(test_argc, test_argv);
auto custom_argc = new_args.first;
auto custom_argv = new_args.second;
vtAssert(
custom_argv[custom_argc] == nullptr,
"The value of argv[argc] should always be 0"
);
CollectiveOps::initialize(custom_argc, custom_argv, no_workers, true, &comm);

#if DEBUG_TEST_HARNESS_PRINT
Expand Down Expand Up @@ -157,7 +161,8 @@ struct TestParallelHarnessAny : TestHarnessAny<TestBase> {

addAdditionalArgs();

int custom_argc = additional_args_.size();
additional_args_.emplace_back(nullptr);
int custom_argc = additional_args_.size() - 1;
char** custom_argv = additional_args_.data();

return std::make_pair(custom_argc, custom_argv);
Expand Down

0 comments on commit 02d77c3

Please sign in to comment.