Skip to content
Snippets Groups Projects
Commit d3cad66f authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #4315: Use unique keys in shared memory tests to allow them to run in parallel

parent cfd45504
No related branches found
No related tags found
No related merge requests found
Showing with 22 additions and 20 deletions
...@@ -149,7 +149,7 @@ int main() ...@@ -149,7 +149,7 @@ int main()
alarm(10); alarm(10);
// Use a fixed key, so the test suite knows what to clean // Use a fixed key, so the test suite knows what to clean
settings.dataKey = 0x12345678; settings.dataKey = 0x10000001;
// Limit the array in size to work on systems with only 32MB SHM // Limit the array in size to work on systems with only 32MB SHM
settings.nrBoards = 1; settings.nrBoards = 1;
......
#!/bin/sh #!/bin/sh
# Remove the shared memory region if the test crashes # Remove the shared memory region if the test crashes
trap "ipcrm -M 0x12345678 2>/dev/null || true" EXIT trap "ipcrm -M 0x10000001 2>/dev/null || true" EXIT
./runctest.sh tBlockReader > tBlockReader.log 2>&1 ./runctest.sh tBlockReader > tBlockReader.log 2>&1
...@@ -111,7 +111,7 @@ int main() ...@@ -111,7 +111,7 @@ int main()
struct BufferSettings settings(stationID, false); struct BufferSettings settings(stationID, false);
// Use a fixed key, so the test suite knows what to clean // Use a fixed key, so the test suite knows what to clean
settings.dataKey = 0x12345678; settings.dataKey = 0x10000003;
// Limit the array in size to work on systems with only 32MB SHM // Limit the array in size to work on systems with only 32MB SHM
settings.nrBoards = 1; settings.nrBoards = 1;
......
#!/bin/sh #!/bin/sh
# Remove the shared memory region if the test crashes # Remove the shared memory region if the test crashes
trap "ipcrm -M 0x12345678 2>/dev/null || true" EXIT trap "ipcrm -M 0x10000003 2>/dev/null || true" EXIT
./runctest.sh tPacketWriter > tPacketWriter.log 2>&1 ./runctest.sh tPacketWriter > tPacketWriter.log 2>&1
...@@ -72,7 +72,7 @@ int main() ...@@ -72,7 +72,7 @@ int main()
struct BufferSettings settings(stationID, false); struct BufferSettings settings(stationID, false);
// Use a fixed key, so the test suite knows what to clean // Use a fixed key, so the test suite knows what to clean
settings.dataKey = 0x12345678; settings.dataKey = 0x10000002;
// Limit the array in size to work on systems with only 32MB SHM // Limit the array in size to work on systems with only 32MB SHM
settings.nrBoards = 1; settings.nrBoards = 1;
......
#!/bin/sh #!/bin/sh
# Remove the shared memory region if the test crashes # Remove the shared memory region if the test crashes
trap "ipcrm -M 0x12345678 2>/dev/null || true" EXIT trap "ipcrm -M 0x10000002 2>/dev/null || true" EXIT
./runctest.sh tPacketsToBuffer > tPacketsToBuffer.log 2>&1 ./runctest.sh tPacketsToBuffer > tPacketsToBuffer.log 2>&1
...@@ -56,7 +56,7 @@ int main() ...@@ -56,7 +56,7 @@ int main()
struct BufferSettings settings(stationID, false); struct BufferSettings settings(stationID, false);
// Use a fixed key, so the test suite knows what to clean // Use a fixed key, so the test suite knows what to clean
settings.dataKey = 0x12345678; settings.dataKey = 0x10000004;
// Limit the array in size to work on systems with only 32MB SHM // Limit the array in size to work on systems with only 32MB SHM
settings.nrBoards = 1; settings.nrBoards = 1;
......
#!/bin/sh #!/bin/sh
# Remove the shared memory region if the test crashes # Remove the shared memory region if the test crashes
trap "ipcrm -M 0x12345678 2>/dev/null || true" EXIT trap "ipcrm -M 0x10000004 2>/dev/null || true" EXIT
./runctest.sh tSampleBuffer > tSampleBuffer.log 2>&1 ./runctest.sh tSampleBuffer > tSampleBuffer.log 2>&1
...@@ -52,7 +52,7 @@ void initBoard() ...@@ -52,7 +52,7 @@ void initBoard()
struct BufferSettings settings(stationID, false); struct BufferSettings settings(stationID, false);
// Use a fixed key, so the test suite knows what to clean // Use a fixed key, so the test suite knows what to clean
settings.dataKey = 0x12345678; settings.dataKey = 0x10000005;
// Limit the array in size to work on systems with only 32MB SHM // Limit the array in size to work on systems with only 32MB SHM
settings.nrBoards = 1; settings.nrBoards = 1;
......
#!/bin/sh #!/bin/sh
# Remove the shared memory region if the test crashes # Remove the shared memory region if the test crashes
trap "ipcrm -M 0x12345678 2>/dev/null || true" EXIT trap "ipcrm -M 0x10000005 2>/dev/null || true" EXIT
./runctest.sh tSampleBufferSync > tSampleBufferSync.log 2>&1 ./runctest.sh tSampleBufferSync > tSampleBufferSync.log 2>&1
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <InputProc/Buffer/SharedMemory.h> #include <InputProc/Buffer/SharedMemory.h>
#define DATAKEY 0x10000006
using namespace LOFAR; using namespace LOFAR;
using namespace Cobalt; using namespace Cobalt;
...@@ -40,7 +42,7 @@ public: ...@@ -40,7 +42,7 @@ public:
{ {
sleep(1); sleep(1);
SharedMemoryArena m( 0x12345678, 1024, SharedMemoryArena::CREATE, 0 ); SharedMemoryArena m( DATAKEY, 1024, SharedMemoryArena::CREATE, 0 );
LOG_INFO("Memory area created"); LOG_INFO("Memory area created");
...@@ -52,7 +54,7 @@ public: ...@@ -52,7 +54,7 @@ public:
{ {
LOG_INFO("Waiting for memory area"); LOG_INFO("Waiting for memory area");
SharedMemoryArena m( 0x12345678, 1024, SharedMemoryArena::READ, 2 ); SharedMemoryArena m( DATAKEY, 1024, SharedMemoryArena::READ, 2 );
LOG_INFO("Memory area attached"); LOG_INFO("Memory area attached");
...@@ -69,16 +71,16 @@ int main() ...@@ -69,16 +71,16 @@ int main()
{ {
LOG_INFO("Create shared memory region"); LOG_INFO("Create shared memory region");
SharedMemoryArena m( 0x12345678, 1024, SharedMemoryArena::CREATE, 0 ); SharedMemoryArena m( DATAKEY, 1024, SharedMemoryArena::CREATE, 0 );
} }
/* Create a shared memory region and access it */ /* Create a shared memory region and access it */
{ {
LOG_INFO("Create shared memory region and access it"); LOG_INFO("Create shared memory region and access it");
SharedMemoryArena x( 0x12345678, 1024, SharedMemoryArena::CREATE, 0 ); SharedMemoryArena x( DATAKEY, 1024, SharedMemoryArena::CREATE, 0 );
SharedMemoryArena y( 0x12345678, 1024, SharedMemoryArena::READ, 0 ); SharedMemoryArena y( DATAKEY, 1024, SharedMemoryArena::READ, 0 );
} }
/* Access a non-existing shared memory region */ /* Access a non-existing shared memory region */
...@@ -88,7 +90,7 @@ int main() ...@@ -88,7 +90,7 @@ int main()
bool caught_exception = false; bool caught_exception = false;
try { try {
SharedMemoryArena y( 0x12345678, 1024, SharedMemoryArena::READ, 0 ); SharedMemoryArena y( DATAKEY, 1024, SharedMemoryArena::READ, 0 );
} catch(SystemCallException &e) { } catch(SystemCallException &e) {
caught_exception = true; caught_exception = true;
} }
...@@ -103,7 +105,7 @@ int main() ...@@ -103,7 +105,7 @@ int main()
bool caught_exception = false; bool caught_exception = false;
try { try {
SharedMemoryArena y( 0x12345678, 1024, SharedMemoryArena::READ, 1 ); SharedMemoryArena y( DATAKEY, 1024, SharedMemoryArena::READ, 1 );
} catch(SharedMemoryArena::TimeOutException &e) { } catch(SharedMemoryArena::TimeOutException &e) {
caught_exception = true; caught_exception = true;
} }
...@@ -130,9 +132,9 @@ int main() ...@@ -130,9 +132,9 @@ int main()
{ {
LOG_INFO("Checking memory access through SharedStruct"); LOG_INFO("Checking memory access through SharedStruct");
SharedStruct<int> writer( 0x12345678, true, 0 ); SharedStruct<int> writer( DATAKEY, true, 0 );
SharedStruct<int> reader( 0x12345678, false, 0 ); SharedStruct<int> reader( DATAKEY, false, 0 );
writer.get() = 42; writer.get() = 42;
ASSERT( reader.get() == 42 ); ASSERT( reader.get() == 42 );
......
#!/bin/sh #!/bin/sh
# Remove the shared memory region if the test crashes # Remove the shared memory region if the test crashes
trap "ipcrm -M 0x12345678 2>/dev/null || true" EXIT trap "ipcrm -M 0x10000006 2>/dev/null || true" EXIT
./runctest.sh tSharedMemory > tSharedMemory.log 2>&1 ./runctest.sh tSharedMemory > tSharedMemory.log 2>&1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment