mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-19 18:40:01 +02:00
Fixed crash on gendoc (#430)
Fixed by checking for help action before using the detector added test that checks that for all helps this doesn't crash Disabled Timer tests by default since they take ~2s
This commit is contained in:
parent
e9dc3d8c38
commit
d8c6f9141d
@ -45,6 +45,7 @@ int main() {
|
||||
|
||||
for (const auto &cmd : commands) {
|
||||
std::ostringstream os;
|
||||
std::cout << cmd << '\n';
|
||||
proxy.Call(cmd, {}, -1, slsDetectorDefs::HELP_ACTION, os);
|
||||
|
||||
auto tmp = os.str().erase(0, cmd.size());
|
||||
|
@ -1056,7 +1056,18 @@ std::string CmdProxy::TemperatureValues(int action) {
|
||||
std::string CmdProxy::Dac(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (args.size() == 0) {
|
||||
os << GetHelpDac(std::to_string(0)) << '\n';
|
||||
} else {
|
||||
os << args[0] << ' ' << GetHelpDac(args[0]) << '\n';
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
auto type = det->getDetectorType().squash();
|
||||
|
||||
// dac indices only for ctb
|
||||
if (args.size() > 0 && action != defs::HELP_ACTION) {
|
||||
if (is_int(args[0]) && type != defs::CHIPTESTBOARD) {
|
||||
@ -1066,13 +1077,7 @@ std::string CmdProxy::Dac(int action) {
|
||||
}
|
||||
}
|
||||
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (args.size() == 0) {
|
||||
os << GetHelpDac(std::to_string(0)) << '\n';
|
||||
} else {
|
||||
os << args[0] << ' ' << GetHelpDac(args[0]) << '\n';
|
||||
}
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (action == defs::GET_ACTION) {
|
||||
if (args.empty())
|
||||
WrongNumberOfParameters(1); // This prints slightly wrong
|
||||
|
||||
|
@ -16,6 +16,17 @@ using sls::Detector;
|
||||
using test::GET;
|
||||
using test::PUT;
|
||||
|
||||
TEST_CASE("Calling help doesn't throw or cause segfault"){
|
||||
//Dont add [.cmd] tag this should run with normal tests
|
||||
CmdProxy proxy(nullptr);
|
||||
auto commands = proxy.GetProxyCommands();
|
||||
std::ostringstream os;
|
||||
for (const auto &cmd : commands)
|
||||
REQUIRE_NOTHROW(proxy.Call(cmd, {}, -1, slsDetectorDefs::HELP_ACTION, os));
|
||||
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("Unknown command", "[.cmd]") {
|
||||
|
||||
Detector det;
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
TEST_CASE("Time 1s restart then time 2s") {
|
||||
TEST_CASE("Time 1s restart then time 2s", "[.timer]") {
|
||||
auto sleep_duration = std::chrono::seconds(1);
|
||||
auto t = sls::Timer();
|
||||
std::this_thread::sleep_for(sleep_duration);
|
||||
@ -17,7 +17,7 @@ TEST_CASE("Time 1s restart then time 2s") {
|
||||
REQUIRE(t.elapsed_s() == Approx(2).epsilon(0.01));
|
||||
}
|
||||
|
||||
TEST_CASE("Return ms") {
|
||||
TEST_CASE("Return ms", "[.timer]") {
|
||||
auto sleep_duration = std::chrono::milliseconds(1300);
|
||||
auto t = sls::Timer();
|
||||
std::this_thread::sleep_for(sleep_duration);
|
||||
|
Loading…
x
Reference in New Issue
Block a user