Skip to content

Commit

Permalink
utilize new SundialsCreateTestName macro
Browse files Browse the repository at this point in the history
  • Loading branch information
shahbajsohal committed Aug 1, 2023
1 parent 1c4386b commit 187536f
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 150 deletions.
22 changes: 16 additions & 6 deletions examples/arkode/C_manyvector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,30 @@ foreach(example_tuple ${ARKODE_examples})
PARAMS_VAR example_args
TYPE_VAR example_type
)
# example source files
add_executable(${example} ${example})
# check if this example has already been added, only need to add
# example source files once for testing with different inputs
if(NOT TARGET ${example})
# example source files
add_executable(${example} ${example})

# folder to organize targets in an IDE
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# libraries to link against
target_link_libraries(${example} ${SUNDIALS_LIBS})
endif()

# check if example args are provided and set the test name
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

set_target_properties(${example} PROPERTIES FOLDER "Examples")

# add example to regression tests
sundials_add_test(${example} ${example}
ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR}
ANSWER_FILE ${example}.out
EXAMPLE_TYPE ${example_type})

# libraries to link against
target_link_libraries(${example} ${SUNDIALS_LIBS})

endforeach(example_tuple ${ARKODE_examples})

# create Makfile and CMakeLists.txt for examples
Expand Down
51 changes: 31 additions & 20 deletions examples/arkode/C_serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,8 @@ foreach(example_tuple ${ARKODE_examples})
endif()

# check if example args are provided and set the test name
if("${example_args}" STREQUAL "")
set(test_name ${example})
else()
string(REGEX REPLACE " " "_" test_name ${example}_${example_args})
endif()
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# add example to regression tests
sundials_add_test(${test_name} ${example}
Expand All @@ -167,23 +164,30 @@ if(BUILD_SUNLINSOL_KLU)
TYPE_VAR example_type
)

# example source files
add_executable(${example} ${example})

set_target_properties(${example} PROPERTIES FOLDER "Examples")
if (NOT TARGET ${example})
# example source files
add_executable(${example} ${example})

# add example to regression tests
sundials_add_test(${example} ${example}
ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR}
ANSWER_FILE ${example}.out
EXAMPLE_TYPE ${example_type})
# folder for IDEs
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# libraries to link against
target_link_libraries(${example}
sundials_arkode
sundials_nvecserial
sundials_sunlinsolklu
${EXE_EXTRA_LINK_LIBS})
endif()

# check if example args are provided and set the test name
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# add example to regression tests
sundials_add_test(${example} ${example}
ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR}
ANSWER_FILE ${example}.out
EXAMPLE_TYPE ${example_type})

endforeach(example_tuple ${ARKODE_examples_KLU})

Expand All @@ -202,23 +206,30 @@ if(BUILD_SUNLINSOL_SUPERLUMT)
TYPE_VAR example_type
)

if (NOT TARGET ${example})
# example source files
add_executable(${example} ${example})

# folder for IDEs
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# add example to regression tests
sundials_add_test(${example} ${example}
ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR}
ANSWER_FILE ${example}.out
EXAMPLE_TYPE ${example_type})

# libraries to link against
target_link_libraries(${example}
sundials_arkode
sundials_nvecserial
sundials_sunlinsolsuperlumt
${EXE_EXTRA_LINK_LIBS})
endif()

# check if example args are provided and set the test name
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# add example to regression tests
sundials_add_test(${example} ${example}
ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR}
ANSWER_FILE ${example}.out
EXAMPLE_TYPE ${example_type})

endforeach(example_tuple ${ARKODE_examples_SUPERLUMT})

Expand Down
34 changes: 11 additions & 23 deletions examples/cvode/serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,8 @@ foreach(example_tuple ${CVODE_examples})
endif()

# check if example args are provided and set the test name
if("${example_args}" STREQUAL "")
set(test_name ${example})
else()
string(REGEX REPLACE " " "_" test_name ${example}_${example_args})
endif()
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# add example to regression tests
sundials_add_test(${test_name} ${example}
Expand Down Expand Up @@ -153,12 +150,9 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE)
target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLLAPACK_LIBS})
endif()

# check if example args are provided and set the test name
if("${example_args}" STREQUAL "")
set(test_name ${example})
else()
string(REGEX REPLACE " " "_" test_name ${example}_${example_args})
endif()
# check if example args are provided and set the test name
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# add example to regression tests
sundials_add_test(${test_name} ${example}
Expand Down Expand Up @@ -205,12 +199,9 @@ if(BUILD_SUNLINSOL_KLU)
target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLKLU_LIBS})
endif()

# check if example args are provided and set the test name
if("${example_args}" STREQUAL "")
set(test_name ${example})
else()
string(REGEX REPLACE " " "_" test_name ${example}_${example_args})
endif()
# check if example args are provided and set the test name
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# add example to regression tests
sundials_add_test(${test_name} ${example}
Expand Down Expand Up @@ -257,12 +248,9 @@ if(BUILD_SUNLINSOL_SUPERLUMT)
target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLSLUMT_LIBS})
endif()

# check if example args are provided and set the test name
if("${example_args}" STREQUAL "")
set(test_name ${example})
else()
string(REGEX REPLACE " " "_" test_name ${example}_${example_args})
endif()
# check if example args are provided and set the test name
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# Do not include SuperLUMT examples in testing when the indextype is int64_t.
# Answer files were generated with int32_t and minor differences in output
Expand Down
35 changes: 11 additions & 24 deletions examples/cvodes/serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,8 @@ foreach(example_tuple ${CVODES_examples})
endif()

# check if example args are provided and set the test name
if("${example_args}" STREQUAL "")
set(test_name ${example})
else()
string(REGEX REPLACE " " "_" test_name ${example}_${example_args})
endif()
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# add example to regression tests
sundials_add_test(${test_name} ${example}
Expand Down Expand Up @@ -166,12 +163,9 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE)
target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLLAPACK_LIBS})
endif()

# check if example args are provided and set the test name
if("${example_args}" STREQUAL "")
set(test_name ${example})
else()
string(REGEX REPLACE " " "_" test_name ${example}_${example_args})
endif()
# check if example args are provided and set the test name
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# add example to regression tests
sundials_add_test(${test_name} ${example}
Expand Down Expand Up @@ -217,12 +211,9 @@ if(BUILD_SUNLINSOL_KLU)
target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLKLU_LIBS})
endif()

# check if example args are provided and set the test name
if("${example_args}" STREQUAL "")
set(test_name ${example})
else()
string(REGEX REPLACE " " "_" test_name ${example}_${example_args})
endif()
# check if example args are provided and set the test name
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# add example to regression tests
sundials_add_test(${test_name} ${example}
Expand Down Expand Up @@ -268,13 +259,9 @@ if(BUILD_SUNLINSOL_SUPERLUMT)
# libraries to link against
target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLSLUMT_LIBS})
endif()

# check if example args are provided and set the test name
if("${example_args}" STREQUAL "")
set(test_name ${example})
else()
string(REGEX REPLACE " " "_" test_name ${example}_${example_args})
endif()
# check if example args are provided and set the test name
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# Do not include SuperLUMT examples in testing when the indextype is int32_t.
# Answer files were generated with int64_t and minor differences in output
Expand Down
27 changes: 16 additions & 11 deletions examples/ida/parallel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,30 @@ foreach(example_tuple ${IDA_examples})
TYPE_VAR example_type
)

# example source files
add_executable(${example} ${example})
if(NOT TARGET ${example})
# example source files
add_executable(${example} ${example})

set_target_properties(${example} PROPERTIES FOLDER "Examples")
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# libraries to link against
target_link_libraries(${example} ${SUNDIALS_LIBS})

if(NOT MPI_C_COMPILER)
target_link_libraries(${example} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARIES})
endif()
endif()
# check if example args are provided and set the test name
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args} MPI_NPROCS ${number_of_tasks})

# add example to regression tests
sundials_add_test(${example} ${example}
sundials_add_test(${test_name} ${example}
MPI_NPROCS ${number_of_tasks}
ANSWER_DIR ${CMAKE_CURRENT_SOURCE_DIR}
ANSWER_FILE ${example}.out
EXAMPLE_TYPE ${example_type})

# libraries to link against
target_link_libraries(${example} ${SUNDIALS_LIBS})

if(NOT MPI_C_COMPILER)
target_link_libraries(${example} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARIES})
endif()

endforeach(example_tuple ${IDA_examples})

# create Makfile and CMakeLists.txt for examples
Expand Down
34 changes: 11 additions & 23 deletions examples/idas/serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,8 @@ foreach(example_tuple ${IDAS_examples})
endif()

# check if example args are provided and set the test name
if("${example_args}" STREQUAL "")
set(test_name ${example})
else()
string(REGEX REPLACE " " "_" test_name ${example}_${example_args})
endif()
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# add example to regression tests
sundials_add_test(${test_name} ${example}
Expand Down Expand Up @@ -145,12 +142,9 @@ if(BUILD_SUNLINSOL_LAPACKBAND AND BUILD_SUNLINSOL_LAPACKDENSE)
target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLLAPACK_LIBS})
endif()

# check if example args are provided and set the test name
if("${example_args}" STREQUAL "")
set(test_name ${example})
else()
string(REGEX REPLACE " " "_" test_name ${example}_${example_args})
endif()
# check if example args are provided and set the test name
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# add example to regression tests
sundials_add_test(${test_name} ${example}
Expand Down Expand Up @@ -197,12 +191,9 @@ if(BUILD_SUNLINSOL_KLU)
target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLKLU_LIBS})
endif()

# check if example args are provided and set the test name
if("${example_args}" STREQUAL "")
set(test_name ${example})
else()
string(REGEX REPLACE " " "_" test_name ${example}_${example_args})
endif()
# check if example args are provided and set the test name
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# add example to regression tests
sundials_add_test(${test_name} ${example}
Expand Down Expand Up @@ -249,12 +240,9 @@ if(BUILD_SUNLINSOL_SUPERLUMT)
target_link_libraries(${example} ${SUNDIALS_LIBS} ${SUNLINSOLSLUMT_LIBS})
endif()

# check if example args are provided and set the test name
if("${example_args}" STREQUAL "")
set(test_name ${example})
else()
string(REGEX REPLACE " " "_" test_name ${example}_${example_args})
endif()
# check if example args are provided and set the test name
sundials_create_test_name(${example} test_name
TEST_ARGS ${example_args})

# Do not include SuperLUMT examples in testing when the indextype is int64_t.
# Answer files were generated with int32_t and minor differences in output
Expand Down
Loading

0 comments on commit 187536f

Please sign in to comment.