Skip to content

Commit

Permalink
Created a new macro for creating a test name for each example
Browse files Browse the repository at this point in the history
  • Loading branch information
shahbajsohal committed Aug 1, 2023
1 parent 2aa3c97 commit 1c4386b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmake/macros/SundialsCreateTestName.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ macro(sundials_create_test_name example test_name)
set(options )

# macro keyword inputs followed by a single value
set(oneValueArgs )
set(oneValueArgs "MPI_NPROCS")

# macro keyword inputs followed by multiple values
# TEST_ARGS = command line arguments to pass to the test executable
Expand All @@ -29,7 +29,13 @@ macro(sundials_create_test_name example test_name)
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

get_filename_component(file_wo_ext ${example} NAME_WE)
if("${sundials_create_test_name_TEST_ARGS}" STREQUAL "<none>")
if(HAS_MPI)
if("${sundials_create_test_name_TEST_ARGS}" STREQUAL "<none>")
set(${test_name} ${file_wo_ext}_${sundials_create_test_name_MPI_NPROCS})
else()
string(REGEX REPLACE " " "_" ${test_name} ${file_wo_ext}_${sundials_create_test_name_TEST_ARGS}_${sundials_create_test_name_MPI_NPROCS})
endif()
elseif("${sundials_create_test_name_TEST_ARGS}" STREQUAL "<none>")
set(${test_name} ${file_wo_ext})
else()
string(REGEX REPLACE " " "_" ${test_name} ${file_wo_ext}_${sundials_create_test_name_TEST_ARGS})
Expand Down

0 comments on commit 1c4386b

Please sign in to comment.