Skip to content

Commit

Permalink
Merge pull request #503 from mmuetzel/root
Browse files Browse the repository at this point in the history
Enable testing facilities with root CMakeLists.txt
  • Loading branch information
DrTimothyAldenDavis authored Nov 5, 2023
2 parents 294cd68 + c9339fa commit 133ca08
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 47 deletions.
43 changes: 33 additions & 10 deletions .github/workflows/root-cmakelists.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ jobs:
ccache -s
echo "/usr/lib/ccache" >> $GITHUB_PATH
- name: build libraries
- name: configure
run: |
printf "::group:: \033[0;32m==>\033[0m Configuring\n"
mkdir -p ${GITHUB_WORKSPACE}/build && cd ${GITHUB_WORKSPACE}/build
cmake -DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX=".." \
Expand All @@ -121,10 +120,11 @@ jobs:
-DBLA_VENDOR="OpenBLAS" \
${{ matrix.cuda-cmake-flags }} \
..
echo "::endgroup::"
printf "::group:: \033[0;32m==>\033[0m Building\n"
- name: build libraries
run: |
cd ${GITHUB_WORKSPACE}/build
cmake --build .
echo "::endgroup::"
- name: build demos
run: |
Expand All @@ -150,6 +150,11 @@ jobs:
path: ~/.ccache
key: ${{ steps.ccache-prepare.outputs.key }}

- name: check
run: |
cd ${GITHUB_WORKSPACE}/build
ctest . || ctest . --rerun-failed --output-on-failure
- name: install
run: |
printf "\033[0;32m==>\033[0m Installing libraries\n"
Expand Down Expand Up @@ -247,6 +252,7 @@ jobs:
install: >-
mingw-w64-ucrt-x86_64-gmp
mingw-w64-ucrt-x86_64-mpfr
mingw-w64-ucrt-x86_64-python
msystem: UCRT64

Expand Down Expand Up @@ -303,9 +309,8 @@ jobs:
- name: setup MSVC toolchain
uses: ilammy/msvc-dev-cmd@v1

- name: build libraries
- name: configure
run: |
printf "::group:: \033[0;32m==>\033[0m Configuring\n"
mkdir -p ${GITHUB_WORKSPACE}/build && cd ${GITHUB_WORKSPACE}/build
cmake -G"Ninja Multi-Config" \
-DCMAKE_BUILD_TYPE="Release" \
Expand All @@ -316,13 +321,25 @@ jobs:
-DCMAKE_Fortran_COMPILER_LAUNCHER="ccache" \
-DNFORTRAN=ON \
-DBLA_VENDOR="All" \
-DPython_EXECUTABLE="C:/msys64/ucrt64/bin/python.exe" \
..
- name: build libraries
run: |
cd ${GITHUB_WORKSPACE}/build
cmake --build . --config Release
- name: build demos
run: |
printf "::group:: \033[0;32m==>\033[0m Configuring for demos\n"
cd ${GITHUB_WORKSPACE}/build
cmake -DDEMO=ON ..
echo "::endgroup::"
printf "::group:: \033[0;32m==>\033[0m Building\n"
printf "::group:: \033[0;32m==>\033[0m Building demos\n"
cd ${GITHUB_WORKSPACE}/build
cmake --build . --config Release
echo "::endgroup::"
# FIXME: Build and run tests and demos
# FIXME: How to run the demos without Makefile?
- name: ccache status
continue-on-error: true
Expand All @@ -336,6 +353,12 @@ jobs:
path: ${{ steps.ccache-prepare.outputs.ccachedir }}
key: ${{ steps.ccache-prepare.outputs.key }}

- name: check
run: |
cd ${GITHUB_WORKSPACE}/build
PATH="${GITHUB_WORKSPACE}/bin;${GITHUB_WORKSPACE}/dependencies/bin;C:/msys64/ucrt64/bin;${PATH}" \
ctest -C Release . || ctest -C Release . --rerun-failed --output-on-failure
- name: install
run: |
printf "\033[0;32m==>\033[0m Installing libraries\n"
Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -383,3 +383,12 @@ endif ( )
#-------------------------------------------------------------------------------

include ( SuiteSparseReport )

#-------------------------------------------------------------------------------
# enable testing facilities
#-------------------------------------------------------------------------------

# Currently, only LAGraph and Mongoose have ctests.
# FIXME: Consider converting (some of) the existing demos to ctests.

enable_testing ( )
2 changes: 1 addition & 1 deletion LAGraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ endif ( )

message ( STATUS "CMAKE build type: " ${CMAKE_BUILD_TYPE} )
message ( STATUS "CMAKE source directory: " ${PROJECT_SOURCE_DIR} )
message ( STATUS "CMAKE build directory: " ${CMAKE_BINARY_DIR} )
message ( STATUS "CMAKE build directory: " ${PROJECT_BINARY_DIR} )

if ( ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
message ( STATUS "CMAKE C Flags debug: " ${CMAKE_C_FLAGS_DEBUG} )
Expand Down
2 changes: 1 addition & 1 deletion LAGraph/experimental/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ SET_TARGET_PROPERTIES ( LAGraphX PROPERTIES
C_STANDARD_REQUIRED ON
C_STANDARD 11
PUBLIC_HEADER "include/LAGraphX.h"
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/dlls )
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/dlls )
target_link_libraries ( LAGraphX PRIVATE LAGraph GraphBLAS::GraphBLAS )

target_include_directories ( LAGraphX PUBLIC
Expand Down
8 changes: 4 additions & 4 deletions LAGraph/experimental/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ SET_TARGET_PROPERTIES ( lagraphxtest PROPERTIES
SOVERSION ${LAGraph_VERSION_MAJOR}
C_STANDARD_REQUIRED ON
C_STANDARD 11
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/dlls )
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/dlls )
target_link_libraries ( lagraphxtest PRIVATE LAGraph lagraphtest GraphBLAS::GraphBLAS )
target_compile_definitions ( lagraphxtest PRIVATE LGX_TEST_LIBRARY )
target_compile_definitions ( lagraphxtest PUBLIC LGX_TEST_DLL )
Expand Down Expand Up @@ -90,12 +90,12 @@ foreach( testsourcefile ${TEST_SOURCES} )
C_STANDARD_REQUIRED ON
C_STANDARD 11 )
target_link_libraries( ${testname} LAGraphX LAGraph lagraphxtest lagraphtest GraphBLAS::GraphBLAS )
string( REPLACE "test_" "ctest_" ctestname ${testname})
add_test( ${ctestname} ${testname} )
string( REPLACE "test_" "LAGraphX_" ctestname ${testname})
add_test( NAME ${ctestname} COMMAND $<TARGET_FILE:${testname}> )
# add_test( NAME ${ctestname} COMMAND valgrind $<TARGET_FILE:${testname}> )
if (WIN32)
set_tests_properties ( ${ctestname} PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${CMAKE_BINARY_DIR}/dlls" )
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:SuiteSparse::GraphBLAS>;PATH=path_list_prepend:$<TARGET_FILE_DIR:lagraphxtest>" )
endif ( )
endforeach( testsourcefile ${TEST_SOURCES} )

2 changes: 1 addition & 1 deletion LAGraph/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SET_TARGET_PROPERTIES ( LAGraph PROPERTIES
C_STANDARD_REQUIRED ON
C_STANDARD 11
PUBLIC_HEADER "include/LAGraph.h"
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/dlls )
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/dlls )
target_link_libraries ( LAGraph PRIVATE GraphBLAS::GraphBLAS ${M_LIB} )

target_include_directories ( LAGraph PUBLIC
Expand Down
8 changes: 4 additions & 4 deletions LAGraph/src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SET_TARGET_PROPERTIES ( lagraphtest PROPERTIES
SOVERSION ${LAGraph_VERSION_MAJOR}
C_STANDARD_REQUIRED ON
C_STANDARD 11
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/dlls )
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/dlls )
target_link_libraries ( lagraphtest PRIVATE LAGraph GraphBLAS::GraphBLAS )
target_compile_definitions ( lagraphtest PRIVATE LG_TEST_LIBRARY )
target_compile_definitions ( lagraphtest PUBLIC LG_TEST_DLL )
Expand Down Expand Up @@ -91,12 +91,12 @@ foreach( testsourcefile ${TEST_SOURCES} )
C_STANDARD_REQUIRED ON
C_STANDARD 11 )
target_link_libraries( ${testname} LAGraph LAGraphX lagraphtest GraphBLAS::GraphBLAS )
string( REPLACE "test_" "ctest_" ctestname ${testname})
add_test( ${ctestname} ${testname} )
string( REPLACE "test_" "LAGraph_" ctestname ${testname})
add_test( NAME ${ctestname} COMMAND $<TARGET_FILE:${testname}> )
# add_test( NAME ${ctestname} COMMAND valgrind $<TARGET_FILE:${testname}> )
if (WIN32)
set_tests_properties ( ${ctestname} PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${CMAKE_BINARY_DIR}/dlls" )
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:SuiteSparse::GraphBLAS>;PATH=path_list_prepend:$<TARGET_FILE_DIR:lagraphtest>" )
endif ( )
endforeach( testsourcefile ${TEST_SOURCES} )

53 changes: 27 additions & 26 deletions Mongoose/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,12 @@ if ( Python_Interpreter_FOUND )
set_target_properties ( mongoose_test_io PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${TESTING_OUTPUT_PATH} )

add_test ( NAME IO_Test
add_test ( NAME Mongoose_IO_Test
COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/Tests/runTests -min 1 -max 15 -t io -k )

if (WIN32)
set_tests_properties ( IO_Test PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${PROJECT_BINARY_DIR}" )
if ( WIN32 )
set_tests_properties ( Mongoose_IO_Test PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:Mongoose>" )
endif ( )

# Edge Separator Tests
Expand All @@ -324,18 +324,18 @@ if ( Python_Interpreter_FOUND )
set_target_properties ( mongoose_test_edgesep PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${TESTING_OUTPUT_PATH} )

add_test ( NAME Edge_Separator_Test
add_test ( NAME Mongoose_Edge_Separator_Test
COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/Tests/runTests -min 1 -max 15 -t edgesep )
add_test ( NAME Edge_Separator_Test_2
add_test ( NAME Mongoose_Edge_Separator_Test_2
COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/Tests/runTests -t edgesep -i 21 39 191 1557 1562 353 2468 1470 1380 505 182 201 2331 760 1389 2401 2420 242 250 1530 1533 360 1437 )
add_test ( NAME Weighted_Edge_Separator_Test
add_test ( NAME Mongoose_Weighted_Edge_Separator_Test
COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/Tests/runTests -t edgesep -i 2624 )
add_test ( NAME Target_Split_Test
add_test ( NAME Mongoose_Target_Split_Test
COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/Tests/runTests -min 1 -max 15 -t edgesep -s 0.3 )

if (WIN32)
set_tests_properties ( Edge_Separator_Test Edge_Separator_Test_2 Weighted_Edge_Separator_Test Target_Split_Test PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${PROJECT_BINARY_DIR}" )
if ( WIN32 )
set_tests_properties ( Mongoose_Edge_Separator_Test Mongoose_Edge_Separator_Test_2 Mongoose_Weighted_Edge_Separator_Test Mongoose_Target_Split_Test PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:Mongoose>" )
endif ( )

# Memory Tests
Expand All @@ -346,12 +346,12 @@ if ( Python_Interpreter_FOUND )
set_target_properties ( mongoose_test_memory PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${TESTING_OUTPUT_PATH} )

add_test ( NAME Memory_Test
add_test ( NAME Mongoose_Memory_Test
COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/Tests/runTests -min 1 -max 15 -t memory )

if (WIN32)
set_tests_properties ( Memory_Test PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${PROJECT_BINARY_DIR}" )
if ( WIN32 )
set_tests_properties ( Mongoose_Memory_Test PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:Mongoose>" )
endif ( )

# Performance Test
Expand All @@ -371,14 +371,14 @@ if ( Python_Interpreter_FOUND )
set_target_properties ( mongoose_test_performance PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${TESTING_OUTPUT_PATH} )

add_test ( NAME Performance_Test
add_test ( NAME Mongoose_Performance_Test
COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/Tests/runTests -min 1 -max 15 -t performance -p )
add_test ( NAME Performance_Test_2
add_test ( NAME Mongoose_Performance_Test_2
COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/Tests/runTests -t performance -i 21 39 1557 1562 353 2468 1470 1380 505 182 201 2331 760 1389 2401 2420 242 250 1530 1533 -p )

if (WIN32)
set_tests_properties ( Performance_Test Performance_Test_2 PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${PROJECT_BINARY_DIR}" )
if ( WIN32 )
set_tests_properties ( Mongoose_Performance_Test Mongoose_Performance_Test_2 PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:Mongoose>" )
endif ( )
endif ( )

Expand All @@ -403,28 +403,29 @@ add_executable ( mongoose_unit_test_io
Tests/Mongoose_UnitTest_IO_exe.cpp )
target_link_libraries ( mongoose_unit_test_io Mongoose_static_dbg )
set_target_properties ( mongoose_unit_test_io PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTING_OUTPUT_PATH} )
add_test ( NAME Unit_Test_IO
COMMAND ${TESTING_OUTPUT_PATH}/mongoose_unit_test_io )
add_test ( NAME Mongoose_Unit_Test_IO
COMMAND ${TESTING_OUTPUT_PATH}/mongoose_unit_test_io
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/Tests )

add_executable ( mongoose_unit_test_graph
Tests/Mongoose_UnitTest_Graph_exe.cpp )
target_link_libraries ( mongoose_unit_test_graph Mongoose_static_dbg )
set_target_properties ( mongoose_unit_test_graph PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTING_OUTPUT_PATH} )
add_test ( NAME Unit_Test_Graph
add_test ( NAME Mongoose_Unit_Test_Graph
COMMAND ${TESTING_OUTPUT_PATH}/mongoose_unit_test_graph
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/Tests )

add_executable ( mongoose_unit_test_edgesep
Tests/Mongoose_UnitTest_EdgeSep_exe.cpp )
target_link_libraries ( mongoose_unit_test_edgesep Mongoose_static_dbg )
set_target_properties ( mongoose_unit_test_edgesep PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTING_OUTPUT_PATH} )
add_test ( NAME Unit_Test_EdgeSep
add_test ( NAME Mongoose_Unit_Test_EdgeSep
COMMAND ${TESTING_OUTPUT_PATH}/mongoose_unit_test_edgesep
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/Tests )

if (WIN32)
set_tests_properties ( Unit_Test_IO Unit_Test_Graph Unit_Test_EdgeSep PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${PROJECT_BINARY_DIR}" )
set_tests_properties ( Mongoose_Unit_Test_IO Mongoose_Unit_Test_Graph Mongoose_Unit_Test_EdgeSep PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:Mongoose>" )
endif ( )

if ( $ENV{MONGOOSE_COVERAGE} )
Expand Down

0 comments on commit 133ca08

Please sign in to comment.