mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-07-16 11:29:34 +02:00
Build and Deploy on local RHEL9 / build (push) Successful in 2m13s
Build on RHEL9 docker image / build (push) Successful in 3m53s
Build and Deploy on local RHEL8 / build (push) Successful in 4m58s
Build on RHEL8 docker image / build (push) Successful in 5m47s
Run Simulator Tests on local RHEL9 / build (push) Successful in 18m55s
Run Simulator Tests on local RHEL8 / build (push) Successful in 22m26s
- changed
- command from `datastream` to `udp_datastream` to be more specific
- Detector API:
- setNumberofUDPInterfaces(pos) =>setNumberofUDPInterfaces() # no position anymore
- getDataStream(portPosition, pos) =>getUDPDataStream(portPosition, pos)
- setDataStream(portPosition, pos) => setUDPDataStream(portPosition) # no position anymore
- modified the dataprocessing thread:
- if gui or call back, start zmq processing (connecting sockets) before starting receiver (disabled ports sends dummy that the client zmq sockets are not ready for)
- if only progress, starting progress processing thread after startReceiver
-
- added
- Detector API:
- getRxDisabledUDPPortIndices()
- getPortPositionList()
- allow disabling/enabling udp interface in receiver for Jungfrua/Moench when both udp interfaces is enabled (This is to go fast, where only one half of the module matters)
- write ports type and disabled ports to master file (tests for it as well)
- tests for python commands as well
- datastream command to deprecated commands
- refactored tests to make the new parameters fit
* first draft of disabling data port at the receiver side. Todo: master file and stream for gui to use
* updated help in command
* formatting
* md5 unchanged
* fix test, check port position for detector type
* wip, udp port enable metadata in client, to:receiver, zmq streaming
* wip, master attributes
* wip, imple=> save only disabled ports with port index, 1 interface, is empty
* works in file. still needs refactoring
* updated writer versions
* udp ports type pass, disabled with api yet
* fixed disabled ports meta data as well
* fixed in developer via other PR
* renamed.more intuitive
* fix in gui that wont wait for disabled ports
* added tests for master file
* extra tests
* move the master fiel tests into its own tests with the disable marker for github tests
* refactoring
* python test
* more intuitive and doc
* release notes
* example for python
* back to before
* minor documentation fix and sending nports unnecessarily for getRxUDPPortDisableMetadata
* doc
* review fixes, 1. using std::array instead of vector, 2. moving udp_datastream command testing with different values into master attributes testing file because we test the master file
* minor
* review: update help
* progress printed before assigned
* try catch inside hdf5
* auto generated code for CLI and formatting
* missing packets should not be checked at github workflow level
* formatting
* improved python doc for udp_datastream help
* indent doc python done
103 lines
3.4 KiB
C++
103 lines
3.4 KiB
C++
// SPDX-License-Identifier: LGPL-3.0-or-other
|
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
#include "test-Caller-global.h"
|
|
#include "Caller.h"
|
|
#include "GeneralData.h"
|
|
#include "sls/Detector.h"
|
|
#include "sls/logger.h"
|
|
#include "tests/globals.h"
|
|
|
|
#include "catch.hpp"
|
|
|
|
namespace sls {
|
|
|
|
namespace acq = sls::test::acquire;
|
|
|
|
using test::GET;
|
|
using test::PUT;
|
|
void test_valid_port_caller(const std::string &command,
|
|
const std::vector<std::string> &arguments,
|
|
int detector_id, int action) {
|
|
Detector det;
|
|
Caller caller(&det);
|
|
|
|
std::vector<std::string> arg(arguments);
|
|
if (arg.empty())
|
|
arg.push_back("0");
|
|
|
|
int test_values[3] = {77797, -1, 0};
|
|
for (int i = 0; i != 3; ++i) {
|
|
int port_number = test_values[i];
|
|
arg[arg.size() - 1] = std::to_string(port_number);
|
|
REQUIRE_THROWS(caller.call(command, arg, detector_id, action));
|
|
/*REQUIRE_THROWS_WITH(proxy.Call(command, arguments, detector_id,
|
|
action), "Invalid port range. Must be between 1 - 65535.");*/
|
|
}
|
|
}
|
|
|
|
void test_dac_caller(defs::dacIndex index, const std::string &dacname,
|
|
int dacvalue, bool mV) {
|
|
Detector det;
|
|
Caller caller(&det);
|
|
std::string dac = dacname;
|
|
auto value = std::to_string(dacvalue);
|
|
auto previous = det.getDAC(index, false);
|
|
// chip test board
|
|
if (dacname == "dac") {
|
|
dac = std::to_string(static_cast<int>(index));
|
|
}
|
|
{
|
|
std::ostringstream oss;
|
|
std::vector<std::string> args = {dac, value};
|
|
if (mV)
|
|
args.push_back("mV");
|
|
std::cout << "args:" << ToString(args) << std::endl;
|
|
caller.call("dac", args, -1, PUT, oss);
|
|
REQUIRE(oss.str() == std::string("dac ") + dac + " " + value +
|
|
(mV ? " mV\n" : "\n"));
|
|
}
|
|
{
|
|
std::ostringstream oss;
|
|
std::vector<std::string> args = {dac};
|
|
if (mV)
|
|
args.push_back("mV");
|
|
caller.call("dac", args, -1, GET, oss);
|
|
REQUIRE(oss.str() ==
|
|
"dac " + dac + " " + value + (mV ? " mV\n" : "\n"));
|
|
}
|
|
// Reset all dacs to previous value
|
|
for (int i = 0; i != det.size(); ++i) {
|
|
det.setDAC(index, previous[i], false, {i});
|
|
}
|
|
}
|
|
|
|
void test_onchip_dac_caller(defs::dacIndex index, const std::string &dacname,
|
|
int dacvalue) {
|
|
Detector det;
|
|
Caller caller(&det);
|
|
REQUIRE_THROWS(caller.call(dacname, {}, -1, GET));
|
|
REQUIRE_THROWS(
|
|
caller.call(dacname, {"10", "0x0"}, -1, PUT)); // chip index (-1 to 9)
|
|
REQUIRE_THROWS(
|
|
caller.call(dacname, {"-1", "0x400"}, -1, PUT)); // max val is 0x3ff
|
|
|
|
int chipIndex = -1; // for now, it is -1 only
|
|
auto prev_val = det.getOnChipDAC(index, chipIndex);
|
|
auto dacValueStr = ToStringHex(dacvalue);
|
|
auto chipIndexStr = std::to_string(chipIndex);
|
|
std::ostringstream oss_set, oss_get;
|
|
caller.call(dacname, {chipIndexStr, dacValueStr}, -1, PUT, oss_set);
|
|
REQUIRE(oss_set.str() ==
|
|
dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
|
caller.call(dacname, {chipIndexStr}, -1, GET, oss_get);
|
|
REQUIRE(oss_get.str() ==
|
|
dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
|
|
|
// Reset all dacs to previous value
|
|
for (int i = 0; i != det.size(); ++i) {
|
|
det.setOnChipDAC(index, chipIndex, prev_val[i], {i});
|
|
}
|
|
}
|
|
|
|
} // namespace sls
|