mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
tests: transmission delay cannot be got for a single module for jf and m3, resetting fpga is not an option to test others
This commit is contained in:
parent
104bc6f619
commit
68beba732e
@ -2745,50 +2745,65 @@ TEST_CASE("txdelay", "[.cmd]") {
|
|||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU ||
|
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU ||
|
||||||
det_type == defs::MYTHEN3) {
|
det_type == defs::MYTHEN3) {
|
||||||
Result<int> prev_left, prev_right;
|
|
||||||
bool eiger = false;
|
|
||||||
if (det_type == defs::EIGER) {
|
|
||||||
eiger = true;
|
|
||||||
prev_left = det.getTransmissionDelayLeft();
|
|
||||||
prev_right = det.getTransmissionDelayRight();
|
|
||||||
}
|
|
||||||
auto prev_frame = det.getTransmissionDelayFrame();
|
|
||||||
auto val = 5000;
|
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::MYTHEN3) {
|
|
||||||
val = 5;
|
|
||||||
}
|
|
||||||
std::string sval = std::to_string(val);
|
|
||||||
{
|
|
||||||
std::ostringstream oss1, oss2;
|
|
||||||
proxy.Call("txdelay", {sval}, -1, PUT, oss1);
|
|
||||||
REQUIRE(oss1.str() == "txdelay " + sval + "\n");
|
|
||||||
proxy.Call("txdelay", {}, -1, GET, oss2);
|
|
||||||
REQUIRE(oss2.str() == "txdelay " + sval + "\n");
|
|
||||||
}
|
|
||||||
// test other mods
|
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
|
||||||
if (eiger) {
|
|
||||||
REQUIRE(det.getTransmissionDelayLeft({i}).squash(-1) ==
|
|
||||||
(2 * i * val));
|
|
||||||
REQUIRE(det.getTransmissionDelayRight({i}).squash(-1) ==
|
|
||||||
((2 * i + 1) * val));
|
|
||||||
REQUIRE(det.getTransmissionDelayFrame({i}).squash(-1) ==
|
|
||||||
(2 * det.size() * val));
|
|
||||||
} else {
|
|
||||||
REQUIRE(det.getTransmissionDelayFrame({i}).squash(-1) ==
|
|
||||||
(i * val));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// not a module level command
|
|
||||||
REQUIRE_THROWS(proxy.Call("txdelay", {"5"}, 0, PUT));
|
|
||||||
REQUIRE_THROWS(proxy.Call("txdelay", {}, 0, GET));
|
|
||||||
|
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
// cannot get transmission delay with just one module
|
||||||
if (eiger) {
|
if ((det_type == defs::JUNGFRAU || det_type == defs::MYTHEN3) && (det.size() < 2)) {
|
||||||
det.setTransmissionDelayLeft(prev_left[i]);
|
REQUIRE_THROWS(proxy.Call("txdelay", {}, -1, GET));
|
||||||
det.setTransmissionDelayRight(prev_right[i]);
|
int val = 5;
|
||||||
|
std::string sval = std::to_string(val);
|
||||||
|
{
|
||||||
|
std::ostringstream oss1;
|
||||||
|
proxy.Call("txdelay", {sval}, -1, PUT, oss1);
|
||||||
|
REQUIRE(oss1.str() == "txdelay " + sval + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
Result<int> prev_left, prev_right;
|
||||||
|
bool eiger = false;
|
||||||
|
if (det_type == defs::EIGER) {
|
||||||
|
eiger = true;
|
||||||
|
prev_left = det.getTransmissionDelayLeft();
|
||||||
|
prev_right = det.getTransmissionDelayRight();
|
||||||
|
}
|
||||||
|
auto prev_frame = det.getTransmissionDelayFrame();
|
||||||
|
auto val = 5000;
|
||||||
|
if (det_type == defs::JUNGFRAU || det_type == defs::MYTHEN3) {
|
||||||
|
val = 5;
|
||||||
|
}
|
||||||
|
std::string sval = std::to_string(val);
|
||||||
|
{
|
||||||
|
std::ostringstream oss1, oss2;
|
||||||
|
proxy.Call("txdelay", {sval}, -1, PUT, oss1);
|
||||||
|
REQUIRE(oss1.str() == "txdelay " + sval + "\n");
|
||||||
|
proxy.Call("txdelay", {}, -1, GET, oss2);
|
||||||
|
REQUIRE(oss2.str() == "txdelay " + sval + "\n");
|
||||||
|
}
|
||||||
|
// test other mods
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
if (eiger) {
|
||||||
|
REQUIRE(det.getTransmissionDelayLeft({i}).squash(-1) ==
|
||||||
|
(2 * i * val));
|
||||||
|
REQUIRE(det.getTransmissionDelayRight({i}).squash(-1) ==
|
||||||
|
((2 * i + 1) * val));
|
||||||
|
REQUIRE(det.getTransmissionDelayFrame({i}).squash(-1) ==
|
||||||
|
(2 * det.size() * val));
|
||||||
|
} else {
|
||||||
|
REQUIRE(det.getTransmissionDelayFrame({i}).squash(-1) ==
|
||||||
|
(i * val));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// not a module level command
|
||||||
|
REQUIRE_THROWS(proxy.Call("txdelay", {"5"}, 0, PUT));
|
||||||
|
REQUIRE_THROWS(proxy.Call("txdelay", {}, 0, GET));
|
||||||
|
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
if (eiger) {
|
||||||
|
det.setTransmissionDelayLeft(prev_left[i]);
|
||||||
|
det.setTransmissionDelayRight(prev_right[i]);
|
||||||
|
}
|
||||||
|
det.setTransmissionDelayFrame(prev_frame[i]);
|
||||||
}
|
}
|
||||||
det.setTransmissionDelayFrame(prev_frame[i]);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("txdelay", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("txdelay", {}, -1, GET));
|
||||||
@ -2912,9 +2927,10 @@ TEST_CASE("resetfpga", "[.cmd]") {
|
|||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
||||||
det_type == defs::MOENCH) {
|
det_type == defs::MOENCH) {
|
||||||
std::ostringstream oss;
|
// reset will also reset udp info from config file (comment out for invdividual tests)
|
||||||
proxy.Call("resetfpga", {}, -1, PUT, oss);
|
// std::ostringstream oss;
|
||||||
REQUIRE(oss.str() == "resetfpga successful\n");
|
// proxy.Call("resetfpga", {}, -1, PUT, oss);
|
||||||
|
// REQUIRE(oss.str() == "resetfpga successful\n");
|
||||||
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, GET));
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, GET));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user