mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-02 20:12:07 +08:00
test_proclog: add cmdline check in buildProcLogerMessage (#25891)
old-commit-hash: 2e5b50c2d7c09accaa51e954790a478b125af591
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user