This commit is contained in:
2020-06-04 17:42:24 +02:00
parent 099805ba8b
commit 7f6d57d6ba
6 changed files with 22 additions and 27 deletions

View File

@ -177,7 +177,9 @@ int main(int argc, char *argv[]) {
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
rebootNiosControllerAndFPGA();
#else
#ifndef VIRTUAL
system("reboot");
#endif
#endif
}
LOG(logINFO, ("Goodbye!\n"));

View File

@ -1525,13 +1525,17 @@ void Detector::savePattern(const std::string &fname) {
proxy.Call("patword", {addr}, -1, defs::GET_ACTION, outfile);
}
// rest of pattern file
const std::vector<std::string> commands{
std::vector<std::string> commands{
"patioctrl", "patclkctrl", "patlimits", "patloop0",
"patnloop0", "patloop1", "patnloop1", "patloop2",
"patnloop2", "patwait0", "patwaittime0", "patwait1",
"patwaittime1", "patwait2", "patwaittime2", "patmask",
"patsetbit",
};
auto det_type = getDetectorType().squash();
if (det_type == defs::MYTHEN3) {
commands.erase(commands.begin(), commands.begin() + 2);
}
for (const auto &cmd : commands)
proxy.Call(cmd, {}, -1, defs::GET_ACTION, outfile);
}

View File

@ -236,7 +236,8 @@ TEST_CASE("adcclk", "[.cmd][.new]") {
det.setADCClock(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("adcclk", {}, -1, GET));
// clock index might work
// REQUIRE_THROWS(proxy.Call("adcclk", {}, -1, GET));
}
}
@ -266,7 +267,8 @@ TEST_CASE("runclk", "[.cmd][.new]") {
det.setRUNClock(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("runclk", {}, -1, GET));
// clock index might work
// REQUIRE_THROWS(proxy.Call("runclk", {}, -1, GET));
}
}
@ -277,7 +279,8 @@ TEST_CASE("syncclk", "[.cmd][.new]") {
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
REQUIRE_NOTHROW(proxy.Call("syncclk", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("syncclk", {}, -1, GET));
// clock index might work
// REQUIRE_THROWS(proxy.Call("syncclk", {}, -1, GET));
}
}
@ -512,7 +515,8 @@ TEST_CASE("dbitclk", "[.cmd][.new]") {
det.setRUNClock(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("dbitclk", {}, -1, GET));
// clock index might work
// REQUIRE_THROWS(proxy.Call("dbitclk", {}, -1, GET));
}
}

View File

@ -114,7 +114,6 @@ TEST_CASE("emin", "[.cmd][.new]") {
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MOENCH) {
auto prev_val = det.getDetectorMinMaxEnergyThreshold(false);
{
std::ostringstream oss;
proxy.Call("emin", {"100"}, -1, PUT, oss);
@ -130,9 +129,6 @@ TEST_CASE("emin", "[.cmd][.new]") {
proxy.Call("emin", {}, -1, GET, oss);
REQUIRE(oss.str() == "emin 200\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setDetectorMinMaxEnergyThreshold(false, prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("emin", {}, -1, GET));
}
@ -143,7 +139,6 @@ TEST_CASE("emax", "[.cmd][.new]") {
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MOENCH) {
auto prev_val = det.getDetectorMinMaxEnergyThreshold(true);
{
std::ostringstream oss;
proxy.Call("emax", {"100"}, -1, PUT, oss);
@ -159,9 +154,6 @@ TEST_CASE("emax", "[.cmd][.new]") {
proxy.Call("emax", {}, -1, GET, oss);
REQUIRE(oss.str() == "emax 200\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setDetectorMinMaxEnergyThreshold(true, prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("emax", {}, -1, GET));
}
@ -172,7 +164,6 @@ TEST_CASE("framemode", "[.cmd][.new]") {
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MOENCH) {
auto prev_val = det.getFrameMode();
{
std::ostringstream oss;
proxy.Call("framemode", {"pedestal"}, -1, PUT, oss);
@ -199,9 +190,6 @@ TEST_CASE("framemode", "[.cmd][.new]") {
REQUIRE(oss.str() == "framemode newflatfield\n");
}
REQUIRE_THROWS(proxy.Call("framemode", {"counting"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setFrameMode(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("framemode", {}, -1, GET));
}
@ -212,7 +200,6 @@ TEST_CASE("detectormode", "[.cmd][.new]") {
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MOENCH) {
auto prev_val = det.getDetectorMode();
{
std::ostringstream oss;
proxy.Call("detectormode", {"counting"}, -1, PUT, oss);
@ -233,9 +220,6 @@ TEST_CASE("detectormode", "[.cmd][.new]") {
REQUIRE(oss.str() == "detectormode analog\n");
REQUIRE_THROWS(proxy.Call("detectormode", {"pedestal"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setDetectorMode(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("detectormode", {}, -1, GET));
}

View File

@ -534,9 +534,10 @@ TEST_CASE("patsetbit", "[.cmd][.new]") {
TEST_CASE("patternstart", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
REQUIRE_THROWS(proxy.Call("patternstart", {}, -1, GET));
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MYTHEN3) {
REQUIRE_THROWS(proxy.Call("patternstart", {}, -1, PUT));
REQUIRE_NOTHROW(proxy.Call("patternstart", {}, -1, PUT));
} else {
REQUIRE_THROWS(proxy.Call("patternstart", {}, -1, PUT));
}

View File

@ -1566,7 +1566,7 @@ TEST_CASE("rebootcontroller", "[.cmd][.new]") {
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
det_type == defs::MOENCH || det_type == defs::MYTHEN3 ||
det_type == defs::GOTTHARD2) {
det_type == defs::GOTTHARD2 || det_type == defs::GOTTHARD) {
// TODO: reboot real server?
// REQUIRE_NOTHROW(proxy.Call("rebootcontroller", {}, -1, PUT));
REQUIRE_THROWS(proxy.Call("rebootcontroller", {}, -1, GET));
@ -1710,8 +1710,8 @@ TEST_CASE("firmwaretest", "[.cmd][.new]") {
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
det_type == defs::GOTTHARD || det_type == defs::MYTHEN3 ||
det_type == defs::GOTTHARD2) {
det_type == defs::MOENCH || det_type == defs::GOTTHARD ||
det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD2) {
std::ostringstream oss;
proxy.Call("firmwaretest", {}, -1, PUT, oss);
REQUIRE(oss.str() == "firmwaretest successful\n");
@ -1727,8 +1727,8 @@ TEST_CASE("bustest", "[.cmd][.new]") {
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
det_type == defs::GOTTHARD || det_type == defs::MYTHEN3 ||
det_type == defs::GOTTHARD2) {
det_type == defs::MOENCH || det_type == defs::GOTTHARD ||
det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD2) {
std::ostringstream oss;
proxy.Call("bustest", {}, -1, PUT, oss);
REQUIRE(oss.str() == "bustest successful\n");