| 14 | worker_{ &TestControlModule::Run_, this } |
| 15 | {} |
| 16 | void TestControlModule::Run_() |
| 17 | { |
| 18 | std::string line; |
| 19 | // wait for ping before entering main execution mode |
| 20 | while (std::getline(std::cin, line)) { |
| 21 | if (line == "%ping") { |
| 22 | WriteResponse_("ping-ok"); |
| 23 | break; |
| 24 | } |
| 25 | else { |
| 26 | WriteResponse_("err-expect-ping"); |
| 27 | } |
| 28 | } |
| 29 | // command execution loop |
| 30 | while (std::getline(std::cin, line)) { |
| 31 | if (line == "%quit") { |
| 32 | SetEvent(pService_->GetServiceStopHandle()); |
| 33 | WriteResponse_("quit-ok"); |
| 34 | break; |
| 35 | } |
| 36 | else if (line == "%status") { |
| 37 | std::ostringstream oss; |
| 38 | cereal::JSONOutputArchive{ oss }(pPresentMon_->GetTestingStatus()); |
| 39 | WriteResponse_(oss.str()); |
| 40 | } |
| 41 | else { |
| 42 | WriteResponse_("err-bad-command"); |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | void TestControlModule::WriteResponse_(const std::string& payload) |
| 47 | { |
| 48 | std::cout << std::format("%%{{{}}}%%\n", payload) << std::flush; |
nothing calls this directly
no test coverage detected