somewhere between fork and pipes, crashes at sendingudppacket at print

This commit is contained in:
2020-04-03 20:18:16 +02:00
parent 7c7f7e8c70
commit eeed102bf3
7 changed files with 164 additions and 37 deletions

View File

@ -852,9 +852,88 @@ TEST_CASE("temp_fpga", "[.cmd][.new]") {
}
}
/* acquisition */
TEST_CASE("clearbusy", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
REQUIRE_NOTHROW(proxy.Call("clearbusy", {}, -1, PUT));
REQUIRE_THROWS(proxy.Call("clearbusy", {"0"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("clearbusy", {}, -1, GET));
}
TEST_CASE("start", "[.cmd][.rx][.new]") {
Detector det;
CmdProxy proxy(&det);
// PUT only command
REQUIRE_THROWS(proxy.Call("start", {}, -1, GET));
auto prev_val = det.getExptime();
det.setExptime(std::chrono::seconds(10));
{
std::ostringstream oss;
proxy.Call("start", {}, -1, PUT, oss);
REQUIRE(oss.str() == "start successful\n");
}
{
std::ostringstream oss;
proxy.Call("status", {}, -1, GET, oss);
REQUIRE(oss.str() == "status running\n");
}
det.stopDetector();
for (int i = 0; i != det.size(); ++i) {
det.setExptime(prev_val[i], {i});
}
}
TEST_CASE("stop", "[.cmd][.rx][.new]") {
Detector det;
CmdProxy proxy(&det);
// PUT only command
REQUIRE_THROWS(proxy.Call("stop", {}, -1, GET));
auto prev_val = det.getExptime();
det.setExptime(std::chrono::seconds(10));
det.startDetector();
{
std::ostringstream oss;
proxy.Call("status", {}, -1, GET, oss);
REQUIRE(oss.str() == "status running\n");
}
{
std::ostringstream oss;
proxy.Call("stop", {}, -1, PUT, oss);
REQUIRE(oss.str() == "stop successful\n");
}
{
std::ostringstream oss;
proxy.Call("status", {}, -1, GET, oss);
REQUIRE(oss.str() == "status idle\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setExptime(prev_val[i], {i});
}
}
TEST_CASE("status", "[.cmd][.rx][.new]") {
Detector det;
CmdProxy proxy(&det);
auto prev_val = det.getExptime();
det.setExptime(std::chrono::seconds(10));
det.startReceiver();
{
std::ostringstream oss;
proxy.Call("status", {}, -1, GET, oss);
REQUIRE(oss.str() == "status running\n");
}
det.stopReceiver();
{
std::ostringstream oss;
proxy.Call("status", {}, -1, GET, oss);
REQUIRE(oss.str() == "status idle\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setExptime(prev_val[i], {i});
}
}