formatting

This commit is contained in:
maliakal_d 2024-01-11 18:04:19 +01:00
parent b69e053bb4
commit ffe7728966
14 changed files with 314 additions and 652 deletions

View File

@ -742,7 +742,7 @@ u_int32_t runState(enum TLogLevel lev);
int calculateDataBytes();
int getTotalNumberOfChannels();
#endif
#if defined(CHIPTESTBOARDD) || defined (XILINX_CHIPTESTBOARDD)
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
void getNumberOfChannels(int *nchanx, int *nchany);
#endif
#ifndef XILINX_CHIPTESTBOARDD

View File

@ -10,7 +10,6 @@
#include <fcntl.h> // open
#include <sys/mman.h> // mmap
/* global variables */
#define CSP0 (0xB0010000)
#define MEM_SIZE 0x100000
@ -59,8 +58,8 @@ int mapCSP0(void) {
return FAIL;
}
LOG(logDEBUG1, ("/dev/mem opened\n"));
csp0base = (u_int32_t*)mmap(0, MEM_SIZE, PROT_READ | PROT_WRITE,
MAP_FILE | MAP_SHARED, fd, CSP0);
csp0base = (u_int32_t *)mmap(0, MEM_SIZE, PROT_READ | PROT_WRITE,
MAP_FILE | MAP_SHARED, fd, CSP0);
if (csp0base == MAP_FAILED) {
LOG(logERROR, ("Can't map memmory area\n"));
return FAIL;
@ -72,4 +71,3 @@ int mapCSP0(void) {
LOG(logINFO, ("Memory already mapped before\n"));
return OK;
}

View File

@ -134,7 +134,6 @@ int getKernelVersion(char *retvals) {
return OK;
}
int validateKernelVersion(char *expectedVersion) {
// extract kernel date string
char version[255] = {0};
@ -167,7 +166,7 @@ int validateKernelVersion(char *expectedVersion) {
#endif
#endif
currentVersion[sizeof(currentVersion) - 1] = '\0';
// convert kernel date string into time
time_t kernelDate;
if (getTimeFromString(currentVersion, &kernelDate) == FAIL) {

View File

@ -21,8 +21,8 @@ uint64_t virtual_pattern[MAX_PATTERN_LENGTH];
extern void bus_w(u_int32_t offset, u_int32_t data);
extern u_int32_t bus_r(u_int32_t offset);
//extern int64_t get64BitReg(int aLSB, int aMSB); TODO for all servers (only uint64_t)
//extern int64_t set64BitReg(int64_t value, int aLSB, int aMSB);
// extern int64_t get64BitReg(int aLSB, int aMSB); TODO for all servers (only
// uint64_t) extern int64_t set64BitReg(int64_t value, int aLSB, int aMSB);
extern uint64_t getU64BitReg(int aLSB, int aMSB);
extern void setU64BitReg(uint64_t value, int aLSB, int aMSB);
@ -314,23 +314,23 @@ uint64_t getPatternWaitTime(int level) {
switch (level) {
case 0:
return getU64BitReg(PATTERN_WAIT_TIMER_0_LSB_REG,
PATTERN_WAIT_TIMER_0_MSB_REG);
PATTERN_WAIT_TIMER_0_MSB_REG);
case 1:
return getU64BitReg(PATTERN_WAIT_TIMER_1_LSB_REG,
PATTERN_WAIT_TIMER_1_MSB_REG);
PATTERN_WAIT_TIMER_1_MSB_REG);
case 2:
return getU64BitReg(PATTERN_WAIT_TIMER_2_LSB_REG,
PATTERN_WAIT_TIMER_2_MSB_REG);
PATTERN_WAIT_TIMER_2_MSB_REG);
#ifndef MYTHEN3D
case 3:
return getU64BitReg(PATTERN_WAIT_TIMER_3_LSB_REG,
PATTERN_WAIT_TIMER_3_MSB_REG);
PATTERN_WAIT_TIMER_3_MSB_REG);
case 4:
return getU64BitReg(PATTERN_WAIT_TIMER_4_LSB_REG,
PATTERN_WAIT_TIMER_4_MSB_REG);
PATTERN_WAIT_TIMER_4_MSB_REG);
case 5:
return getU64BitReg(PATTERN_WAIT_TIMER_5_LSB_REG,
PATTERN_WAIT_TIMER_5_MSB_REG);
PATTERN_WAIT_TIMER_5_MSB_REG);
#endif
default:
return -1;
@ -372,28 +372,28 @@ void setPatternWaitTime(int level, uint64_t t) {
switch (level) {
case 0:
setU64BitReg(t, PATTERN_WAIT_TIMER_0_LSB_REG,
PATTERN_WAIT_TIMER_0_MSB_REG);
PATTERN_WAIT_TIMER_0_MSB_REG);
break;
case 1:
setU64BitReg(t, PATTERN_WAIT_TIMER_1_LSB_REG,
PATTERN_WAIT_TIMER_1_MSB_REG);
PATTERN_WAIT_TIMER_1_MSB_REG);
break;
case 2:
setU64BitReg(t, PATTERN_WAIT_TIMER_2_LSB_REG,
PATTERN_WAIT_TIMER_2_MSB_REG);
PATTERN_WAIT_TIMER_2_MSB_REG);
break;
#ifndef MYTHEN3D
case 3:
setU64BitReg(t, PATTERN_WAIT_TIMER_3_LSB_REG,
PATTERN_WAIT_TIMER_3_MSB_REG);
PATTERN_WAIT_TIMER_3_MSB_REG);
break;
case 4:
setU64BitReg(t, PATTERN_WAIT_TIMER_4_LSB_REG,
PATTERN_WAIT_TIMER_4_MSB_REG);
PATTERN_WAIT_TIMER_4_MSB_REG);
break;
case 5:
setU64BitReg(t, PATTERN_WAIT_TIMER_5_LSB_REG,
PATTERN_WAIT_TIMER_5_MSB_REG);
PATTERN_WAIT_TIMER_5_MSB_REG);
break;
#endif
default:
@ -777,7 +777,7 @@ int loadPattern(char *message, enum TLogLevel printLevel,
}
}
// iocontrol
#if !defined(MYTHEN3D) && !defined(XILINX_CHIPTESTBOARDD) //TODO
#if !defined(MYTHEN3D) && !defined(XILINX_CHIPTESTBOARDD) // TODO
if (ret == OK) {
ret = validate_writePatternIOControl(message, pat->ioctrl);
}
@ -837,7 +837,7 @@ int getPattern(char *message, patternParameters *pat) {
pat->word[i] = retval64;
}
// iocontrol
#if !defined(MYTHEN3D) && !defined(XILINX_CHIPTESTBOARDD) //TODO
#if !defined(MYTHEN3D) && !defined(XILINX_CHIPTESTBOARDD) // TODO
if (ret == OK) {
validate_readPatternIOControl();
}
@ -973,7 +973,7 @@ int loadPatternFile(char *patFname, char *errMessage) {
}
// patioctrl
#if !defined(MYTHEN3D) && !defined(XILINX_CHIPTESTBOARDD) //TODO
#if !defined(MYTHEN3D) && !defined(XILINX_CHIPTESTBOARDD) // TODO
if (!strncmp(line, "patioctrl", strlen("patioctrl"))) {
uint64_t arg = 0;

View File

@ -7,7 +7,8 @@
#include "sls/sls_detector_funcs.h"
#include "slsDetectorFunctionList.h"
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD) || defined(MYTHEN3D)
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD) || \
defined(MYTHEN3D)
#include "Pattern.h"
#include "loadPattern.h"
#endif
@ -2877,7 +2878,8 @@ int get_frames_left(int file_des) {
int64_t retval = -1;
#if !defined(JUNGFRAUD) && !defined(MOENCHD) && !defined(GOTTHARDD) && \
!defined(CHIPTESTBOARDD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D) && !defined(XILINX_CHIPTESTBOARDD)
!defined(CHIPTESTBOARDD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D) && \
!defined(XILINX_CHIPTESTBOARDD)
functionNotImplemented();
#else
// get only
@ -2893,7 +2895,8 @@ int get_triggers_left(int file_des) {
int64_t retval = -1;
#if !defined(JUNGFRAUD) && !defined(MOENCHD) && !defined(GOTTHARDD) && \
!defined(CHIPTESTBOARDD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D) && !defined(XILINX_CHIPTESTBOARDD)
!defined(CHIPTESTBOARDD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D) && \
!defined(XILINX_CHIPTESTBOARDD)
functionNotImplemented();
#else
// get only
@ -3063,7 +3066,8 @@ int set_dynamic_range(int file_des) {
case 32:
#endif
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(MOENCHD) || \
defined(CHIPTESTBOARDD) || defined(GOTTHARD2D) || defined(XILINX_CHIPTESTBOARDD)
defined(CHIPTESTBOARDD) || defined(GOTTHARD2D) || \
defined(XILINX_CHIPTESTBOARDD)
case 16:
#endif
if (dr >= 0) {
@ -3336,7 +3340,8 @@ int set_pattern_word(int file_des) {
if (receiveData(file_des, args, sizeof(args), INT64) < 0)
return printSocketReadError();
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && !defined(MYTHEN3D)
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(MYTHEN3D)
functionNotImplemented();
#else
int addr = (int)args[0];
@ -3364,7 +3369,8 @@ int set_pattern_loop_addresses(int file_des) {
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
return printSocketReadError();
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && !defined(MYTHEN3D)
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(MYTHEN3D)
functionNotImplemented();
#else
int loopLevel = args[0];
@ -3410,7 +3416,8 @@ int set_pattern_loop_cycles(int file_des) {
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
return printSocketReadError();
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && !defined(MYTHEN3D)
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(MYTHEN3D)
functionNotImplemented();
#else
int loopLevel = args[0];
@ -3439,7 +3446,8 @@ int set_pattern_wait_addr(int file_des) {
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
return printSocketReadError();
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && !defined(MYTHEN3D)
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(MYTHEN3D)
functionNotImplemented();
#else
int loopLevel = args[0];
@ -3468,7 +3476,8 @@ int set_pattern_wait_time(int file_des) {
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
return printSocketReadError();
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && !defined(MYTHEN3D)
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(MYTHEN3D)
functionNotImplemented();
#else
int loopLevel = (int)args[0];
@ -3498,7 +3507,8 @@ int set_pattern_mask(int file_des) {
return printSocketReadError();
LOG(logDEBUG1, ("Set Pattern Mask to %d\n", arg));
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && !defined(MYTHEN3D)
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(MYTHEN3D)
functionNotImplemented();
#else
// only set
@ -3526,7 +3536,8 @@ int get_pattern_mask(int file_des) {
LOG(logDEBUG1, ("Get Pattern Mask\n"));
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && !defined(MYTHEN3D)
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(MYTHEN3D)
functionNotImplemented();
#else
// only get
@ -3547,7 +3558,8 @@ int set_pattern_bit_mask(int file_des) {
return printSocketReadError();
LOG(logDEBUG1, ("Set Pattern Bit Mask to %d\n", arg));
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && !defined(MYTHEN3D)
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(MYTHEN3D)
functionNotImplemented();
#else
// only set
@ -3576,7 +3588,8 @@ int get_pattern_bit_mask(int file_des) {
LOG(logDEBUG1, ("Get Pattern Bit Mask\n"));
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && !defined(MYTHEN3D)
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(MYTHEN3D)
functionNotImplemented();
#else
// only get
@ -3599,7 +3612,8 @@ int write_adc_register(int file_des) {
uint32_t val = args[1];
LOG(logDEBUG1, ("Writing 0x%x to ADC Register 0x%x\n", val, addr));
#if defined(EIGERD) || defined(GOTTHARD2D) || defined(MYTHEN3D) || defined(XILINX_CHIPTESTBOARDD)
#if defined(EIGERD) || defined(GOTTHARD2D) || defined(MYTHEN3D) || \
defined(XILINX_CHIPTESTBOARDD)
functionNotImplemented();
#else
#ifndef VIRTUAL
@ -3994,7 +4008,7 @@ int reset_fpga(int file_des) {
LOG(logDEBUG1, ("Reset FPGA\n"));
#if defined(EIGERD) || defined(GOTTHARDD) || defined(GOTTHARD2D) || \
defined(MYTHEN3D) || defined (XILINX_CHIPTESTBOARDD)
defined(MYTHEN3D) || defined(XILINX_CHIPTESTBOARDD)
functionNotImplemented();
#else
// only set
@ -7794,7 +7808,8 @@ int set_pattern(int file_des) {
char args[MAX_STR_LENGTH];
memset(args, 0, MAX_STR_LENGTH);
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && !defined(MYTHEN3D)
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(MYTHEN3D)
functionNotImplemented();
#else
@ -7831,7 +7846,8 @@ int get_pattern_file(int file_des) {
LOG(logDEBUG1, ("Getting pattern file name\n"));
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && !defined(MYTHEN3D)
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(MYTHEN3D)
functionNotImplemented();
#else
// get only
@ -7845,7 +7861,8 @@ int get_pattern(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && !defined(MYTHEN3D)
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(MYTHEN3D)
functionNotImplemented();
return Server_SendResult(file_des, INT32, NULL, 0);
#else
@ -10497,7 +10514,7 @@ int get_hardware_version(int file_des) {
getHardwareVersion(retvals);
LOG(logDEBUG1, ("hardware version retval: %s\n", retvals));
return Server_SendResult(file_des, OTHER, retvals, sizeof(retvals));
}

File diff suppressed because it is too large Load Diff

View File

@ -9,11 +9,9 @@
#include "loadPattern.h"
#include <arpa/inet.h> // INET_ADDRSTRLEN
#include <string.h>
#include <unistd.h> // usleep
#include <arpa/inet.h> // INET_ADDRSTRLEN
// Global variable from slsDetectorServer_funcs
extern int debugflag;
@ -91,8 +89,7 @@ int checkType() {
#ifdef VIRTUAL
return OK;
#endif
u_int32_t type =
((bus_r(FPGAVERSIONREG) & DETTYPE_MSK) >> DETTYPE_OFST);
u_int32_t type = ((bus_r(FPGAVERSIONREG) & DETTYPE_MSK) >> DETTYPE_OFST);
if (type != XILINX_CHIPTESTBOARD) {
LOG(logERROR,
("This is not a Xilinx CTB firmware (read %d, expected %d)\n", type,
@ -102,7 +99,6 @@ int checkType() {
return OK;
}
int testFpga() {
#ifdef VIRTUAL
return OK;
@ -111,7 +107,7 @@ int testFpga() {
// fixed pattern
int ret = OK;
/* TODO: FIX PATTERN not defined in firmware
uint32_t val = bus_r(FIX_PATT_REG);
if (val == FIX_PATT_VAL) {
@ -230,9 +226,7 @@ uint64_t getFirmwareVersion() {
return ((bus_r(FPGAVERSIONREG) & COMPDATE_MSK) >> COMPDATE_OFST);
}
void getHardwareVersion(char *version) {
strcpy(version, "Not applicable");
}
void getHardwareVersion(char *version) { strcpy(version, "Not applicable"); }
u_int64_t getDetectorMAC() {
#ifdef VIRTUAL
@ -323,7 +317,6 @@ void setupDetector() {
LOG(logINFOBLUE, ("Setting Default parameters\n"));
initializePatternAddresses();
setNumFrames(DEFAULT_NUM_FRAMES);
setNumTriggers(DEFAULT_NUM_CYCLES);
setTiming(DEFAULT_TIMING_MODE);
@ -430,8 +423,8 @@ enum runStatus getRunStatus() {
LOG(logINFOBLUE, ("Status: IDLE\n"));
return IDLE;
#endif
//TODO: get status
LOG(logINFOBLUE, ("Status: IDLE\n"));
// TODO: get status
LOG(logINFOBLUE, ("Status: IDLE\n"));
return IDLE;
}

View File

@ -17,12 +17,11 @@
enum ADCINDEX { V_PWR_IO };
enum DACINDEX { D0 };
/** Default Parameters */
#define DEFAULT_NUM_FRAMES (1)
#define DEFAULT_NUM_CYCLES (1)
#define DYNAMIC_RANGE (16)
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
#define DEFAULT_NUM_FRAMES (1)
#define DEFAULT_NUM_CYCLES (1)
#define DYNAMIC_RANGE (16)
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
/* Defines in the Firmware */
#define WAIT_TIME_PATTERN_READ (10)
#define WAIT_TIME_PATTERN_READ (10)

View File

@ -353,10 +353,10 @@ class Detector {
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
/**
* [Gotthard][Jungfrau][Moench][Gotthard][CTB][Gotthard2][Xilinx CTB] Options:
* AUTO_TIMING, TRIGGER_EXPOSURE \n
* [Mythen3] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, TRIGGER_GATED \n
* [Eiger] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER
* [Gotthard][Jungfrau][Moench][Gotthard][CTB][Gotthard2][Xilinx CTB]
* Options: AUTO_TIMING, TRIGGER_EXPOSURE \n [Mythen3] Options: AUTO_TIMING,
* TRIGGER_EXPOSURE, GATED, TRIGGER_GATED \n [Eiger] Options: AUTO_TIMING,
* TRIGGER_EXPOSURE, GATED, BURST_TRIGGER
*/
void setTimingMode(defs::timingMode value, Positions pos = {});
@ -1846,17 +1846,17 @@ class Detector {
* Pattern *
* *
* ************************************************/
/** [CTB][Mythen3][Xilinx CTB] Gets the pattern file name including path of the last
* pattern uploaded. \n Returns an empty if nothing was uploaded or via a
* server default file*/
/** [CTB][Mythen3][Xilinx CTB] Gets the pattern file name including path of
* the last pattern uploaded. \n Returns an empty if nothing was uploaded or
* via a server default file*/
Result<std::string> getPatterFileName(Positions pos = {}) const;
/** [CTB][Mythen3][Xilinx CTB] Loads ASCII pattern file directly to server
* (instead of executing line by line)*/
void setPattern(const std::string &fname, Positions pos = {});
/** [CTB][Mythen3][Xilinx CTB] Loads pattern parameters structure directly to
* server */
/** [CTB][Mythen3][Xilinx CTB] Loads pattern parameters structure directly
* to server */
void setPattern(const Pattern &pat, Positions pos = {});
/** [CTB][Mythen3][Xilinx CTB] Saves pattern to file
@ -1915,8 +1915,8 @@ class Detector {
/** [CTB][Mythen3][Xilinx CTB] */
Result<uint64_t> getPatternMask(Positions pos = {});
/** [CTB][Mythen3][Xilinx CTB] Selects the bits that will have a pattern mask
* applied to the selected patmask for every pattern. */
/** [CTB][Mythen3][Xilinx CTB] Selects the bits that will have a pattern
* mask applied to the selected patmask for every pattern. */
void setPatternMask(uint64_t mask, Positions pos = {});
/** [CTB][Mythen3][Xilinx CTB] */

View File

@ -24,7 +24,8 @@ TEST_CASE("CALLER::dacname", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
defs::dacIndex ind = static_cast<defs::dacIndex>(2);
std::string str_dac_index = "2";
auto prev = det.getDacName(ind);
@ -58,7 +59,8 @@ TEST_CASE("CALLER::dacindex", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
defs::dacIndex ind = static_cast<defs::dacIndex>(2);
std::string str_dac_index = "2";
@ -83,7 +85,8 @@ TEST_CASE("CALLER::adclist", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev = det.getAdcNames();
REQUIRE_THROWS(caller.call("adclist", {"a", "s", "d"}, -1, PUT));
@ -115,7 +118,8 @@ TEST_CASE("CALLER::adcname", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
int ind = 2;
std::string str_adc_index = "2";
auto prev = det.getAdcName(ind);
@ -149,7 +153,8 @@ TEST_CASE("CALLER::adcindex", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
int ind = 2;
std::string str_adc_index = "2";
@ -174,7 +179,8 @@ TEST_CASE("CALLER::signallist", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev = det.getSignalNames();
REQUIRE_THROWS(caller.call("signallist", {"a", "s", "d"}, -1, PUT));
@ -206,7 +212,8 @@ TEST_CASE("CALLER::signalname", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
int ind = 2;
std::string str_signal_index = "2";
auto prev = det.getSignalName(ind);
@ -240,7 +247,8 @@ TEST_CASE("CALLER::signalindex", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
int ind = 2;
std::string str_signal_index = "2";
@ -266,7 +274,8 @@ TEST_CASE("CALLER::powerlist", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev = det.getPowerNames();
REQUIRE_THROWS(caller.call("powerlist", {"a", "s", "d"}, -1, PUT));
@ -298,7 +307,8 @@ TEST_CASE("CALLER::powername", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::V_POWER_A);
std::string str_power_index = "2";
auto prev = det.getPowerName(ind);
@ -332,7 +342,8 @@ TEST_CASE("CALLER::powerindex", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::V_POWER_A);
std::string str_power_index = "2";
@ -382,7 +393,8 @@ TEST_CASE("CALLER::slowadclist", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev = det.getSlowADCNames();
REQUIRE_THROWS(caller.call("slowadclist", {"a", "s", "d"}, -1, PUT));
@ -414,7 +426,8 @@ TEST_CASE("CALLER::slowadcname", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::SLOW_ADC0);
std::string str_slowadc_index = "2";
auto prev = det.getSlowADCName(ind);
@ -449,7 +462,8 @@ TEST_CASE("CALLER::slowadcindex", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::SLOW_ADC0);
std::string str_slowadc_index = "2";
@ -478,13 +492,15 @@ TEST_CASE("CALLER::dac", "[.cmdcall][.dacs]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
for (int i = 0; i < 18; ++i) {
SECTION("dac " + std::to_string(i)) {
if (det_type == defs::CHIPTESTBOARD) {
test_dac_caller(static_cast<defs::dacIndex>(i), "dac", 0);
} else {
REQUIRE_THROWS(caller.call("dac", {std::to_string(i)}, -1, GET));
REQUIRE_THROWS(
caller.call("dac", {std::to_string(i)}, -1, GET));
}
}
}

View File

@ -23,7 +23,8 @@ TEST_CASE("Caller::patfname", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
REQUIRE_THROWS(caller.call("patfname", {}, -1, PUT));
REQUIRE_NOTHROW(caller.call("patfname", {}, -1, GET));
} else {
@ -35,7 +36,8 @@ TEST_CASE("Caller::pattern", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
// no proper test for put
REQUIRE_THROWS(caller.call("pattern", {}, -1, GET));
} else {
@ -47,7 +49,8 @@ TEST_CASE("Caller::savepattern", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
REQUIRE_THROWS(
caller.call("savepattern", {"/tmp/pattern.txt"}, -1, GET));
if (det.size() == 1) {
@ -108,7 +111,8 @@ TEST_CASE("Caller::patword", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
int addr = 0x23;
std::string saddr = ToStringHex(addr, 4);
auto prev_val = det.getPatternWord(addr);
@ -149,7 +153,8 @@ TEST_CASE("Caller::patlimits", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
auto prev_val = det.getPatternLoopAddresses(-1);
{
std::ostringstream oss;
@ -175,7 +180,8 @@ TEST_CASE("Caller::patloop", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
// m3 only has 3 levels
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
@ -223,7 +229,8 @@ TEST_CASE("Caller::patnloop", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
// m3 only has 3 levels
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
@ -268,7 +275,8 @@ TEST_CASE("Caller::patwait", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
// m3 only has 3 levels
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
@ -313,7 +321,8 @@ TEST_CASE("Caller::patwaittime", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
// m3 only has 3 levels
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
@ -358,7 +367,8 @@ TEST_CASE("Caller::patmask", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
auto prev_val = det.getPatternMask();
{
std::ostringstream oss;
@ -383,7 +393,8 @@ TEST_CASE("Caller::patsetbit", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
auto prev_val = det.getPatternBitMask();
{
std::ostringstream oss;

View File

@ -177,7 +177,8 @@ TEST_CASE("Caller::rx_missingpackets", "[.cmdcall][.rx]") {
}
auto det_type = det.getDetectorType().squash();
if (det_type != defs::CHIPTESTBOARD && det_type != defs::MOENCH) {
// 0 missing packets (takes into account that acquisition is stopped)
// 0 missing packets (takes into account that acquisition is
// stopped)
det.startReceiver();
det.startDetector();
det.stopDetector();
@ -236,8 +237,8 @@ TEST_CASE("Caller::rx_hostname", "[.cmdcall][.rx]") {
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxHostname();
// Cannot set rx_hostname (will reset parameters in rxr and no shm variables
// to update)
// Cannot set rx_hostname (will reset parameters in rxr and no shm
// variables to update)
// {
// // disable receiver
// std::ostringstream oss;
@ -597,20 +598,21 @@ TEST_CASE("Caller::rx_roi", "[.cmdcall]") {
}
{
std::ostringstream oss;
caller.call("rx_roi", {"10", "22", "18", "19"}, -1, PUT, oss);
caller.call("rx_roi", {"10", "22", "18", "19"}, -1, PUT,
oss);
REQUIRE(oss.str() == "rx_roi [10, 22, 18, 19]\n");
}
{
std::ostringstream oss;
caller.call("rx_roi",
{"1", std::to_string(detsize.x - 5), "1",
std::to_string(detsize.y - 5)},
std::to_string(detsize.y - 5)},
-1, PUT, oss);
REQUIRE(oss.str() == std::string("rx_roi [1, ") +
std::to_string(detsize.x - 5) +
std::string(", 1, ") +
std::to_string(detsize.y - 5) +
std::string("]\n"));
std::to_string(detsize.x - 5) +
std::string(", 1, ") +
std::to_string(detsize.y - 5) +
std::string("]\n"));
}
REQUIRE_THROWS(
caller.call("rx_roi", {"-1", "-1", "-1", "-1"}, -1, PUT));
@ -966,7 +968,6 @@ TEST_CASE("Caller::rx_zmqstartfnum", "[.cmdcall][.rx]") {
}
} else {
REQUIRE_THROWS(caller.call("rx_zmqstartfnum", {}, -1, GET));
}
}
@ -992,18 +993,18 @@ TEST_CASE("Caller::rx_zmqport", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) {
std::ostringstream oss;
caller.call("rx_zmqport", {}, i, GET, oss);
REQUIRE(oss.str() == "rx_zmqport " +
std::to_string(port + i * socketsperdetector) +
'\n');
REQUIRE(oss.str() ==
"rx_zmqport " +
std::to_string(port + i * socketsperdetector) + '\n');
}
port = 30001;
caller.call("rx_zmqport", {std::to_string(port)}, -1, PUT);
for (int i = 0; i != det.size(); ++i) {
std::ostringstream oss;
caller.call("rx_zmqport", {}, i, GET, oss);
REQUIRE(oss.str() == "rx_zmqport " +
std::to_string(port + i * socketsperdetector) +
'\n');
REQUIRE(oss.str() ==
"rx_zmqport " +
std::to_string(port + i * socketsperdetector) + '\n');
}
test_valid_port_caller("rx_zmqport", {}, -1, PUT);
test_valid_port_caller("rx_zmqport", {}, 0, PUT);
@ -1053,8 +1054,8 @@ TEST_CASE("Caller::rx_zmqhwm", "[.cmdcall]") {
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val =
det.getRxZmqHwm().tsquash("Inconsistent values for rx_zmqhwm to test");
auto prev_val = det.getRxZmqHwm().tsquash(
"Inconsistent values for rx_zmqhwm to test");
{
std::ostringstream oss;
caller.call("rx_zmqhwm", {"50"}, -1, PUT, oss);
@ -1155,14 +1156,16 @@ TEST_CASE("Caller::rx_jsonaddheader", "[.cmdcall][.rx]") {
{
std::ostringstream oss;
caller.call("rx_jsonaddheader", {"key1", "value1", "key2", "value2"},
-1, PUT, oss);
REQUIRE(oss.str() == "rx_jsonaddheader {key1: value1, key2: value2}\n");
caller.call("rx_jsonaddheader",
{"key1", "value1", "key2", "value2"}, -1, PUT, oss);
REQUIRE(oss.str() ==
"rx_jsonaddheader {key1: value1, key2: value2}\n");
}
{
std::ostringstream oss;
caller.call("rx_jsonaddheader", {}, -1, GET, oss);
REQUIRE(oss.str() == "rx_jsonaddheader {key1: value1, key2: value2}\n");
REQUIRE(oss.str() ==
"rx_jsonaddheader {key1: value1, key2: value2}\n");
}
{
std::ostringstream oss;

View File

@ -179,7 +179,8 @@ TEST_CASE("CALLER::settingslist", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
REQUIRE_THROWS(caller.call("settingslist", {}, -1, GET));
} else {
REQUIRE_NOTHROW(caller.call("settingslist", {}, -1, GET));
@ -829,8 +830,8 @@ TEST_CASE("CALLER::exptime", "[.cmdcall][.time]") {
if (det_type != defs::MYTHEN3) {
prev_val = det.getExptime().tsquash("inconsistent exptime to test");
} else {
auto t =
det.getExptimeForAllGates().tsquash("inconsistent exptime to test");
auto t = det.getExptimeForAllGates().tsquash(
"inconsistent exptime to test");
if (t[0] != t[1] || t[1] != t[2]) {
throw RuntimeError("inconsistent exptime for all gates");
}
@ -1430,7 +1431,7 @@ TEST_CASE("CALLER::highvoltage", "[.cmdcall]") {
}
// range 0, 60 - 200
else if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH ||
det_type == defs::CHIPTESTBOARD) {
det_type == defs::CHIPTESTBOARD) {
REQUIRE_THROWS(caller.call("highvoltage", {"50"}, -1, PUT));
{
std::ostringstream oss1, oss2;
@ -2001,7 +2002,8 @@ TEST_CASE("CALLER::temp_fpga", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::CHIPTESTBOARD && det_type != defs::XILINX_CHIPTESTBOARD) {
if (det_type != defs::CHIPTESTBOARD &&
det_type != defs::XILINX_CHIPTESTBOARD) {
REQUIRE_NOTHROW(caller.call("temp_fpga", {}, -1, GET));
std::ostringstream oss;
REQUIRE_NOTHROW(caller.call("temp_fpga", {}, 0, GET, oss));
@ -2058,7 +2060,6 @@ TEST_CASE("CALLER::dacvalues", "[.cmdcall]") {
REQUIRE_THROWS(caller.call("dacvalues", {}, -1, PUT));
} else {
REQUIRE_THROWS(caller.call("dacvalues", {}, -1, GET));
}
}
@ -2066,7 +2067,8 @@ TEST_CASE("CALLER::defaultdac", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::CHIPTESTBOARD && det_type != defs::XILINX_CHIPTESTBOARD) {
if (det_type != defs::CHIPTESTBOARD &&
det_type != defs::XILINX_CHIPTESTBOARD) {
REQUIRE_THROWS(caller.call("defaultdac", {}, -1, GET));
REQUIRE_THROWS(caller.call("defaultdac", {"blabla"}, -1, PUT));
auto daclist = det.getDacList();
@ -2125,7 +2127,8 @@ TEST_CASE("CALLER::resetdacs", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::CHIPTESTBOARD && det_type != defs::XILINX_CHIPTESTBOARD) {
if (det_type != defs::CHIPTESTBOARD &&
det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getSettings();
REQUIRE_THROWS(caller.call("resetdacs", {}, -1, GET));
@ -2252,8 +2255,8 @@ TEST_CASE("CALLER::start", "[.cmdcall]") {
if (det_type != defs::MYTHEN3) {
prev_val = det.getExptime().tsquash("inconsistent exptime to test");
} else {
auto t =
det.getExptimeForAllGates().tsquash("inconsistent exptime to test");
auto t = det.getExptimeForAllGates().tsquash(
"inconsistent exptime to test");
if (t[0] != t[1] || t[1] != t[2]) {
throw RuntimeError("inconsistent exptime for all gates");
}
@ -2261,7 +2264,8 @@ TEST_CASE("CALLER::start", "[.cmdcall]") {
}
auto prev_frames =
det.getNumberOfFrames().tsquash("inconsistent #frames in test");
auto prev_period = det.getPeriod().tsquash("inconsistent period in test");
auto prev_period =
det.getPeriod().tsquash("inconsistent period in test");
det.setExptime(-1, std::chrono::microseconds(200));
det.setPeriod(std::chrono::milliseconds(1));
det.setNumberOfFrames(2000);
@ -2296,8 +2300,8 @@ TEST_CASE("CALLER::stop", "[.cmdcall]") {
if (det_type != defs::MYTHEN3) {
prev_val = det.getExptime().tsquash("inconsistent exptime to test");
} else {
auto t =
det.getExptimeForAllGates().tsquash("inconsistent exptime to test");
auto t = det.getExptimeForAllGates().tsquash(
"inconsistent exptime to test");
if (t[0] != t[1] || t[1] != t[2]) {
throw RuntimeError("inconsistent exptime for all gates");
}
@ -2305,7 +2309,8 @@ TEST_CASE("CALLER::stop", "[.cmdcall]") {
}
auto prev_frames =
det.getNumberOfFrames().tsquash("inconsistent #frames in test");
auto prev_period = det.getPeriod().tsquash("inconsistent period in test");
auto prev_period =
det.getPeriod().tsquash("inconsistent period in test");
det.setExptime(-1, std::chrono::microseconds(200));
det.setPeriod(std::chrono::milliseconds(1));
det.setNumberOfFrames(2000);
@ -2324,7 +2329,7 @@ TEST_CASE("CALLER::stop", "[.cmdcall]") {
std::ostringstream oss;
caller.call("status", {}, -1, GET, oss);
REQUIRE(((oss.str() == "status stopped\n") ||
(oss.str() == "status idle\n")));
(oss.str() == "status idle\n")));
}
det.setExptime(-1, prev_val);
det.setPeriod(prev_period);
@ -2343,8 +2348,8 @@ TEST_CASE("CALLER::status", "[.cmdcall]") {
if (det_type != defs::MYTHEN3) {
prev_val = det.getExptime().tsquash("inconsistent exptime to test");
} else {
auto t =
det.getExptimeForAllGates().tsquash("inconsistent exptime to test");
auto t = det.getExptimeForAllGates().tsquash(
"inconsistent exptime to test");
if (t[0] != t[1] || t[1] != t[2]) {
throw RuntimeError("inconsistent exptime for all gates");
}
@ -2352,7 +2357,8 @@ TEST_CASE("CALLER::status", "[.cmdcall]") {
}
auto prev_frames =
det.getNumberOfFrames().tsquash("inconsistent #frames in test");
auto prev_period = det.getPeriod().tsquash("inconsistent period in test");
auto prev_period =
det.getPeriod().tsquash("inconsistent period in test");
det.setExptime(-1, std::chrono::microseconds(200));
det.setPeriod(std::chrono::milliseconds(1));
det.setNumberOfFrames(2000);
@ -2367,7 +2373,7 @@ TEST_CASE("CALLER::status", "[.cmdcall]") {
std::ostringstream oss;
caller.call("status", {}, -1, GET, oss);
REQUIRE(((oss.str() == "status stopped\n") ||
(oss.str() == "status idle\n")));
(oss.str() == "status idle\n")));
}
det.setExptime(-1, prev_val);
det.setPeriod(prev_period);
@ -2492,31 +2498,31 @@ TEST_CASE("CALLER::scan", "[.cmdcall]") {
} else {
{
std::ostringstream oss;
caller.call("scan", {ToString(ind), "500", "1500", "500"}, -1, PUT,
oss);
CHECK(oss.str() ==
"scan [" + ToString(ind) + ", 500, 1500, 500]\n");
}
{
std::ostringstream oss;
caller.call("scan", {}, -1, GET, oss);
CHECK(oss.str() == "scan [enabled\ndac " + ToString(ind) +
"\nstart 500\nstop 1500\nstep "
"500\nsettleTime 1ms\n]\n");
}
{
std::ostringstream oss;
caller.call("scan", {ToString(ind), "500", "1500", "500", "2s"}, -1,
caller.call("scan", {ToString(ind), "500", "1500", "500"}, -1,
PUT, oss);
CHECK(oss.str() ==
"scan [" + ToString(ind) + ", 500, 1500, 500, 2s]\n");
"scan [" + ToString(ind) + ", 500, 1500, 500]\n");
}
{
std::ostringstream oss;
caller.call("scan", {}, -1, GET, oss);
CHECK(oss.str() == "scan [enabled\ndac " + ToString(ind) +
"\nstart 500\nstop 1500\nstep "
"500\nsettleTime 2s\n]\n");
"\nstart 500\nstop 1500\nstep "
"500\nsettleTime 1ms\n]\n");
}
{
std::ostringstream oss;
caller.call("scan", {ToString(ind), "500", "1500", "500", "2s"},
-1, PUT, oss);
CHECK(oss.str() ==
"scan [" + ToString(ind) + ", 500, 1500, 500, 2s]\n");
}
{
std::ostringstream oss;
caller.call("scan", {}, -1, GET, oss);
CHECK(oss.str() == "scan [enabled\ndac " + ToString(ind) +
"\nstart 500\nstop 1500\nstep "
"500\nsettleTime 2s\n]\n");
}
{
std::ostringstream oss;
@ -2530,18 +2536,18 @@ TEST_CASE("CALLER::scan", "[.cmdcall]") {
}
{
std::ostringstream oss;
caller.call("scan", {ToString(ind), "1500", "500", "-500"}, -1, PUT,
oss);
caller.call("scan", {ToString(ind), "1500", "500", "-500"}, -1,
PUT, oss);
CHECK(oss.str() ==
"scan [" + ToString(ind) + ", 1500, 500, -500]\n");
"scan [" + ToString(ind) + ", 1500, 500, -500]\n");
}
CHECK_THROWS(caller.call(
"scan", {ToString(notImplementedInd), "500", "1500", "500"}, -1,
PUT));
CHECK_THROWS(caller.call("scan", {ToString(ind), "500", "1500", "-500"},
-1, PUT));
CHECK_THROWS(caller.call("scan", {ToString(ind), "1500", "500", "500"},
-1, PUT));
CHECK_THROWS(caller.call(
"scan", {ToString(ind), "500", "1500", "-500"}, -1, PUT));
CHECK_THROWS(caller.call(
"scan", {ToString(ind), "1500", "500", "500"}, -1, PUT));
if (det_type == defs::MYTHEN3 || defs::EIGER) {
{
@ -2554,8 +2560,8 @@ TEST_CASE("CALLER::scan", "[.cmdcall]") {
std::ostringstream oss;
caller.call("scan", {}, -1, GET, oss);
CHECK(oss.str() ==
"scan [enabled\ndac trimbits\nstart 0\nstop 48\nstep "
"16\nsettleTime 2s\n]\n");
"scan [enabled\ndac trimbits\nstart 0\nstop 48\nstep "
"16\nsettleTime 2s\n]\n");
}
}
@ -2567,12 +2573,13 @@ TEST_CASE("CALLER::scan", "[.cmdcall]") {
// Reset all dacs to previous value
// for (int i = 0; i != det.size(); ++i) {
// det.setDAC(ind, previous[i], false, {i});
// det.setDAC(notImplementedInd, notImplementedPrevious[i], false,
// {i});
// det.setDAC(notImplementedInd, notImplementedPrevious[i],
// false, {i});
// }
}
} else {
REQUIRE_THROWS(caller.call("scan", {ToString(defs::DAC_0), "500", "1500", "500"}, -1, PUT));
REQUIRE_THROWS(caller.call(
"scan", {ToString(defs::DAC_0), "500", "1500", "500"}, -1, PUT));
}
}
@ -2684,7 +2691,6 @@ TEST_CASE("CALLER::udp_cleardst", "[.cmdcall]") {
/*REQUIRE_NOTHROW(caller.call("udp_cleardst", {}, -1, PUT));*/
} else {
REQUIRE_THROWS(caller.call("udp_cleardst", {}, -1, PUT));
}
}
@ -2734,7 +2740,8 @@ TEST_CASE("CALLER::udp_srcmac", "[.cmdcall]") {
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getSourceUDPMAC();
REQUIRE_THROWS(caller.call("udp_srcmac", {"00:00:00:00:00:00"}, -1, PUT));
REQUIRE_THROWS(
caller.call("udp_srcmac", {"00:00:00:00:00:00"}, -1, PUT));
{
std::ostringstream oss;
caller.call("udp_srcmac", {"00:50:c2:42:34:12"}, -1, PUT, oss);
@ -2903,7 +2910,6 @@ TEST_CASE("CALLER::udp_validate", "[.cmdcall]") {
REQUIRE_NOTHROW(caller.call("udp_validate", {}, -1, PUT));
} else {
REQUIRE_THROWS(caller.call("udp_validate", {}, -1, PUT));
}
}

View File

@ -4,11 +4,11 @@
#define RELEASE "developer"
#define APILIB "developer 0x230224"
#define APIRECEIVER "developer 0x230224"
#define APICTB "developer 0x240110"
#define APIGOTTHARD "developer 0x240110"
#define APICTB "developer 0x240110"
#define APIGOTTHARD "developer 0x240110"
#define APIGOTTHARD2 "developer 0x240110"
#define APIJUNGFRAU "developer 0x240110"
#define APIMYTHEN3 "developer 0x240110"
#define APIMOENCH "developer 0x240110"
#define APIEIGER "developer 0x240110"
#define APIJUNGFRAU "developer 0x240110"
#define APIMYTHEN3 "developer 0x240110"
#define APIMOENCH "developer 0x240110"
#define APIEIGER "developer 0x240110"
#define APIXILINXCTB "developer 0x240110"