Files
FairMQ/test/transport/_shmem.cxx
Claude 3077d1c0ab test: use 100 MB shm segments in all shmem tests
- The shmem default segment is 2 GiB, and Boost reserves it with
  posix_fallocate, so each test takes 2 GiB of /dev/shm
- Parallel test runs then exhaust /dev/shm and segment creation
  fails with "No space left on device"
- Set --shm-segment-size 100000000 like the other tests already do

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 17:00:00 +01:00

46 lines
1.5 KiB
C++

/********************************************************************************
* Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include <fairmq/ProgOptions.h>
#include <fairmq/shmem/Monitor.h>
#include <fairmq/tools/Unique.h>
#include <fairmq/TransportFactory.h>
#include <gtest/gtest.h>
#include <string>
namespace
{
using namespace std;
using namespace fair::mq;
void GetFreeMemory()
{
ProgOptions config;
string sessionId(to_string(tools::UuidHash()));
config.SetProperty<string>("session", sessionId);
config.SetProperty<bool>("shm-monitor", true);
config.SetProperty<size_t>("shm-segment-size", 100000000);
ASSERT_THROW(shmem::Monitor::GetFreeMemory(shmem::SessionId{sessionId}, 0), shmem::Monitor::MonitorError);
auto factory = TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &config);
ASSERT_NO_THROW(shmem::Monitor::GetFreeMemory(shmem::SessionId{sessionId}, 0));
ASSERT_THROW(shmem::Monitor::GetFreeMemory(shmem::SessionId{sessionId}, 1), shmem::Monitor::MonitorError);
}
TEST(Monitor, GetFreeMemory)
{
GetFreeMemory();
}
} // namespace