formatting

This commit is contained in:
maliakal_d 2022-12-08 09:00:23 +01:00
parent 4ff0ef47eb
commit 9154478702
9 changed files with 63 additions and 56 deletions

View File

@ -226,7 +226,8 @@ int getModuleIdInFile(int *ret, char *mess, char *fileName) {
if (fd == NULL) { if (fd == NULL) {
#ifdef JUNGFRAUD #ifdef JUNGFRAUD
*ret = OK; *ret = OK;
LOG(logWARNING, ("Could not find detid_jungfrau.txt to set module id\n")); LOG(logWARNING,
("Could not find detid_jungfrau.txt to set module id\n"));
return 0; return 0;
#else #else
*ret = FAIL; *ret = FAIL;

View File

@ -488,7 +488,8 @@ void DetectorImpl::setTransmissionDelay(int step) {
"Transmission delay is not implemented for the this detector."); "Transmission delay is not implemented for the this detector.");
} }
//using a asyc+future directly (instead of Parallel) to pass different values // using a asyc+future directly (instead of Parallel) to pass different
// values
std::vector<std::future<void>> futures; std::vector<std::future<void>> futures;
for (int i = 0; i != size(); ++i) { for (int i = 0; i != size(); ++i) {
if (eiger) { if (eiger) {
@ -509,7 +510,7 @@ void DetectorImpl::setTransmissionDelay(int step) {
} }
} }
//wait for calls to complete // wait for calls to complete
for (auto &f : futures) for (auto &f : futures)
f.get(); f.get();
} }

View File

@ -586,7 +586,8 @@ TEST_CASE("vetostream", "[.cmd]") {
CmdProxy proxy(&det); CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2) { if (det_type == defs::GOTTHARD2) {
auto prev_val = det.getVetoStream().tsquash("inconsistent veto stream to test"); auto prev_val =
det.getVetoStream().tsquash("inconsistent veto stream to test");
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("vetostream", {"none"}, -1, PUT, oss); proxy.Call("vetostream", {"none"}, -1, PUT, oss);

View File

@ -98,7 +98,6 @@ TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs]") {
/* Network Configuration (Detector<->Receiver) */ /* Network Configuration (Detector<->Receiver) */
TEST_CASE("selinterface", "[.cmd]") { TEST_CASE("selinterface", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);

View File

@ -565,7 +565,7 @@ TEST_CASE("pumpprobe", "[.cmd]") {
// mask with counter 2 disabled and enabled(to test vth2) // mask with counter 2 disabled and enabled(to test vth2)
uint32_t fixedMask[2] = {0x4, 0x3}; uint32_t fixedMask[2] = {0x4, 0x3};
for (int i = 0; i != 2; ++i) { for (int i = 0; i != 2; ++i) {
std::cout << "i:"<< i <<std::endl; std::cout << "i:" << i << std::endl;
det.setCounterMask(fixedMask[i]); det.setCounterMask(fixedMask[i]);
{ {
// pump probe // pump probe

View File

@ -3,8 +3,8 @@
#include "CmdProxy.h" #include "CmdProxy.h"
#include "catch.hpp" #include "catch.hpp"
#include "sls/Detector.h" #include "sls/Detector.h"
#include "sls/sls_detector_defs.h"
#include "sls/Version.h" #include "sls/Version.h"
#include "sls/sls_detector_defs.h"
#include <sstream> #include <sstream>
#include "sls/versionAPI.h" #include "sls/versionAPI.h"
@ -798,7 +798,8 @@ TEST_CASE("rx_zmqport", "[.cmd][.rx]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
auto prev_val_zmqport = det.getRxZmqPort(); auto prev_val_zmqport = det.getRxZmqPort();
auto prev_val_numinterfaces = det.getNumberofUDPInterfaces().tsquash("inconsistent number of udp interfaces to test"); auto prev_val_numinterfaces = det.getNumberofUDPInterfaces().tsquash(
"inconsistent number of udp interfaces to test");
int socketsperdetector = 1; int socketsperdetector = 1;
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();

View File

@ -123,7 +123,6 @@ TEST_CASE("hardwareversion", "[.cmd]") {
} else { } else {
REQUIRE_THROWS(proxy.Call("hardwareversion", {"0"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("hardwareversion", {"0"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("hardwareversion", {}, -1, GET)); REQUIRE_THROWS(proxy.Call("hardwareversion", {}, -1, GET));
} }
} }
@ -565,13 +564,14 @@ TEST_CASE("fliprows", "[.cmd]") {
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
bool jungfrauhw2 = false; bool jungfrauhw2 = false;
if (det_type == defs::JUNGFRAU && if (det_type == defs::JUNGFRAU &&
((det.getHardwareVersion().tsquash("inconsistent serial number to test") ((det.getHardwareVersion().tsquash(
== "2.0"))) { "inconsistent serial number to test") == "2.0"))) {
jungfrauhw2 = true; jungfrauhw2 = true;
} }
if (det_type == defs::EIGER || jungfrauhw2) { if (det_type == defs::EIGER || jungfrauhw2) {
auto previous = det.getFlipRows(); auto previous = det.getFlipRows();
auto previous_numudp = det.getNumberofUDPInterfaces().tsquash("inconsistent number of udp interfaces to test"); auto previous_numudp = det.getNumberofUDPInterfaces().tsquash(
"inconsistent number of udp interfaces to test");
if (det_type == defs::JUNGFRAU) { if (det_type == defs::JUNGFRAU) {
det.setNumberofUDPInterfaces(2); det.setNumberofUDPInterfaces(2);
} }
@ -1651,8 +1651,8 @@ TEST_CASE("readnrows", "[.cmd]") {
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU) { if (det_type == defs::EIGER || det_type == defs::JUNGFRAU) {
bool jungfrauhw2 = false; bool jungfrauhw2 = false;
if (det_type == defs::JUNGFRAU && if (det_type == defs::JUNGFRAU &&
((det.getHardwareVersion().tsquash("inconsistent hardware version number to test") ((det.getHardwareVersion().tsquash(
== "2.0"))) { "inconsistent hardware version number to test") == "2.0"))) {
jungfrauhw2 = true; jungfrauhw2 = true;
} }
if (det_type == defs::JUNGFRAU && !jungfrauhw2) { if (det_type == defs::JUNGFRAU && !jungfrauhw2) {
@ -2303,12 +2303,14 @@ TEST_CASE("scan", "[.cmd]") {
// auto notImplementedPrevious = det.getDAC(notImplementedInd, false); // auto notImplementedPrevious = det.getDAC(notImplementedInd, false);
if (det_type == defs::MYTHEN3 && det.size() > 1) { if (det_type == defs::MYTHEN3 && det.size() > 1) {
;// scan only allowed for single module due to sync ; // scan only allowed for single module due to sync
} else { } else {
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("scan", {ToString(ind), "500", "1500", "500"}, -1, PUT, oss); proxy.Call("scan", {ToString(ind), "500", "1500", "500"}, -1, PUT,
CHECK(oss.str() == "scan [" + ToString(ind) + ", 500, 1500, 500]\n"); oss);
CHECK(oss.str() ==
"scan [" + ToString(ind) + ", 500, 1500, 500]\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
@ -2319,8 +2321,8 @@ TEST_CASE("scan", "[.cmd]") {
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("scan", {ToString(ind), "500", "1500", "500", "2s"}, -1, PUT, proxy.Call("scan", {ToString(ind), "500", "1500", "500", "2s"}, -1,
oss); PUT, oss);
CHECK(oss.str() == CHECK(oss.str() ==
"scan [" + ToString(ind) + ", 500, 1500, 500, 2s]\n"); "scan [" + ToString(ind) + ", 500, 1500, 500, 2s]\n");
} }
@ -2345,12 +2347,14 @@ TEST_CASE("scan", "[.cmd]") {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("scan", {ToString(ind), "1500", "500", "-500"}, -1, PUT, proxy.Call("scan", {ToString(ind), "1500", "500", "-500"}, -1, PUT,
oss); oss);
CHECK(oss.str() == "scan [" + ToString(ind) + ", 1500, 500, -500]\n"); CHECK(oss.str() ==
"scan [" + ToString(ind) + ", 1500, 500, -500]\n");
} }
CHECK_THROWS(proxy.Call( CHECK_THROWS(proxy.Call(
"scan", {ToString(notImplementedInd), "500", "1500", "500"}, -1, PUT)); "scan", {ToString(notImplementedInd), "500", "1500", "500"}, -1,
CHECK_THROWS( PUT));
proxy.Call("scan", {ToString(ind), "500", "1500", "-500"}, -1, PUT)); CHECK_THROWS(proxy.Call("scan", {ToString(ind), "500", "1500", "-500"},
-1, PUT));
CHECK_THROWS( CHECK_THROWS(
proxy.Call("scan", {ToString(ind), "1500", "500", "500"}, -1, PUT)); proxy.Call("scan", {ToString(ind), "1500", "500", "500"}, -1, PUT));
@ -2750,7 +2754,8 @@ TEST_CASE("txdelay", "[.cmd]") {
det_type == defs::MYTHEN3) { det_type == defs::MYTHEN3) {
// cannot get transmission delay with just one module // cannot get transmission delay with just one module
if ((det_type == defs::JUNGFRAU || det_type == defs::MYTHEN3) && (det.size() < 2)) { if ((det_type == defs::JUNGFRAU || det_type == defs::MYTHEN3) &&
(det.size() < 2)) {
REQUIRE_THROWS(proxy.Call("txdelay", {}, -1, GET)); REQUIRE_THROWS(proxy.Call("txdelay", {}, -1, GET));
int val = 5; int val = 5;
std::string sval = std::to_string(val); std::string sval = std::to_string(val);
@ -2930,10 +2935,9 @@ 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) {
// reset will also reset udp info from config file (comment out for invdividual tests) // reset will also reset udp info from config file (comment out for
// std::ostringstream oss; // invdividual tests) std::ostringstream oss; proxy.Call("resetfpga",
// proxy.Call("resetfpga", {}, -1, PUT, oss); // {}, -1, PUT, oss); REQUIRE(oss.str() == "resetfpga successful\n");
// 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));