mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-12-29 07:31:18 +01:00
@@ -67,8 +67,13 @@ std::string getUserDetails(const int detectorIndex) {
|
|||||||
std::string user = "Unknown";
|
std::string user = "Unknown";
|
||||||
std::string date = "Unknown";
|
std::string date = "Unknown";
|
||||||
|
|
||||||
SharedMemory<sharedDetector> detectorShm(detectorIndex, -1);
|
{
|
||||||
if (detectorShm.exists()) {
|
SharedMemory<sharedDetector> detectorShm(detectorIndex, -1);
|
||||||
|
if (!detectorShm.exists()) {
|
||||||
|
throw SharedMemoryError("No detector with index " +
|
||||||
|
std::to_string(detectorIndex) +
|
||||||
|
" in shared memory!");
|
||||||
|
}
|
||||||
detectorShm.openSharedMemory(false);
|
detectorShm.openSharedMemory(false);
|
||||||
if (detectorShm()->shmversion < DETECTOR_SHMAPIVERSION) {
|
if (detectorShm()->shmversion < DETECTOR_SHMAPIVERSION) {
|
||||||
detectorShm.unmapSharedMemory();
|
detectorShm.unmapSharedMemory();
|
||||||
@@ -86,13 +91,16 @@ std::string getUserDetails(const int detectorIndex) {
|
|||||||
|
|
||||||
for (int imod = 0; imod != numModules; ++imod) {
|
for (int imod = 0; imod != numModules; ++imod) {
|
||||||
SharedMemory<sharedModule> moduleShm(detectorIndex, imod);
|
SharedMemory<sharedModule> moduleShm(detectorIndex, imod);
|
||||||
moduleShm.openSharedMemory(false);
|
if (moduleShm.exists()) {
|
||||||
if (moduleShm()->shmversion < MODULE_SHMAPIVERSION) {
|
moduleShm.openSharedMemory(false);
|
||||||
LOG(logWARNING) << "Module Shared Memory too old to get hostname";
|
if (moduleShm()->shmversion < MODULE_SHMAPIVERSION) {
|
||||||
} else {
|
LOG(logWARNING)
|
||||||
hostname = moduleShm()->hostname;
|
<< "Module Shared Memory too old to get hostname";
|
||||||
|
} else {
|
||||||
|
hostname = moduleShm()->hostname;
|
||||||
|
}
|
||||||
|
moduleShm.unmapSharedMemory();
|
||||||
}
|
}
|
||||||
moduleShm.unmapSharedMemory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostringstream userDetails;
|
std::ostringstream userDetails;
|
||||||
|
|||||||
@@ -3635,17 +3635,8 @@ TEST_CASE("frametime", "[.cmdcall]") {
|
|||||||
TEST_CASE("user", "[.cmdcall]") {
|
TEST_CASE("user", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
// stays the same across calls
|
// caller only has help. cmdApp takes care of put and get
|
||||||
std::ostringstream oss1, oss2, oss3;
|
REQUIRE_NOTHROW(caller.call("user", {}, -1, defs::HELP_ACTION));
|
||||||
caller.call("user", {}, -1, GET, oss1);
|
|
||||||
caller.call("user", {}, -1, GET, oss2);
|
|
||||||
caller.call("user", {}, -1, GET, oss3);
|
|
||||||
REQUIRE(oss1.str() == oss2.str());
|
|
||||||
REQUIRE(oss2.str() == oss3.str());
|
|
||||||
|
|
||||||
// This is a get only command
|
|
||||||
// REQUIRE_THROWS(caller.call("user", {}, -1, PUT)); exit with failure
|
|
||||||
REQUIRE_NOTHROW(caller.call("user", {}, -1, GET));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("sleep", "[.cmdcall]") {
|
TEST_CASE("sleep", "[.cmdcall]") {
|
||||||
|
|||||||
Reference in New Issue
Block a user