Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix name clashes in concurrent tests #4397

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions testing/adios2/engine/bp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ include(ADIOSFunctions)
set(BP3_DIR ${CMAKE_CURRENT_BINARY_DIR}/bp3)
set(BP4_DIR ${CMAKE_CURRENT_BINARY_DIR}/bp4)
set(BP5_DIR ${CMAKE_CURRENT_BINARY_DIR}/bp5)
set(REMOTE_DIR ${CMAKE_CURRENT_BINARY_DIR}/remote)
set(XROOTD_DIR ${CMAKE_CURRENT_BINARY_DIR}/xrootd)
set(KVCACHE_DIR ${CMAKE_CURRENT_BINARY_DIR}/kvcache)
set(FS_DIR ${CMAKE_CURRENT_BINARY_DIR}/filestream)
file(MAKE_DIRECTORY ${BP3_DIR})
file(MAKE_DIRECTORY ${BP4_DIR})
file(MAKE_DIRECTORY ${BP5_DIR})
file(MAKE_DIRECTORY ${REMOTE_DIR})
file(MAKE_DIRECTORY ${XROOTD_DIR})
file(MAKE_DIRECTORY ${KVCACHE_DIR})
file(MAKE_DIRECTORY ${FS_DIR})

set(BP5_ASYNC_DIR ${BP5_DIR}/async)
Expand Down Expand Up @@ -120,31 +126,32 @@ if ((NOT WIN32) AND ADIOS2_HAVE_SST)
# (we don't really use SST here, just EVPath, but ADIOS2_HAVE_SST is the most relevant conditional)

macro(add_get_remote_tests_helper testname)
add_test(NAME "Remote.BP${testname}.GetRemote" COMMAND Test.Engine.BP.${testname}.Serial bp5)
set_tests_properties(Remote.BP${testname}.GetRemote PROPERTIES FIXTURES_REQUIRED Server ENVIRONMENT "DoRemote=1")
add_test(NAME "Remote.BP${testname}.GetRemote" COMMAND Test.Engine.BP.${testname}.Serial bp5 RemoteGet)
set_tests_properties(Remote.BP${testname}.GetRemote PROPERTIES FIXTURES_REQUIRED Server ENVIRONMENT "DoRemote=1" WORKING_DIRECTORY ${REMOTE_DIR})
endmacro()

macro(add_file_remote_tests_helper testname)
add_test(NAME "Remote.BP${testname}.FileRemote" COMMAND Test.Engine.BP.${testname}.Serial bp5)
set_tests_properties(Remote.BP${testname}.FileRemote PROPERTIES FIXTURES_REQUIRED Server ENVIRONMENT "DoFileRemote=1")
add_test(NAME "Remote.BP${testname}.FileRemote" COMMAND Test.Engine.BP.${testname}.Serial bp5 RemoteFile)
set_tests_properties(Remote.BP${testname}.FileRemote PROPERTIES FIXTURES_REQUIRED Server ENVIRONMENT "DoFileRemote=1" WORKING_DIRECTORY ${REMOTE_DIR})
endmacro()

add_test(NAME remoteServerSetup COMMAND adios2_remote_server -background)
set_tests_properties(remoteServerSetup PROPERTIES FIXTURES_SETUP Server)
set_tests_properties(remoteServerSetup PROPERTIES FIXTURES_SETUP Server WORKING_DIRECTORY ${REMOTE_DIR})

add_test(NAME remoteServerCleanup COMMAND adios2_remote_server -kill_server)
set_tests_properties(remoteServerCleanup PROPERTIES FIXTURES_CLEANUP Server)
set_tests_properties(remoteServerCleanup PROPERTIES FIXTURES_CLEANUP Server WORKING_DIRECTORY ${REMOTE_DIR})

if (ADIOS2_HAVE_KVCACHE)
add_test(NAME redisServerSetup COMMAND ${REDIS_SERVER_BINARY} --daemonize yes)
set_tests_properties(redisServerSetup PROPERTIES FIXTURES_SETUP RedisServer)
set_tests_properties(redisServerSetup PROPERTIES FIXTURES_SETUP RedisServer WORKING_DIRECTORY ${KVCACHE_DIR})

add_test(NAME redisServerCleanup COMMAND ${REDIS_CLI_BINARY} shutdown)
set_tests_properties(redisServerCleanup PROPERTIES FIXTURES_CLEANUP RedisServer)
set_tests_properties(redisServerCleanup PROPERTIES FIXTURES_CLEANUP RedisServer WORKING_DIRECTORY ${KVCACHE_DIR})

macro(add_get_kvcache_tests_helper testname)
add_test(NAME "Remote.BP${testname}.GetKVCache" COMMAND Test.Engine.BP.${testname}.Serial bp5)
set_tests_properties(Remote.BP${testname}.GetKVCache PROPERTIES FIXTURES_REQUIRED "Server;RedisServer" ENVIRONMENT "DoRemote=1;useKVCache=1")
set_tests_properties(Remote.BP${testname}.GetKVCache PROPERTIES FIXTURES_REQUIRED "Server;RedisServer" ENVIRONMENT "DoRemote=1;useKVCache=1" WORKING_DIRECTORY ${KVCACHE_DIR})

endmacro()

add_get_kvcache_tests_helper(WriteReadADIOS2stdio)
Expand All @@ -160,13 +167,13 @@ endif()
if (ADIOS2_HAVE_XRootD)
macro(add_get_xrremote_tests_helper testname)
add_test(NAME "Remote.BP${testname}.GetXRRemote" COMMAND Test.Engine.BP.${testname}.Serial bp5)
set_tests_properties(Remote.BP${testname}.GetXRRemote PROPERTIES FIXTURES_REQUIRED XRServer ENVIRONMENT "DoXRootD=1")
set_tests_properties(Remote.BP${testname}.GetXRRemote PROPERTIES FIXTURES_REQUIRED XRServer ENVIRONMENT "DoXRootD=1" WORKING_DIRECTORY ${XROOTD_DIR})
endmacro()

add_test(NAME generateXRootDConfig COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/generateXRootDConfig.sh $<TARGET_FILE:adios2_xrootd> )
add_test(NAME remoteXRServerSetup COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/start_xrootd.sh ${XROOTD_SERVER_BINARY} ${CMAKE_CURRENT_BINARY_DIR})

set_tests_properties(remoteXRServerSetup PROPERTIES FIXTURES_SETUP XRServer)
set_tests_properties(remoteXRServerSetup PROPERTIES FIXTURES_SETUP XRServer WORKING_DIRECTORY ${XROOTD_DIR})
set_tests_properties(remoteXRServerSetup PROPERTIES DEPENDS "generateXRootDConfig")

add_test(NAME remoteXRServerCleanup COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/kill_xrootd.sh )
Expand Down
18 changes: 9 additions & 9 deletions testing/adios2/engine/bp/TestBPWriteMemorySelectionRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "../SmallTestData.h"

std::string engineName; // comes from command line
std::string UniqName; // comes from command line
bool DoWrite = true;
bool DoRead = true;

Expand Down Expand Up @@ -185,9 +186,9 @@ void BPSteps1D(const size_t ghostCells)
#if ADIOS2_USE_MPI
MPI_Comm_rank(testComm, &mpiRank);
MPI_Comm_size(testComm, &mpiSize);
const std::string fname("BPSteps1D_" + std::to_string(ghostCells) + "_MPI");
const std::string fname("BPSteps1D_" + std::to_string(ghostCells) + UniqName + "_MPI");
#else
const std::string fname("BPSteps1D_" + std::to_string(ghostCells));
const std::string fname("BPSteps1D_" + std::to_string(ghostCells) + UniqName);
#endif

#if ADIOS2_USE_MPI
Expand Down Expand Up @@ -403,9 +404,9 @@ void BPSteps2D4x2(const size_t ghostCells)
#if ADIOS2_USE_MPI
MPI_Comm_rank(testComm, &mpiRank);
MPI_Comm_size(testComm, &mpiSize);
const std::string fname("BPSteps2D4x2_" + std::to_string(ghostCells) + "_MPI");
const std::string fname("BPSteps2D4x2_" + std::to_string(ghostCells) + UniqName + "_MPI");
#else
const std::string fname("BPSteps2D4x2_" + std::to_string(ghostCells));
const std::string fname("BPSteps2D4x2_" + std::to_string(ghostCells) + UniqName);
#endif

#if ADIOS2_USE_MPI
Expand Down Expand Up @@ -633,9 +634,9 @@ void BPSteps3D8x2x4(const size_t ghostCells)
#if ADIOS2_USE_MPI
MPI_Comm_rank(testComm, &mpiRank);
MPI_Comm_size(testComm, &mpiSize);
const std::string fname("BPSteps3D8x2x4_" + std::to_string(ghostCells) + "_MPI");
const std::string fname("BPSteps3D8x2x4_" + std::to_string(ghostCells) + UniqName + "_MPI");
#else
const std::string fname("BPSteps3D8x2x4_" + std::to_string(ghostCells));
const std::string fname("BPSteps3D8x2x4_" + std::to_string(ghostCells) + UniqName);
#endif

#if ADIOS2_USE_MPI
Expand Down Expand Up @@ -920,8 +921,7 @@ int main(int argc, char **argv)
}
else
{
std::string fname;
std::string engineParams;
// std::string engineParams;
if (bare_arg == 0)
{
/* first arg without -- is engine */
Expand All @@ -931,7 +931,7 @@ int main(int argc, char **argv)
else if (bare_arg == 1)
{
/* second arg without -- is filename */
// fname = std::string(argv[1]);
UniqName = std::string(argv[2]);
bare_arg++;
}
else if (bare_arg == 2)
Expand Down
27 changes: 16 additions & 11 deletions testing/adios2/engine/bp/TestBPWriteReadADIOS2stdio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "../SmallTestData.h"

std::string engineName; // comes from command line
std::string UniqName; // comes from command line

class BPWriteReadTestADIOS2stdio : public ::testing::Test
{
Expand Down Expand Up @@ -44,9 +45,9 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead1D8)
#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
const std::string fname("ADIOS2BPWriteRead1D8stdio_MPI.bp");
const std::string fname("ADIOS2BPWriteRead1D8stdio_MPI" + UniqName);
#else
const std::string fname("ADIOS2BPWriteRead1D8stdio.bp");
const std::string fname("ADIOS2BPWriteRead1D8stdio" + UniqName);
#endif

// Write test data using BP
Expand Down Expand Up @@ -385,9 +386,9 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead2D2x4)
#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
const std::string fname("ADIOS2BPWriteRead2D2x4Teststdio_MPI.bp");
const std::string fname("ADIOS2BPWriteRead2D2x4Teststdio_MPI" + UniqName);
#else
const std::string fname("ADIOS2BPWriteRead2D2x4Teststdio.bp");
const std::string fname("ADIOS2BPWriteRead2D2x4Teststdio" + UniqName);
#endif

// Write test data using ADIOS2
Expand Down Expand Up @@ -727,9 +728,9 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead2D4x2)
#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
const std::string fname("ADIOS2BPWriteRead2D4x2Teststdio_MPI.bp");
const std::string fname("ADIOS2BPWriteRead2D4x2Teststdio_MPI" + UniqName);
#else
const std::string fname("ADIOS2BPWriteRead2D4x2Teststdio.bp");
const std::string fname("ADIOS2BPWriteRead2D4x2Teststdio" + UniqName);
#endif

// Write test data using ADIOS2
Expand Down Expand Up @@ -1056,9 +1057,9 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead2D4x2_ReadMultiSteps)
#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
const std::string fname("ADIOS2BPWriteRead2D4x2Test_ReadMultiStepsstdio_MPI.bp");
const std::string fname("ADIOS2BPWriteRead2D4x2Test_ReadMultiStepsstdio_MPI" + UniqName);
#else
const std::string fname("ADIOS2BPWriteRead2D4x2Test_ReadMultiStepsstdio.bp");
const std::string fname("ADIOS2BPWriteRead2D4x2Test_ReadMultiStepsstdio" + UniqName);
#endif

// Write test data using ADIOS2
Expand Down Expand Up @@ -1385,9 +1386,9 @@ TEST_F(BPWriteReadTestADIOS2stdio, ADIOS2BPWriteRead2D4x2_MultiStepsOverflow)
#if ADIOS2_USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
const std::string fname("ADIOS2BPWriteRead2D4x2Test_Overflowstdio_MPI.bp");
const std::string fname("ADIOS2BPWriteRead2D4x2Test_Overflowstdio_MPI" + UniqName);
#else
const std::string fname("ADIOS2BPWriteRead2D4x2Test_Overflowstdio.bp");
const std::string fname("ADIOS2BPWriteRead2D4x2Test_Overflowstdio" + UniqName);
#endif

// Write test data using ADIOS2
Expand Down Expand Up @@ -1601,7 +1602,7 @@ TEST_F(BPWriteReadTestADIOS2stdio, OpenEngineTwice)
}
}

int main(int argc, char **argv)
int main(int argc, char **argv, char **envp)
{
#if ADIOS2_USE_MPI
int provided;
Expand All @@ -1616,6 +1617,10 @@ int main(int argc, char **argv)
{
engineName = std::string(argv[1]);
}
if (argc > 2)
{
UniqName = std::string(argv[2]);
}
result = RUN_ALL_TESTS();

#if ADIOS2_USE_MPI
Expand Down