Compare commits

...

1 Commits

Author SHA1 Message Date
Bartosz Podrygajlo
5cfb5f6c98 fix(ci): make vrtsim test multi-process safe
Make sure that shared memory is unique per test process by adding the PID to
the shared memory file name.

Assisted-by: Gemini:Flash-3.5
Signed-off-by: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
2026-05-28 13:31:21 +02:00
3 changed files with 37 additions and 8 deletions

View File

@@ -8,6 +8,7 @@
#include <thread>
#include <vector>
#include <string>
#include <unistd.h>
configmodule_interface_t *uniqCfg = NULL;
@@ -44,16 +45,25 @@ class VRTSIMTest : public ::testing::TestWithParam<VRTSIMTestCase> {
openair0_device_t client_device = {0};
openair0_config_t server_config = {0};
openair0_config_t client_config = {0};
std::string shm_name;
std::string descriptor_path;
void SetUp() override
{
const auto &param = GetParam();
shm_name = "shm_vrtsim_" + std::to_string(getpid()) + "_" + std::to_string(param.server_tx) + "_" + param.ue_antennas;
descriptor_path = "/tmp/vrtsim_connection_" + std::to_string(getpid()) + "_" + std::to_string(param.server_tx) + "_" + param.ue_antennas;
// Setup server
std::vector<const char *> server_argv = {"--vrtsim.role",
"server",
"--vrtsim.disable-timing-thread",
"1",
"--vrtsim.shm_channel_name",
shm_name.c_str(),
"--vrtsim.connection_descriptor",
descriptor_path.c_str(),
"--vrtsim.ue_config.[0].antennas",
param.ue_antennas.c_str()};
cfg1 = load_configmodule(server_argv.size(), (char **)server_argv.data(), CONFIG_ENABLECMDLINEONLY);
@@ -65,7 +75,12 @@ class VRTSIMTest : public ::testing::TestWithParam<VRTSIMTestCase> {
ASSERT_EQ(server_device.trx_start_func(&server_device), 0);
// Setup client
std::vector<const char *> client_argv = {"--vrtsim.role", "client"};
std::vector<const char *> client_argv = {"--vrtsim.role",
"client",
"--vrtsim.shm_channel_name",
shm_name.c_str(),
"--vrtsim.connection_descriptor",
descriptor_path.c_str()};
cfg2 = load_configmodule(client_argv.size(), (char **)client_argv.data(), CONFIG_ENABLECMDLINEONLY);
uniqCfg = cfg2;
client_config.tx_num_channels = param.client_tx;
@@ -85,6 +100,7 @@ class VRTSIMTest : public ::testing::TestWithParam<VRTSIMTestCase> {
end_configmodule(cfg1);
if (cfg2)
end_configmodule(cfg2);
uniqCfg = nullptr;
}
};

View File

@@ -11,6 +11,7 @@
#include <filesystem>
#include <fstream>
#include <tuple>
#include <unistd.h>
#include "common_lib.h"
#include "common/config/config_userapi.h"
@@ -102,13 +103,14 @@ class VRTSTapsCIRDBTest : public ::testing::TestWithParam<CIRDBAntParams> {
openair0_config_t client_config = {0};
fs::path tmp_dir;
std::string shm_name;
std::string descriptor_path;
configmodule_interface_t *cfg1 = nullptr;
configmodule_interface_t *cfg2 = nullptr;
void SetUp() override
{
const CIRDBAntParams &p = GetParam();
tmp_dir = fs::temp_directory_path() / ("vrtsim_cirdb_test_" + std::to_string(p.gnb_tx) + "_" + p.ue_ant_str);
tmp_dir = fs::temp_directory_path() / ("vrtsim_cirdb_test_" + std::to_string(getpid()) + "_" + std::to_string(p.gnb_tx) + "_" + p.ue_ant_str);
CIRDBProducer producer(tmp_dir);
// Add entries for both directions to both model IDs to ensure test robustness against unintended configuration state leakage
producer.add_entry(0, p.gnb_tx, p.ue_rx, 8, 1, 30.72e6, 0.5, 10.0, 1.5);
@@ -116,7 +118,8 @@ class VRTSTapsCIRDBTest : public ::testing::TestWithParam<CIRDBAntParams> {
producer.add_entry(0, p.ue_tx, p.gnb_rx, 8, 1, 30.72e6, 0.5, 10.0, 1.5);
producer.add_entry(1, p.ue_tx, p.gnb_rx, 8, 1, 30.72e6, 0.5, 10.0, 1.5);
producer.write_files();
shm_name = "shm_cirdb_" + std::to_string(p.gnb_tx) + "_" + p.ue_ant_str;
shm_name = "shm_cirdb_" + std::to_string(getpid()) + "_" + std::to_string(p.gnb_tx) + "_" + p.ue_ant_str;
descriptor_path = "/tmp/vrtsim_connection_cirdb_" + std::to_string(getpid()) + "_" + std::to_string(p.gnb_tx) + "_" + p.ue_ant_str;
}
void TearDown() override
@@ -158,7 +161,9 @@ TEST_P(VRTSTapsCIRDBTest, CIRDBDelayDL)
"--vrtsim.cirdb_model_id",
"0",
"--vrtsim.ue_config.[0].antennas",
p.ue_ant_str.c_str()};
p.ue_ant_str.c_str(),
"--vrtsim.connection_descriptor",
descriptor_path.c_str()};
cfg1 = load_configmodule(sizeof(s_argv) / sizeof(char *), (char **)s_argv, CONFIG_ENABLECMDLINEONLY);
uniqCfg = cfg1;
server_config.tx_num_channels = p.gnb_tx;
@@ -178,7 +183,9 @@ TEST_P(VRTSTapsCIRDBTest, CIRDBDelayDL)
"--vrtsim.cirdb",
"0",
"--vrtsim.ue_config.[0].antennas",
p.ue_ant_str.c_str()};
p.ue_ant_str.c_str(),
"--vrtsim.connection_descriptor",
descriptor_path.c_str()};
cfg2 = load_configmodule(sizeof(c_argv) / sizeof(char *), (char **)c_argv, CONFIG_ENABLECMDLINEONLY);
uniqCfg = cfg2;
client_config.tx_num_channels = p.ue_tx;
@@ -232,7 +239,9 @@ TEST_P(VRTSTapsCIRDBTest, CIRDBDelayUL)
"--vrtsim.cirdb",
"0",
"--vrtsim.ue_config.[0].antennas",
p.ue_ant_str.c_str()};
p.ue_ant_str.c_str(),
"--vrtsim.connection_descriptor",
descriptor_path.c_str()};
cfg1 = load_configmodule(sizeof(s_argv) / sizeof(char *), (char **)s_argv, CONFIG_ENABLECMDLINEONLY);
uniqCfg = cfg1;
server_config.tx_num_channels = p.gnb_tx;
@@ -256,7 +265,9 @@ TEST_P(VRTSTapsCIRDBTest, CIRDBDelayUL)
"--vrtsim.cirdb_model_id",
"1",
"--vrtsim.ue_config.[0].antennas",
p.ue_ant_str.c_str()};
p.ue_ant_str.c_str(),
"--vrtsim.connection_descriptor",
descriptor_path.c_str()};
cfg2 = load_configmodule(sizeof(c_argv) / sizeof(char *), (char **)c_argv, CONFIG_ENABLECMDLINEONLY);
uniqCfg = cfg2;
client_config.tx_num_channels = p.ue_tx;

View File

@@ -11,6 +11,7 @@
#include <mutex>
#include <string>
#include <algorithm>
#include <unistd.h>
configmodule_interface_t *uniqCfg = NULL;
@@ -162,7 +163,7 @@ class VRTSTapsTest : public ::testing::TestWithParam<TapsAntParams> {
void SetUp() override
{
auto p = GetParam();
std::string tag = std::to_string(p.gnb_tx) + "_" + p.ue_ant_str;
std::string tag = std::to_string(getpid()) + "_" + std::to_string(p.gnb_tx) + "_" + p.ue_ant_str;
server_taps_url = "ipc:///tmp/server_taps_" + tag + ".ipc";
client_taps_url = "ipc:///tmp/client_taps_" + tag + ".ipc";
descriptor_path = "/tmp/vrtsim_connection_" + tag;
@@ -217,6 +218,7 @@ class VRTSTapsTest : public ::testing::TestWithParam<TapsAntParams> {
end_configmodule(cfg1);
if (cfg2)
end_configmodule(cfg2);
uniqCfg = nullptr;
}
};