eiger tests

This commit is contained in:
Erik Frojdh 2019-12-03 11:47:49 +01:00
parent 9bc60518d8
commit 619106e05f
3 changed files with 138 additions and 84 deletions

View File

@ -13,10 +13,9 @@ using sls::Detector;
using test::GET;
using test::PUT;
TEST_CASE("dr", "[.cmd][.eiger]") {
TEST_CASE("dr", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::EIGER) {
// The only detector currently supporting setting dr
@ -46,31 +45,119 @@ TEST_CASE("dr", "[.cmd][.eiger]") {
}
}
// TEST_CASE("subexptime", "[.cmd][.eiger]") {
// if (test::type == slsDetectorDefs::EIGER) {
// std::string s;
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("subexptime", GET, nullptr,
// oss)); s = oss.str(); REQUIRE_NOTHROW(multiSlsDetectorClient(s,
// PUT));
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("subexptime", GET));
// TEST_CASE("interruptsubframe", "[.cmd][.eiger]") {
// Detector det;
// CmdProxy proxy(&det);
// auto det_type = det.getDetectorType().squash();
// if (det_type == defs::EIGER){
// auto previous = det.getInterruptSubframe();
// std::ostringstream oss1, oss2, oss3;
// proxy.Call("interruptsubframe", {"1"}, -1, PUT, oss1);
// REQUIRE(oss1.str() == "interruptsubframe 1\n");
// proxy.Call("interruptsubframe", {}, -1, GET, oss2);
// REQUIRE(oss2.str() == "interruptsubframe 1\n");
// proxy.Call("interruptsubframe", {"0"}, -1, PUT, oss3);
// REQUIRE(oss3.str() == "interruptsubframe 0\n");
// for (int i=0; i!=det.size(); ++i){
// det.setInterruptSubframe(previous[i], {i});
// }
// }else{
// REQUIRE_THROWS(proxy.Call("interruptsubframe", {}, -1, GET));
// REQUIRE_THROWS(proxy.Call("interruptsubframe", {"1"}, -1, PUT));
// }
// }
// TEST_CASE("subdeadtime", "[.cmd][.eiger]") {
// TEST_CASE("activate", "[.cmd][.eiger]") {
// if (test::type == slsDetectorDefs::EIGER) {
// std::string s;
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("subdeadtime", GET, nullptr,
// oss)); s = oss.str(); REQUIRE_NOTHROW(multiSlsDetectorClient(s,
// PUT));
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 1", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "activate 1\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 1 nopadding",
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 1
// nopadding\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 0 padding",
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 0
// padding\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 0 nopadding",
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 0
// nopadding\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 1 padding",
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 1
// padding\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate", GET,
// nullptr, oss)); REQUIRE(oss.str() == "activate 1 padding\n");
// }
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("subdeadtime", GET));
// REQUIRE_THROWS(multiSlsDetectorClient("activate", GET));
// }
// }
TEST_CASE("tengiga", "[.cmd][.eiger][.ctb]") {
TEST_CASE("subexptime", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::EIGER){
auto time = det.getSubExptime();
std::ostringstream oss1, oss2;
proxy.Call("subexptime", {"2.5us"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "subexptime 2.5us\n");
proxy.Call("subexptime", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "subexptime 2.5us\n");
for (int i = 0; i!=det.size(); ++i){
det.setSubExptime(time[i], {i});
}
}else{
REQUIRE_THROWS(proxy.Call("subexptime", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("subexptime", {"2.13"}, -1, PUT));
}
}
TEST_CASE("subdeadtime", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::EIGER){
auto time = det.getSubDeadTime();
std::ostringstream oss1, oss2;
proxy.Call("subdeadtime", {"500us"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "subdeadtime 500us\n");
proxy.Call("subdeadtime", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "subdeadtime 500us\n");
for (int i = 0; i!=det.size(); ++i){
det.setSubDeadTime(time[i], {i});
}
}else{
REQUIRE_THROWS(proxy.Call("subdeadtime", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("subdeadtime", {"2.13"}, -1, PUT));
}
}
TEST_CASE("tengiga", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);

View File

@ -13,11 +13,22 @@ using test::GET;
using test::PUT;
/*
This file should contain receiver specific tests use python/scripts/list_tested_cmd.py
to check if all commands are covered
This file should contain receiver specific tests use
python/scripts/list_tested_cmd.py to check if all commands are covered
*/
// TEST_CASE("A test", "[.hey]"){
// std::cout << "start\n";
// SECTION("a section"){
// std::cout << "s1\n";
// }
// SECTION("another section"){
// std::cout << "s2\n";
// }
// std::cout << "end\n";
// }
TEST_CASE("rx_hostname", "[.cmd]") {
// TODO! find a proper way to test, now we read out the rx_hostname
// and then put it to see that we don't crash
@ -26,6 +37,12 @@ TEST_CASE("rx_hostname", "[.cmd]") {
std::string hostname =
det.getRxHostname().tsquash("hostname must be same for test");
auto det_type = det.getDetectorType().squash();
sls::Result<sls::ns> time;
if (det_type == defs::EIGER) {
time = det.getSubDeadTime();
}
{
// disable receiver
std::ostringstream oss1, oss2;
@ -45,6 +62,14 @@ TEST_CASE("rx_hostname", "[.cmd]") {
proxy.Call("rx_hostname", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "rx_hostname " + hostname + "\n");
}
//Bug rx_hostname could change subdeadtime
if (det_type == defs::EIGER) {
auto time2 = det.getSubDeadTime();
for (int i = 0; i != det.size(); ++i) {
REQUIRE(time[i].count() == time2[i].count());
}
}
}
TEST_CASE("rx_framescaught", "[.cmd]") {

View File

@ -15,6 +15,8 @@ using test::GET;
using test::PUT;
TEST_CASE("Unknown command", "[.cmd]"){
Detector det;
CmdProxy proxy(&det);
REQUIRE_THROWS(proxy.Call("vsaevrreavv", {}, -1, PUT));
@ -2797,46 +2799,7 @@ TEST_CASE("stopport", "[.cmd]") {
// }
// }
// TEST_CASE("activate", "[.cmd][.eiger]") {
// if (test::type == slsDetectorDefs::EIGER) {
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 1", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "activate 1\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 1 nopadding",
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 1
// nopadding\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 0 padding",
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 0
// padding\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 0 nopadding",
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 0
// nopadding\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate 1 padding",
// PUT, nullptr, oss)); REQUIRE(oss.str() == "activate 1
// padding\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:activate", GET,
// nullptr, oss)); REQUIRE(oss.str() == "activate 1 padding\n");
// }
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("activate", GET));
// }
// }
// TEST_CASE("measuredsubperiod", "[.cmd][.eiger]") {
// if (test::type == slsDetectorDefs::EIGER) {
@ -2876,29 +2839,7 @@ TEST_CASE("stopport", "[.cmd]") {
// }
// }
// TEST_CASE("interruptsubframe", "[.cmd][.eiger]") {
// if (test::type == slsDetectorDefs::EIGER) {
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("interruptsubframe 1",
// PUT, nullptr, oss)); REQUIRE(oss.str() == "interruptsubframe
// 1\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("interruptsubframe", GET,
// nullptr, oss)); REQUIRE(oss.str() == "interruptsubframe 1\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("interruptsubframe 0",
// PUT, nullptr, oss)); REQUIRE(oss.str() == "interruptsubframe
// 0\n");
// }
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("interruptsubframe", GET));
// }
// }
// TEST_CASE("readnlines", "[.cmd][.eiger]") {
// if (test::type == slsDetectorDefs::EIGER) {
@ -4205,6 +4146,7 @@ TEST_CASE("lock", "[.cmd]") {
TEST_CASE("exptime", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
{
std::ostringstream oss;
proxy.Call("exptime", {"0.05"}, -1, PUT, oss);