Commit 50be8618 authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[3407] Fixed cppcheck complaint, and a failed unit test on Centos

IOSignal.construction unit test fails on Centos when other tests are
run. IOSignal::sequence_id_ which is static doesn't reliably get zero'd out
under gtest.
parent 73f57b83
......@@ -261,13 +261,6 @@ DControllerTest::scheduleTimedWrite(const std::string& config,
void
DControllerTest::runWithConfig(const std::string& config, int run_time_ms,
time_duration& elapsed_time) {
// Set up valid command line arguments
char* argv[] = { const_cast<char*>("progName"),
const_cast<char*>("-c"),
const_cast<char*>(DControllerTest::CFG_TEST_FILE),
const_cast<char*>("-v") };
int argc = 4;
// Create the config file.
writeFile(config);
......@@ -279,7 +272,12 @@ DControllerTest::runWithConfig(const std::string& config, int run_time_ms,
// We catch and rethrow to allow testing error scenarios.
ptime start = microsec_clock::universal_time();
try {
launch(argc, argv);
// Set up valid command line arguments
char* argv[] = { const_cast<char*>("progName"),
const_cast<char*>("-c"),
const_cast<char*>(DControllerTest::CFG_TEST_FILE),
const_cast<char*>("-v") };
launch(4, argv);
} catch (...) {
// calculate elasped time, then rethrow it
elapsed_time = microsec_clock::universal_time() - start;
......
......@@ -148,8 +148,8 @@ TEST(IOSignal, construction) {
// Verify constructor with valid arguments works.
ASSERT_NO_THROW(signal.reset(new IOSignal(*io_service, SIGINT,
dummyHandler)));
// Verify sequence_id is 2, we burned 1 with the failed constructor.
EXPECT_EQ(2, signal->getSequenceId());
// Verify sequence_id is set.
EXPECT_EQ(IOSignal::nextSequenceId()-1, signal->getSequenceId());
// Verify SIGINT is correct.
EXPECT_EQ(SIGINT, signal->getSignum());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment