This commit is contained in:
Erik Frojdh 2019-11-26 20:34:17 +01:00
parent bf199767dc
commit 7f3d5e8a7e
3 changed files with 75 additions and 197 deletions

View File

@ -3,6 +3,7 @@ target_sources(tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/test-slsDetector.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test-slsDetector.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-rx.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-rx.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-eiger.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-Result.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test-Result.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdLineParser.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test-CmdLineParser.cpp
) )

View File

@ -13,35 +13,8 @@ using test::GET;
using test::PUT; using test::PUT;
/* /*
This file should contain receiver specific tests This file should contain receiver specific tests use python/scripts/list_tested_cmd.py
25/11/2019 we have: to check if all commands are covered
rx_datastream
rx_dbitlist
rx_dbitoffset
rx_discardpolicy
rx_fifodepth
rx_frameindex
rx_framescaught
rx_framesperfile
rx_hostname
rx_jsonaddheader
rx_jsonpara
rx_lastclient
rx_lock
rx_missingpackets
rx_padding
rx_printconfig
rx_readfreq
rx_realudpsocksize
rx_silent
rx_start
rx_status
rx_stop
rx_tcpport
rx_udpsocksize
rx_version
rx_zmqip
rx_zmqport
*/ */

View File

@ -1377,8 +1377,6 @@ using test::PUT;
// } // }
TEST_CASE("user", "[.cmd]") { TEST_CASE("user", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
@ -1453,7 +1451,6 @@ TEST_CASE("stopport", "[.cmd]") {
REQUIRE(port == 1953); REQUIRE(port == 1953);
} }
// TEST_CASE("adcreg", "[.cmd]") { // TEST_CASE("adcreg", "[.cmd]") {
// if (test::type == slsDetectorDefs::JUNGFRAU || test::type == // if (test::type == slsDetectorDefs::JUNGFRAU || test::type ==
// slsDetectorDefs::CHIPTESTBOARD || test::type == // slsDetectorDefs::CHIPTESTBOARD || test::type ==
@ -1755,7 +1752,6 @@ TEST_CASE("stopport", "[.cmd]") {
// REQUIRE_NOTHROW(multiSlsDetectorClient("rx_jsonaddheader \"\"", PUT)); // REQUIRE_NOTHROW(multiSlsDetectorClient("rx_jsonaddheader \"\"", PUT));
// } // }
// TEST_CASE("patsetbit", "[.cmd][.ctb]") { // TEST_CASE("patsetbit", "[.cmd][.ctb]") {
// if (test::type == slsDetectorDefs::CHIPTESTBOARD) { // if (test::type == slsDetectorDefs::CHIPTESTBOARD) {
// uint64_t val = 0; // uint64_t val = 0;
@ -2845,19 +2841,6 @@ TEST_CASE("stopport", "[.cmd]") {
// } // }
// } // }
// TEST_CASE("quad", "[.cmd][.eiger]") {
// if (test::type == slsDetectorDefs::EIGER) {
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("quad", GET, nullptr,
// oss)); REQUIRE(oss.str() == "quad 0\n");
// }
// REQUIRE_NOTHROW(multiSlsDetectorClient("quad 0", PUT));
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("quad", GET));
// }
// }
// TEST_CASE("pulse", "[.cmd][.eiger]") { // TEST_CASE("pulse", "[.cmd][.eiger]") {
// REQUIRE_THROWS(multiSlsDetectorClient("pulse", GET)); // REQUIRE_THROWS(multiSlsDetectorClient("pulse", GET));
// REQUIRE_THROWS(multiSlsDetectorClient("pulsenmove", GET)); // REQUIRE_THROWS(multiSlsDetectorClient("pulsenmove", GET));
@ -3267,8 +3250,6 @@ TEST_CASE("stopport", "[.cmd]") {
// } // }
// } // }
// TEST_CASE("zmqport", "[.cmd]") { // TEST_CASE("zmqport", "[.cmd]") {
// multiSlsDetector d; // multiSlsDetector d;
// int socketsperdetector = 1; // int socketsperdetector = 1;
@ -3299,8 +3280,6 @@ TEST_CASE("stopport", "[.cmd]") {
// } // }
// } // }
// TEST_CASE("fpath", "[.cmd]") { // TEST_CASE("fpath", "[.cmd]") {
// std::string s; // std::string s;
// { // {
@ -3325,34 +3304,6 @@ TEST_CASE("stopport", "[.cmd]") {
// } // }
// } // }
// TEST_CASE("rx_hostname", "[.cmd]") {
// std::string s;
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:rx_hostname", GET, nullptr,
// oss)); s = oss.str();
// }
// {
// REQUIRE_NOTHROW(multiSlsDetectorClient(s, PUT));
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:rx_hostname", GET, nullptr,
// oss)); REQUIRE(oss.str() == s);
// }
// // save rx_hostame's ip somewhere (getent hosts [rx_hostname])
// {
// REQUIRE_NOTHROW(multiSlsDetectorClient("rx_hostname none", PUT));
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:rx_hostname", GET, nullptr,
// oss)); REQUIRE(oss.str() == "rx_hostname none\n");
// }
// {
// REQUIRE_NOTHROW(multiSlsDetectorClient("rx_hostname 129.129.205.80",
// PUT)); std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:rx_hostname", GET, nullptr,
// oss)); REQUIRE(oss.str() == "rx_hostname 129.129.205.80\n");
// }
// }
// TEST_CASE("txndelay", "[.cmd][.eiger][.jungfrau]") { // TEST_CASE("txndelay", "[.cmd][.eiger][.jungfrau]") {
// if (test::type == slsDetectorDefs::EIGER) { // if (test::type == slsDetectorDefs::EIGER) {
// { // {
@ -3454,8 +3405,6 @@ TEST_CASE("stopport", "[.cmd]") {
// } // }
// } // }
// TEST_CASE("network", "[.cmd]") { // TEST_CASE("network", "[.cmd]") {
// /* {TODO custom srcip in globals // /* {TODO custom srcip in globals
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:udp_srcip 129.129.205.203", // REQUIRE_NOTHROW(multiSlsDetectorClient("0:udp_srcip 129.129.205.203",
@ -3617,38 +3566,46 @@ TEST_CASE("stopport", "[.cmd]") {
// REQUIRE_THROWS(multiSlsDetectorClient("numinterfaces 0", PUT)); // REQUIRE_THROWS(multiSlsDetectorClient("numinterfaces 0", PUT));
// } // }
// TEST_CASE("timing", "[.cmd]") { TEST_CASE("timing", "[.cmd]") {
// { Detector det;
// REQUIRE_NOTHROW(multiSlsDetectorClient("timing auto", PUT)); CmdProxy proxy(&det);
// std::ostringstream oss; det.setTimingMode(defs::AUTO_TIMING); // start in auto
// REQUIRE_NOTHROW(multiSlsDetectorClient("timing", GET, nullptr, oss)); {
// REQUIRE(oss.str() == "timing auto\n"); std::ostringstream oss1, oss2;
// } proxy.Call("timing", {"auto"}, -1, PUT, oss1);
// { REQUIRE(oss1.str() == "timing auto\n");
// REQUIRE_NOTHROW(multiSlsDetectorClient("timing trigger", PUT)); proxy.Call("timing", {}, -1, GET, oss2);
// std::ostringstream oss; REQUIRE(oss2.str() == "timing auto\n");
// REQUIRE_NOTHROW(multiSlsDetectorClient("timing", GET, nullptr, oss)); }
// REQUIRE(oss.str() == "timing trigger\n"); {
// } std::ostringstream oss1, oss2;
// if (test::type == slsDetectorDefs::EIGER) { proxy.Call("timing", {"trigger"}, -1, PUT, oss1);
// { REQUIRE(oss1.str() == "timing trigger\n");
// REQUIRE_NOTHROW(multiSlsDetectorClient("timing gating", PUT)); proxy.Call("timing", {}, -1, GET, oss2);
// std::ostringstream oss; REQUIRE(oss2.str() == "timing trigger\n");
// REQUIRE_NOTHROW(multiSlsDetectorClient("timing", GET, nullptr, }
// oss)); REQUIRE(oss.str() == "timing gating\n"); auto det_type = det.getDetectorType().squash();
// } if (det_type == slsDetectorDefs::EIGER) {
// { {
// REQUIRE_NOTHROW(multiSlsDetectorClient("timing burst_trigger", std::ostringstream oss1, oss2;
// PUT)); std::ostringstream oss; proxy.Call("timing", {"gating"}, -1, PUT, oss1);
// REQUIRE_NOTHROW(multiSlsDetectorClient("timing", GET, nullptr, REQUIRE(oss1.str() == "timing gating\n");
// oss)); REQUIRE(oss.str() == "timing burst_trigger\n"); proxy.Call("timing", {}, -1, GET, oss2);
// } REQUIRE(oss2.str() == "timing gating\n");
// } else { }
// REQUIRE_THROWS(multiSlsDetectorClient("timing gating", PUT)); {
// REQUIRE_THROWS(multiSlsDetectorClient("timing burst_trigger", PUT)); std::ostringstream oss1, oss2;
// } proxy.Call("timing", {"burst_trigger"}, -1, PUT, oss1);
// REQUIRE_NOTHROW(multiSlsDetectorClient("timing auto", PUT)); REQUIRE(oss1.str() == "timing burst_trigger\n");
// } proxy.Call("timing", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "timing burst_trigger\n");
}
} else {
REQUIRE_THROWS(proxy.Call("timing", {"gating"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("timing", {"burst_trigger"}, -1, PUT));
}
det.setTimingMode(defs::AUTO_TIMING); // reset to auto
}
// TEST_CASE("adc", "[.cmd][.ctb]") { // TEST_CASE("adc", "[.cmd][.ctb]") {
// if (test::type != slsDetectorDefs::CHIPTESTBOARD) { // if (test::type != slsDetectorDefs::CHIPTESTBOARD) {
@ -4064,13 +4021,13 @@ TEST_CASE("stopport", "[.cmd]") {
// CHECK_NOTHROW(multiSlsDetectorClient("type", GET)); // CHECK_NOTHROW(multiSlsDetectorClient("type", GET));
// } // }
// TEST_CASE("firmwareversion", "[.cmd]") { TEST_CASE("firmwareversion", "[.cmd]") {
// { Detector det;
// std::ostringstream oss; CmdProxy proxy(&det);
// CHECK_NOTHROW(multiSlsDetectorClient("firmwareversion", GET, nullptr, std::ostringstream oss;
// oss)); proxy.Call("firmwareversion", {}, -1, GET, oss);
// } REQUIRE_THROWS(proxy.Call("firmwareversion", {"4"}, -1, PUT, oss));
// } }
// TEST_CASE("status", "[.cmd]") { // TEST_CASE("status", "[.cmd]") {
// Detector det; // Detector det;
// CmdProxy proxy(&det); // CmdProxy proxy(&det);
@ -4105,53 +4062,6 @@ TEST_CASE("stopport", "[.cmd]") {
// proxy.Call("frames", {"1"}, -1, PUT); // proxy.Call("frames", {"1"}, -1, PUT);
// } // }
// TEST_CASE("trigger", "[.cmd][.eiger]") {
// if(test::type != slsDetectorDefs::EIGER) {
// REQUIRE_THROWS(multiSlsDetectorClient("trigger", PUT));
// } else {
// // trigger
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("timing trigger", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "timing trigger\n");
// }
// int startingfnum = 0;
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("startingfnum", GET,
// nullptr, oss)); std::string s = (oss.str()).erase (0,
// strlen("startingfnum ")); startingfnum = std::stoi(s);
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("start", PUT, nullptr,
// oss)); REQUIRE(oss.str() == "start successful\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("status", GET, nullptr,
// oss)); REQUIRE(oss.str() != "status idle\n"); REQUIRE(oss.str()
// != "status stopped\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("trigger", PUT, nullptr,
// oss)); REQUIRE(oss.str() == "trigger successful\n");
// }
// REQUIRE_NOTHROW(multiSlsDetectorClient("stop", PUT));
// int currentfnum = 0;
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("startingfnum", GET,
// nullptr, oss)); std::string s = (oss.str()).erase (0,
// strlen("startingfnum ")); currentfnum = std::stoi(s);
// }
// REQUIRE((startingfnum + 1) == currentfnum);
// REQUIRE_NOTHROW(multiSlsDetectorClient("timing auto", PUT));
// }
// }
// TEST_CASE("framesl", "[.cmd][.jungfrau][gotthard][ctb]") { // TEST_CASE("framesl", "[.cmd][.jungfrau][gotthard][ctb]") {
// if(test::type == slsDetectorDefs::EIGER) { // if(test::type == slsDetectorDefs::EIGER) {
// REQUIRE_THROWS(multiSlsDetectorClient("framesl", GET)); // REQUIRE_THROWS(multiSlsDetectorClient("framesl", GET));
@ -4274,8 +4184,6 @@ TEST_CASE("stopport", "[.cmd]") {
// } // }
// } // }
TEST_CASE("frames", "[.cmd]") { TEST_CASE("frames", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
@ -4297,8 +4205,6 @@ TEST_CASE("frames", "[.cmd]") {
} }
} }
TEST_CASE("fwrite", "[.cmd]") { TEST_CASE("fwrite", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
@ -4380,8 +4286,6 @@ TEST_CASE("findex", "[.cmd]") {
} }
} }
TEST_CASE("fname", "[.cmd]") { TEST_CASE("fname", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
@ -4402,7 +4306,6 @@ TEST_CASE("fname", "[.cmd]") {
} }
} }
TEST_CASE("lock", "[.cmd]") { TEST_CASE("lock", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
@ -4427,8 +4330,6 @@ TEST_CASE("lock", "[.cmd]") {
// REQUIRE_NOTHROW(multiSlsDetectorClient("lastclient", GET)); // REQUIRE_NOTHROW(multiSlsDetectorClient("lastclient", GET));
// } // }
TEST_CASE("exptime", "[.cmd]") { TEST_CASE("exptime", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
@ -4469,25 +4370,28 @@ TEST_CASE("period", "[.cmd]") {
} }
} }
// TEST_CASE("delay", "[.cmd][.eiger]") { TEST_CASE("delay", "[.cmd]") {
// if(test::type == slsDetectorDefs::EIGER) { Detector det;
// REQUIRE_THROWS(multiSlsDetectorClient("delay 1", PUT)); CmdProxy proxy(&det);
// REQUIRE_THROWS(multiSlsDetectorClient("delay", GET)); auto det_type = det.getDetectorType().squash();
// } else { if (det_type == defs::EIGER) {
// { REQUIRE_THROWS(proxy.Call("delay", {"1"}, -1, PUT));
// std::ostringstream oss; REQUIRE_THROWS(proxy.Call("delay", {}, -1, GET));
// REQUIRE_NOTHROW(multiSlsDetectorClient("delay 1.25s", PUT, } else {
// nullptr, oss)); REQUIRE(oss.str() == "delay 1.25s\n"); {
// } std::ostringstream oss;
// { proxy.Call("delay", {"1.25s"}, -1, PUT, oss);
// std::ostringstream oss; REQUIRE(oss.str() == "delay 1.25s\n");
// REQUIRE_NOTHROW(multiSlsDetectorClient("delay", GET, nullptr, }
// oss)); REQUIRE(oss.str() == "delay 1.25s\n"); {
// } std::ostringstream oss;
// { proxy.Call("delay", {}, -1, GET, oss);
// std::ostringstream oss; REQUIRE(oss.str() == "delay 1.25s\n");
// REQUIRE_NOTHROW(multiSlsDetectorClient("delay 0", PUT, nullptr, }
// oss)); REQUIRE(oss.str() == "delay 0\n"); {
// } std::ostringstream oss;
// } proxy.Call("delay", {"0s"}, -1, PUT, oss);
// } REQUIRE(oss.str() == "delay 0s\n");
}
}
}