This commit is contained in:
maliakal_d 2020-06-04 12:12:40 +02:00
parent 3bdc8e95ce
commit 9a8300ca08
7 changed files with 778 additions and 359 deletions

View File

@ -5633,7 +5633,8 @@ int set_readout_mode(int file_des) {
if (ret == OK) { if (ret == OK) {
if (setReadoutMode(arg) == FAIL) { if (setReadoutMode(arg) == FAIL) {
ret = FAIL; ret = FAIL;
sprintf(mess, "Could not set readout mode\n"); sprintf(mess, "Could not set readout mode. Check #samples or "
"memory allocation\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
int retval = getReadoutMode(); int retval = getReadoutMode();

View File

@ -1143,7 +1143,7 @@ class Detector {
void setExternalSamplingSource(int value, Positions pos = {}); void setExternalSamplingSource(int value, Positions pos = {});
/** [CTB] */ /** [CTB] */
Result<int> getExternalSampling(Positions pos = {}) const; Result<bool> getExternalSampling(Positions pos = {}) const;
/** [CTB] */ /** [CTB] */
void setExternalSampling(bool value, Positions pos = {}); void setExternalSampling(bool value, Positions pos = {});

View File

@ -1468,7 +1468,7 @@ void Detector::setExternalSamplingSource(int value, Positions pos) {
pimpl->Parallel(&Module::setExternalSamplingSource, pos, value); pimpl->Parallel(&Module::setExternalSamplingSource, pos, value);
} }
Result<int> Detector::getExternalSampling(Positions pos) const { Result<bool> Detector::getExternalSampling(Positions pos) const {
return pimpl->Parallel(&Module::getExternalSampling, pos); return pimpl->Parallel(&Module::getExternalSampling, pos);
} }

View File

@ -2201,11 +2201,14 @@ int Module::getExternalSamplingSource() {
return setExternalSamplingSource(-1); return setExternalSamplingSource(-1);
} }
int Module::setExternalSampling(int value) { void Module::setExternalSampling(bool value) {
return sendToDetector<int>(F_EXTERNAL_SAMPLING, value); sendToDetector<int>(F_EXTERNAL_SAMPLING, static_cast<int>(value));
} }
int Module::getExternalSampling() { return setExternalSampling(-1); } bool Module::getExternalSampling() {
int arg = -1;
return sendToDetector<int>(F_EXTERNAL_SAMPLING, arg);
}
void Module::setReceiverDbitList(const std::vector<int> &list) { void Module::setReceiverDbitList(const std::vector<int> &list) {
LOG(logDEBUG1) << "Setting Receiver Dbit List"; LOG(logDEBUG1) << "Setting Receiver Dbit List";

View File

@ -1079,20 +1079,9 @@ class Module : public virtual slsDetectorDefs {
*/ */
int getExternalSamplingSource(); int getExternalSamplingSource();
/** void setExternalSampling(bool value);
* Set external sampling enable (CTB only)
* @param value external sampling source (Option: 0-63)
* @param detPos -1 for all detectors in list or specific detector position
* @returns external sampling enable
*/
int setExternalSampling(int value);
/** bool getExternalSampling();
* Get external sampling source (CTB only)
* @param detPos -1 for all detectors in list or specific detector position
* @returns external sampling enable
*/
int getExternalSampling();
/** digital data bits enable (CTB only) */ /** digital data bits enable (CTB only) */
void setReceiverDbitList(const std::vector<int> &list); void setReceiverDbitList(const std::vector<int> &list);

View File

@ -100,3 +100,769 @@ TEST_CASE("Setting and reading back Chip test board dacs",
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET)); REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
} }
} }
/* CTB/ Moench Specific */
TEST_CASE("samples", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
auto prev_asamples = det.getNumberOfAnalogSamples();
sls::Result<int> prev_dsamples = 0;
if (det_type == defs::CHIPTESTBOARD) {
prev_dsamples = det.getNumberOfDigitalSamples();
}
{
std::ostringstream oss;
proxy.Call("samples", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "samples 1\n");
}
{
std::ostringstream oss;
proxy.Call("samples", {"450"}, -1, PUT, oss);
REQUIRE(oss.str() == "samples 450\n");
}
{
std::ostringstream oss;
proxy.Call("samples", {}, -1, GET, oss);
REQUIRE(oss.str() == "samples 450\n");
}
{
std::ostringstream oss;
proxy.Call("asamples", {}, -1, GET, oss);
REQUIRE(oss.str() == "asamples 450\n");
}
if (det_type == defs::CHIPTESTBOARD) {
std::ostringstream oss;
proxy.Call("dsamples", {}, -1, GET, oss);
REQUIRE(oss.str() == "dsamples 450\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setNumberOfAnalogSamples(prev_asamples[i], {i});
if (det_type == defs::CHIPTESTBOARD) {
det.setNumberOfDigitalSamples(prev_dsamples[i], {i});
}
}
} else {
REQUIRE_THROWS(proxy.Call("samples", {}, -1, GET));
}
}
TEST_CASE("asamples", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
auto prev_val = det.getNumberOfAnalogSamples();
{
std::ostringstream oss;
proxy.Call("asamples", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "asamples 1\n");
}
{
std::ostringstream oss;
proxy.Call("asamples", {"450"}, -1, PUT, oss);
REQUIRE(oss.str() == "asamples 450\n");
}
{
std::ostringstream oss;
proxy.Call("asamples", {}, -1, GET, oss);
REQUIRE(oss.str() == "asamples 450\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setNumberOfAnalogSamples(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("asamples", {}, -1, GET));
}
}
TEST_CASE("adcclk", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
auto prev_val = det.getADCClock();
{
std::ostringstream oss;
proxy.Call("adcclk", {"20"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcclk 20\n");
}
{
std::ostringstream oss;
proxy.Call("adcclk", {"10"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcclk 10\n");
}
{
std::ostringstream oss;
proxy.Call("adcclk", {}, -1, GET, oss);
REQUIRE(oss.str() == "adcclk 10\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setADCClock(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("adcclk", {}, -1, GET));
}
}
TEST_CASE("runclk", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
auto prev_val = det.getRUNClock();
{
std::ostringstream oss;
proxy.Call("runclk", {"20"}, -1, PUT, oss);
REQUIRE(oss.str() == "runclk 20\n");
}
{
std::ostringstream oss;
proxy.Call("runclk", {"10"}, -1, PUT, oss);
REQUIRE(oss.str() == "runclk 10\n");
}
{
std::ostringstream oss;
proxy.Call("runclk", {}, -1, GET, oss);
REQUIRE(oss.str() == "runclk 10\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setRUNClock(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("runclk", {}, -1, GET));
}
}
TEST_CASE("syncclk", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
REQUIRE_NOTHROW(proxy.Call("syncclk", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("syncclk", {}, -1, GET));
}
}
TEST_CASE("adcpipeline", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
auto prev_val = det.getADCPipeline();
{
std::ostringstream oss;
proxy.Call("adcpipeline", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcpipeline 1\n");
}
{
std::ostringstream oss;
proxy.Call("adcpipeline", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcpipeline 0\n");
}
{
std::ostringstream oss;
proxy.Call("adcpipeline", {"15"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcpipeline 15\n");
}
{
std::ostringstream oss;
proxy.Call("adcpipeline", {}, -1, GET, oss);
REQUIRE(oss.str() == "adcpipeline 15\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setADCPipeline(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("adcpipeline", {}, -1, GET));
}
}
TEST_CASE("v_limit", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
auto prev_val = det.getVoltage(defs::V_LIMIT);
{
std::ostringstream oss;
proxy.Call("v_limit", {"1500"}, -1, PUT, oss);
REQUIRE(oss.str() == "v_limit 1500\n");
}
{
std::ostringstream oss;
proxy.Call("v_limit", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "v_limit 0\n");
}
{
std::ostringstream oss;
proxy.Call("v_limit", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "v_limit 0\n");
}
{
std::ostringstream oss;
proxy.Call("v_limit", {}, -1, GET, oss);
REQUIRE(oss.str() == "v_limit 0\n");
}
for (int i = 0; i != det.size(); ++i) {
if (prev_val[i] == -100) {
prev_val[i] = 0;
}
det.setVoltage(defs::V_LIMIT, prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("v_limit", {}, -1, GET));
}
}
TEST_CASE("adcenable", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
auto prev_val = det.getADCEnableMask();
{
std::ostringstream oss;
proxy.Call("adcenable", {"0x8d0a21d4"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcenable 0x8d0a21d4\n");
}
{
std::ostringstream oss;
proxy.Call("adcenable", {"0xffffffff"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcenable 0xffffffff\n");
}
{
std::ostringstream oss;
proxy.Call("adcenable", {}, -1, GET, oss);
REQUIRE(oss.str() == "adcenable 0xffffffff\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setADCEnableMask(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("adcenable", {}, -1, GET));
}
}
TEST_CASE("adcenable10g", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
auto prev_val = det.getTenGigaADCEnableMask();
{
std::ostringstream oss;
proxy.Call("adcenable10g", {"0xff00f0f0"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcenable10g 0xff00f0f0\n");
}
{
std::ostringstream oss;
proxy.Call("adcenable10g", {"0xffffffff"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcenable10g 0xffffffff\n");
}
{
std::ostringstream oss;
proxy.Call("adcenable10g", {}, -1, GET, oss);
REQUIRE(oss.str() == "adcenable10g 0xffffffff\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setTenGigaADCEnableMask(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("adcenable10g", {}, -1, GET));
}
}
/* CTB Specific */
TEST_CASE("dsamples", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev_val = det.getNumberOfDigitalSamples();
{
std::ostringstream oss;
proxy.Call("dsamples", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "dsamples 1\n");
}
{
std::ostringstream oss;
proxy.Call("dsamples", {"450"}, -1, PUT, oss);
REQUIRE(oss.str() == "dsamples 450\n");
}
{
std::ostringstream oss;
proxy.Call("dsamples", {}, -1, GET, oss);
REQUIRE(oss.str() == "dsamples 450\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setNumberOfDigitalSamples(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("dsamples", {}, -1, GET));
}
}
TEST_CASE("romode", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev_romode = det.getReadoutMode();
auto prev_asamples = det.getNumberOfAnalogSamples();
auto prev_dsamples = det.getNumberOfDigitalSamples();
det.setNumberOfAnalogSamples(5000);
det.setNumberOfDigitalSamples(5000);
{
std::ostringstream oss;
proxy.Call("romode", {"digital"}, -1, PUT, oss);
REQUIRE(oss.str() == "romode digital\n");
}
{
std::ostringstream oss;
proxy.Call("romode", {"analog_digital"}, -1, PUT, oss);
REQUIRE(oss.str() == "romode analog_digital\n");
}
{
std::ostringstream oss;
proxy.Call("romode", {"analog"}, -1, PUT, oss);
REQUIRE(oss.str() == "romode analog\n");
}
{
std::ostringstream oss;
proxy.Call("romode", {}, -1, GET, oss);
REQUIRE(oss.str() == "romode analog\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setReadoutMode(prev_romode[i], {i});
det.setNumberOfAnalogSamples(prev_asamples[i], {i});
det.setNumberOfDigitalSamples(prev_dsamples[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("romode", {}, -1, GET));
}
}
TEST_CASE("dbitclk", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev_val = det.getRUNClock();
{
std::ostringstream oss;
proxy.Call("dbitclk", {"20"}, -1, PUT, oss);
REQUIRE(oss.str() == "dbitclk 20\n");
}
{
std::ostringstream oss;
proxy.Call("dbitclk", {"10"}, -1, PUT, oss);
REQUIRE(oss.str() == "dbitclk 10\n");
}
{
std::ostringstream oss;
proxy.Call("dbitclk", {}, -1, GET, oss);
REQUIRE(oss.str() == "dbitclk 10\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setRUNClock(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("dbitclk", {}, -1, GET));
}
}
TEST_CASE("dbitpipeline", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev_val = det.getDBITPipeline();
{
std::ostringstream oss;
proxy.Call("dbitpipeline", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "dbitpipeline 1\n");
}
{
std::ostringstream oss;
proxy.Call("dbitpipeline", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "dbitpipeline 0\n");
}
{
std::ostringstream oss;
proxy.Call("dbitpipeline", {"15"}, -1, PUT, oss);
REQUIRE(oss.str() == "dbitpipeline 15\n");
}
{
std::ostringstream oss;
proxy.Call("dbitpipeline", {}, -1, GET, oss);
REQUIRE(oss.str() == "dbitpipeline 15\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setDBITPipeline(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("dbitpipeline", {}, -1, GET));
}
}
TEST_CASE("v_a", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev_val = det.getVoltage(defs::V_POWER_A);
{
std::ostringstream oss1, oss2;
proxy.Call("v_a", {"700"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "v_a 700\n");
proxy.Call("v_a", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "v_a 700\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setVoltage(defs::V_POWER_A, prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("v_a", {}, -1, GET));
}
}
TEST_CASE("v_b", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev_val = det.getVoltage(defs::V_POWER_B);
{
std::ostringstream oss1, oss2;
proxy.Call("v_b", {"700"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "v_b 700\n");
proxy.Call("v_b", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "v_b 700\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setVoltage(defs::V_POWER_B, prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("v_b", {}, -1, GET));
}
}
TEST_CASE("v_c", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev_val = det.getVoltage(defs::V_POWER_C);
{
std::ostringstream oss1, oss2;
proxy.Call("v_c", {"700"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "v_c 700\n");
proxy.Call("v_c", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "v_c 700\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setVoltage(defs::V_POWER_C, prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("v_c", {}, -1, GET));
}
}
TEST_CASE("v_d", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev_val = det.getVoltage(defs::V_POWER_D);
{
std::ostringstream oss1, oss2;
proxy.Call("v_d", {"700"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "v_d 700\n");
proxy.Call("v_d", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "v_d 700\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setVoltage(defs::V_POWER_D, prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("v_d", {}, -1, GET));
}
}
TEST_CASE("v_io", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
// better not to play with setting it
REQUIRE_NOTHROW(proxy.Call("v_io", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("v_io", {}, -1, GET));
}
}
TEST_CASE("v_chip", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
// better not to play with setting it
REQUIRE_NOTHROW(proxy.Call("v_chip", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("v_chip", {}, -1, GET));
}
}
TEST_CASE("vm_a", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_NOTHROW(proxy.Call("vm_a", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("vm_a", {}, -1, GET));
}
}
TEST_CASE("vm_b", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_NOTHROW(proxy.Call("vm_b", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("vm_b", {}, -1, GET));
}
}
TEST_CASE("vm_c", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_NOTHROW(proxy.Call("vm_c", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("vm_c", {}, -1, GET));
}
}
TEST_CASE("vm_d", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_NOTHROW(proxy.Call("vm_d", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("vm_d", {}, -1, GET));
}
}
TEST_CASE("vm_io", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_NOTHROW(proxy.Call("vm_io", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("vm_io", {}, -1, GET));
}
}
TEST_CASE("im_a", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_NOTHROW(proxy.Call("im_a", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("im_a", {}, -1, GET));
}
}
TEST_CASE("im_b", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_NOTHROW(proxy.Call("im_b", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("im_b", {}, -1, GET));
}
}
TEST_CASE("im_c", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_NOTHROW(proxy.Call("im_c", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("im_c", {}, -1, GET));
}
}
TEST_CASE("im_d", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_NOTHROW(proxy.Call("im_d", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("im_d", {}, -1, GET));
}
}
TEST_CASE("im_io", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_NOTHROW(proxy.Call("im_io", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("im_io", {}, -1, GET));
}
}
TEST_CASE("adc", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
for (int i = 0; i <= 8; ++i) {
REQUIRE_NOTHROW(proxy.Call("adc", {std::to_string(i)}, -1, GET));
REQUIRE_THROWS(proxy.Call("adc", {"0"}, -1, PUT));
}
} else {
REQUIRE_THROWS(proxy.Call("adc", {"0"}, -1, GET));
}
}
TEST_CASE("extsampling", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev_val = det.getExternalSampling();
{
std::ostringstream oss;
proxy.Call("extsampling", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "extsampling 1\n");
}
{
std::ostringstream oss;
proxy.Call("extsampling", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "extsampling 0\n");
}
{
std::ostringstream oss;
proxy.Call("extsampling", {}, -1, GET, oss);
REQUIRE(oss.str() == "extsampling 0\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setExternalSampling(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("extsampling", {}, -1, GET));
}
}
TEST_CASE("extsamplingsrc", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev_val = det.getExternalSamplingSource();
{
std::ostringstream oss;
proxy.Call("extsamplingsrc", {"63"}, -1, PUT, oss);
REQUIRE(oss.str() == "extsamplingsrc 63\n");
}
{
std::ostringstream oss;
proxy.Call("extsamplingsrc", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "extsamplingsrc 0\n");
}
{
std::ostringstream oss;
proxy.Call("extsamplingsrc", {}, -1, GET, oss);
REQUIRE(oss.str() == "extsamplingsrc 0\n");
}
REQUIRE_THROWS(proxy.Call("extsamplingsrc", {"64"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setExternalSamplingSource(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("extsamplingsrc", {}, -1, GET));
}
}
TEST_CASE("diodelay", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
{
std::ostringstream oss;
proxy.Call("diodelay", {"0x01010", "0"}, -1, PUT, oss);
REQUIRE(oss.str() == "diodelay [0x01010, 0]\n");
}
{
std::ostringstream oss;
proxy.Call("diodelay", {"0x01010", "775"}, -1, PUT, oss);
REQUIRE(oss.str() == "diodelay [0x01010, 775]\n");
}
REQUIRE_THROWS(proxy.Call("diodelay", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("diodelay", {"0x01010", "776"}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("diodelay", {"0x01010", "775"}, -1, PUT));
}
}
TEST_CASE("led", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev_val = det.getLEDEnable();
{
std::ostringstream oss;
proxy.Call("led", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "led 1\n");
}
{
std::ostringstream oss;
proxy.Call("led", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "led 0\n");
}
{
std::ostringstream oss;
proxy.Call("led", {}, -1, GET, oss);
REQUIRE(oss.str() == "led 0\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setLEDEnable(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("led", {}, -1, GET));
}
}

View File

@ -2270,73 +2270,6 @@ TEST_CASE("resetfpga", "[.cmd]") {
// } // }
// } // }
// TEST_CASE("diodelay", "[.cmd][.ctb]") {
// if (test::type == defs::CHIPTESTBOARD) {
// REQUIRE_NOTHROW(multiSlsDetectorClient("diodelay 0x01010 125", PUT));
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("diodelay 0x01010 775",
// PUT, nullptr, oss)); REQUIRE(oss.str() == "diodelay [0x01010,
// 775]\n");
// }
// REQUIRE_NOTHROW(multiSlsDetectorClient("diodelay 0x01010 0", PUT));
// REQUIRE_THROWS(multiSlsDetectorClient("diodelay [0x01010, 776]",
// PUT));
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("diodelay", GET));
// }
// }
// TEST_CASE("extsampling", "[.cmd][.ctb]") {
// if (test::type == defs::CHIPTESTBOARD) {
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("extsampling 1", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "extsampling 1\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("extsampling", GET,
// nullptr, oss)); REQUIRE(oss.str() == "extsampling 1\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("extsampling 0", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "extsampling 0\n");
// }
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("extsampling", GET));
// }
// }
// TEST_CASE("extsamplingsrc", "[.cmd][.ctb]") {
// if (test::type == defs::CHIPTESTBOARD) {
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("extsamplingsrc 1", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "extsamplingsrc 1\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("extsamplingsrc 0", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "extsamplingsrc 0\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("extsamplingsrc 15", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "extsamplingsrc 15\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("extsamplingsrc", GET,
// nullptr, oss)); REQUIRE(oss.str() == "extsamplingsrc 15\n");
// }
// REQUIRE_THROWS(multiSlsDetectorClient("extsamplingsrc 64", PUT));
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("extsamplingsrc", GET));
// }
// }
// TEST_CASE("adcinvert", "[.cmd][.ctb]") { // TEST_CASE("adcinvert", "[.cmd][.ctb]") {
// if (test::type == defs::CHIPTESTBOARD || test::type == // if (test::type == defs::CHIPTESTBOARD || test::type ==
// defs::JUNGFRAU) { // defs::JUNGFRAU) {
@ -2362,30 +2295,6 @@ TEST_CASE("resetfpga", "[.cmd]") {
// } // }
// } // }
// TEST_CASE("adcenable", "[.cmd][.ctb]") {
// if (test::type == defs::CHIPTESTBOARD) {
// std::string s;
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("adcenable", GET, nullptr,
// oss)); s = oss.str();
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("adcenable 0x8d0a21d4",
// PUT, nullptr, oss)); REQUIRE(oss.str() == "adcenable
// 0x8d0a21d4\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient(s, PUT, nullptr, oss));
// REQUIRE(oss.str() == s);
// }
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("adcenable", GET));
// }
// }
// TEST_CASE("adcvpp", "[.cmd][.ctb]") { // TEST_CASE("adcvpp", "[.cmd][.ctb]") {
// if (test::type == defs::CHIPTESTBOARD) { // if (test::type == defs::CHIPTESTBOARD) {
// int prev_val = 0; // int prev_val = 0;
@ -2414,149 +2323,6 @@ TEST_CASE("resetfpga", "[.cmd]") {
// } // }
// } // }
// TEST_CASE("dbitpipeline", "[.cmd][.ctb]") {
// if (test::type == defs::CHIPTESTBOARD) {
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("dbitpipeline 1", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "dbitpipeline 1\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("dbitpipeline 0", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "dbitpipeline 0\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("dbitpipeline 15", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "dbitpipeline 15\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("dbitpipeline", GET,
// nullptr, oss)); REQUIRE(oss.str() == "dbitpipeline 15\n");
// }
// REQUIRE_NOTHROW(multiSlsDetectorClient("dbitpipeline 0", PUT));
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("dbitpipeline", GET));
// }
// }
// TEST_CASE("adcpipeline", "[.cmd][.ctb]") {
// if (test::type == defs::CHIPTESTBOARD) {
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("adcpipeline 1", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "adcpipeline 1\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("adcpipeline 0", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "adcpipeline 0\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("adcpipeline 15", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "adcpipeline 15\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("adcpipeline", GET,
// nullptr, oss)); REQUIRE(oss.str() == "adcpipeline 15\n");
// }
// REQUIRE_NOTHROW(multiSlsDetectorClient("adcpipeline 0", PUT));
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("adcpipeline", GET));
// }
// }
// TEST_CASE("romode", "[.cmd][.ctb]") {
// if (test::type == defs::CHIPTESTBOARD) {
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("romode digital", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "romode digital\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("romode analog_digital",
// PUT, nullptr, oss)); REQUIRE(oss.str() == "romode
// analog_digital\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("romode analog", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "romode analog\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("romode", GET, nullptr,
// oss)); REQUIRE(oss.str() == "romode analog\n");
// }
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("romode", GET));
// }
// }
// TEST_CASE("samples", "[.cmd][.ctb]") {
// if (test::type == defs::CHIPTESTBOARD) {
// uint64_t prev_value1 = 0;
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("asamples", GET, nullptr,
// oss)); std::string s = (oss.str()).erase (0, strlen("asamples
// ")); prev_value1 = std::stoi(s);
// }
// std::cout<<"asamples:"<<prev_value1<<std::endl;
// uint64_t prev_value2 = 0;
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("dsamples", GET, nullptr,
// oss)); std::string s = (oss.str()).erase (0, strlen("dsamples
// ")); prev_value2 = std::stoi(s);
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("samples 1200", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "samples 1200\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("samples 1000", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "samples 1000\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("asamples 2200", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "asamples 2200\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("asamples 4000", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "asamples 4000\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("dsamples 1200", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "dsamples 1200\n");
// }
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("dsamples 1000", PUT,
// nullptr, oss)); REQUIRE(oss.str() == "dsamples 1000\n");
// }
// REQUIRE_THROWS(multiSlsDetectorClient("samples", GET)); //
// different values REQUIRE_NOTHROW(multiSlsDetectorClient("asamples " +
// std::to_string(prev_value1), PUT));
// REQUIRE_NOTHROW(multiSlsDetectorClient("dsamples " +
// std::to_string(prev_value2), PUT));
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("samples", GET));
// REQUIRE_THROWS(multiSlsDetectorClient("asamples", GET));
// REQUIRE_THROWS(multiSlsDetectorClient("dsamples", GET));
// }
// }
// TEST_CASE("imagetest", "[.cmd][.gotthard]") { // TEST_CASE("imagetest", "[.cmd][.gotthard]") {
// if (test::type == defs::GOTTHARD) { // if (test::type == defs::GOTTHARD) {
// { // {
@ -2578,109 +2344,3 @@ TEST_CASE("resetfpga", "[.cmd]") {
// REQUIRE_THROWS(multiSlsDetectorClient("imagetest", GET)); // REQUIRE_THROWS(multiSlsDetectorClient("imagetest", GET));
// } // }
// } // }
// TEST_CASE("adc", "[.cmd][.ctb]") {
// if (test::type != defs::CHIPTESTBOARD) {
// REQUIRE_THROWS(multiSlsDetectorClient("adc 8", GET));
// } else {
// REQUIRE_THROWS(multiSlsDetectorClient("adc", GET));
// REQUIRE_THROWS(multiSlsDetectorClient("adc 5", PUT));
// for(int i = 0; i <= 8; ++i) {
// REQUIRE_NOTHROW(multiSlsDetectorClient("adc " +
// std::to_string(i), GET));
// }
// }
// }
// TEST_CASE("syncclk", "[.cmd][.ctb]") {
// if(test::type != defs::CHIPTESTBOARD) {
// REQUIRE_THROWS(multiSlsDetectorClient("syncclk", GET));
// } else {
// REQUIRE_NOTHROW(multiSlsDetectorClient("syncclk", GET));
// REQUIRE_THROWS(multiSlsDetectorClient("syncclk 40", PUT));
// }
// }
// TEST_CASE("adcclk", "[.cmd][.ctb]") {
// if(test::type != defs::CHIPTESTBOARD) {
// REQUIRE_THROWS(multiSlsDetectorClient("adcclk", GET));
// } else {
// int prev_clk = 0;
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("adcclk", GET, nullptr,
// oss)); std::string s = (oss.str()).erase (0, strlen("adcclk "));
// prev_clk = std::stoi(s);
// }
// {
// REQUIRE_NOTHROW(multiSlsDetectorClient("adcclk 20", PUT));
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("adcclk", GET, nullptr,
// oss)); REQUIRE(oss.str() == "adcclk 20\n");
// }
// {
// REQUIRE_NOTHROW(multiSlsDetectorClient("adcclk 10", PUT));
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("adcclk", GET, nullptr,
// oss)); REQUIRE(oss.str() == "adcclk 10\n");
// }
// REQUIRE_NOTHROW(multiSlsDetectorClient("adcclk " +
// std::to_string(prev_clk), PUT));
// }
// }
// TEST_CASE("dbitclk", "[.cmd][.ctb]") {
// if(test::type != defs::CHIPTESTBOARD) {
// REQUIRE_THROWS(multiSlsDetectorClient("dbitclk", GET));
// } else {
// int prev_clk = 0;
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("dbitclk", GET, nullptr,
// oss)); std::string s = (oss.str()).erase (0, strlen("dbitclk "));
// prev_clk = std::stoi(s);
// }
// {
// REQUIRE_NOTHROW(multiSlsDetectorClient("dbitclk 20", PUT));
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("dbitclk", GET, nullptr,
// oss)); REQUIRE(oss.str() == "dbitclk 20\n");
// }
// {
// REQUIRE_NOTHROW(multiSlsDetectorClient("dbitclk 10", PUT));
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("dbitclk", GET, nullptr,
// oss)); REQUIRE(oss.str() == "dbitclk 10\n");
// }
// REQUIRE_NOTHROW(multiSlsDetectorClient("dbitclk " +
// std::to_string(prev_clk), PUT));
// }
// }
// TEST_CASE("runclk", "[.cmd][.ctb]") {
// if(test::type != defs::CHIPTESTBOARD) {
// REQUIRE_THROWS(multiSlsDetectorClient("runclk", GET));
// } else {
// int prev_runclk = 0;
// {
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("runclk", GET, nullptr,
// oss)); std::string s = (oss.str()).erase (0, strlen("runclk "));
// prev_runclk = std::stoi(s);
// }
// {
// REQUIRE_NOTHROW(multiSlsDetectorClient("runclk 20", PUT));
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("runclk", GET, nullptr,
// oss)); REQUIRE(oss.str() == "runclk 20\n");
// }
// {
// REQUIRE_NOTHROW(multiSlsDetectorClient("runclk 10", PUT));
// std::ostringstream oss;
// REQUIRE_NOTHROW(multiSlsDetectorClient("runclk", GET, nullptr,
// oss)); REQUIRE(oss.str() == "runclk 10\n");
// }
// REQUIRE_NOTHROW(multiSlsDetectorClient("runclk " +
// std::to_string(prev_runclk), PUT));
// }
// }