|
|
|
@ -140,6 +140,18 @@ TEST_CASE("buildProcLogerMessage") { |
|
|
|
|
REQUIRE(p.getName() == "test_proclog"); |
|
|
|
|
REQUIRE(p.getState() == 'R'); |
|
|
|
|
REQUIRE_THAT(p.getExe().cStr(), Catch::Matchers::Contains("test_proclog")); |
|
|
|
|
REQUIRE(p.getCmdline().size() == 1); |
|
|
|
|
REQUIRE_THAT(p.getCmdline()[0], Catch::Matchers::Contains("test_proclog")); |
|
|
|
|
} else { |
|
|
|
|
std::string cmd_path = "/proc/" + std::to_string(p.getPid()) + "/cmdline"; |
|
|
|
|
if (util::file_exists(cmd_path)) { |
|
|
|
|
std::ifstream stream(cmd_path); |
|
|
|
|
auto cmdline = Parser::cmdline(stream); |
|
|
|
|
REQUIRE(cmdline.size() == p.getCmdline().size()); |
|
|
|
|
for (int i = 0; i < p.getCmdline().size(); ++i) { |
|
|
|
|
REQUIRE(cmdline[i] == p.getCmdline()[i].cStr()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|