mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
Setting dac names for CTB (C++ and Python) (#413)
# Setting DAC names for CTB * Introduced new shared memory for CTB only * Prepared for additional functionality * Works from C++ and Python Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
This commit is contained in:
@ -134,3 +134,31 @@ TEST_CASE("Create several shared memories", "[detector]") {
|
||||
CHECK(v[i].IsExisting() == false);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Create create a shared memory with a tag"){
|
||||
SharedMemory<int> shm(0, -1, "ctbdacs");
|
||||
REQUIRE(shm.GetName() == "/slsDetectorPackage_detector_0_ctbdacs");
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("Create create a shared memory with a tag when SLSDETNAME is set"){
|
||||
|
||||
// if SLSDETNAME is already set we unset it but
|
||||
// save the value
|
||||
std::string old_slsdetname;
|
||||
if (getenv(SHM_ENV_NAME))
|
||||
old_slsdetname = getenv(SHM_ENV_NAME);
|
||||
unsetenv(SHM_ENV_NAME);
|
||||
setenv(SHM_ENV_NAME, "myprefix", 1);
|
||||
|
||||
SharedMemory<int> shm(0, -1, "ctbdacs");
|
||||
REQUIRE(shm.GetName() == "/slsDetectorPackage_detector_0_myprefix_ctbdacs");
|
||||
|
||||
// Clean up after us
|
||||
if (old_slsdetname.empty())
|
||||
unsetenv(SHM_ENV_NAME);
|
||||
else
|
||||
setenv(SHM_ENV_NAME, old_slsdetname.c_str(), 1);
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user