From a902da66639f755da0f06188b6ebda00cc935a8e Mon Sep 17 00:00:00 2001 From: Greg Eisenhauer Date: Sun, 10 Nov 2024 17:17:39 -0500 Subject: [PATCH] Fix name clashes in concurrent tests (#4397) --- testing/adios2/engine/bp/CMakeLists.txt | 29 ++++++++++++------- .../bp/TestBPWriteMemorySelectionRead.cpp | 18 ++++++------ .../engine/bp/TestBPWriteReadADIOS2stdio.cpp | 27 ++++++++++------- 3 files changed, 43 insertions(+), 31 deletions(-) diff --git a/testing/adios2/engine/bp/CMakeLists.txt b/testing/adios2/engine/bp/CMakeLists.txt index dbbce8540c..5b7fb75002 100644 --- a/testing/adios2/engine/bp/CMakeLists.txt +++ b/testing/adios2/engine/bp/CMakeLists.txt @@ -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) @@ -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) @@ -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 $ ) 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 ) diff --git a/testing/adios2/engine/bp/TestBPWriteMemorySelectionRead.cpp b/testing/adios2/engine/bp/TestBPWriteMemorySelectionRead.cpp index fa70fd610e..03d98aa85f 100644 --- a/testing/adios2/engine/bp/TestBPWriteMemorySelectionRead.cpp +++ b/testing/adios2/engine/bp/TestBPWriteMemorySelectionRead.cpp @@ -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; @@ -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 @@ -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 @@ -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 @@ -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 */ @@ -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) diff --git a/testing/adios2/engine/bp/TestBPWriteReadADIOS2stdio.cpp b/testing/adios2/engine/bp/TestBPWriteReadADIOS2stdio.cpp index c4b259f12a..9d1932a54f 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadADIOS2stdio.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadADIOS2stdio.cpp @@ -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 { @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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; @@ -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