From 8ea96c3ff574d189c8cf4151b75e5eca5e9704db Mon Sep 17 00:00:00 2001 From: wo80 Date: Tue, 8 Aug 2023 12:18:12 +0200 Subject: [PATCH 1/7] Replace tab stops by spaces in TESTING/CMakeLists.txt --- TESTING/CMakeLists.txt | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/TESTING/CMakeLists.txt b/TESTING/CMakeLists.txt index 82c8e46c..66decf60 100644 --- a/TESTING/CMakeLists.txt +++ b/TESTING/CMakeLists.txt @@ -31,14 +31,14 @@ function(add_superlu_test output input target) foreach (s ${NRHS}) foreach(l ${LWORK}) set(testName "${target}_${n}_${s}_${l}") - set(SINGLE_OUTPUT ${SuperLU_BINARY_DIR}/TESTING/${testName}.out) + set(SINGLE_OUTPUT ${SuperLU_BINARY_DIR}/TESTING/${testName}.out) add_test( ${testName}_LA "${CMAKE_COMMAND}" - -DTEST=${TEST_LOC} -t "LA" -n ${n} -s ${s} -l ${l} - -DOUTPUT=${SINGLE_OUTPUT} - -DALL_OUTPUT=${TEST_OUTPUT} - -DHEADING=Dense\ matrix\ --\ n=${n},\ s=${s},\ lwork=${l} - -P "${SuperLU_SOURCE_DIR}/TESTING/runtest.cmake" - ) + -DTEST=${TEST_LOC} -t "LA" -n ${n} -s ${s} -l ${l} + -DOUTPUT=${SINGLE_OUTPUT} + -DALL_OUTPUT=${TEST_OUTPUT} + -DHEADING=Dense\ matrix\ --\ n=${n},\ s=${s},\ lwork=${l} + -P "${SuperLU_SOURCE_DIR}/TESTING/runtest.cmake" + ) endforeach() endforeach() endforeach() @@ -46,16 +46,16 @@ function(add_superlu_test output input target) # file(APPEND ${TEST_OUTPUT} "== sparse matrix\n") foreach (s ${NRHS}) - foreach(l ${LWORK}) - set(testName "${target}_${s}_${l}") - set(SINGLE_OUTPUT ${SuperLU_BINARY_DIR}/TESTING/${testName}.out) - add_test( ${testName}_SP "${CMAKE_COMMAND}" - -DTEST=${TEST_LOC} -t "SP" -s ${s} -l ${l} -f ${TEST_INPUT} - -DOUTPUT=${SINGLE_OUTPUT} - -DALL_OUTPUT=${TEST_OUTPUT} - -DHEADING=Sparse\ matrix\ ${TEST_INPUT}\ --\ s=${s},\ lwork=${l} - -P "${SuperLU_SOURCE_DIR}/TESTING/runtest.cmake") - endforeach() + foreach(l ${LWORK}) + set(testName "${target}_${s}_${l}") + set(SINGLE_OUTPUT ${SuperLU_BINARY_DIR}/TESTING/${testName}.out) + add_test( ${testName}_SP "${CMAKE_COMMAND}" + -DTEST=${TEST_LOC} -t "SP" -s ${s} -l ${l} -f ${TEST_INPUT} + -DOUTPUT=${SINGLE_OUTPUT} + -DALL_OUTPUT=${TEST_OUTPUT} + -DHEADING=Sparse\ matrix\ ${TEST_INPUT}\ --\ s=${s},\ lwork=${l} + -P "${SuperLU_SOURCE_DIR}/TESTING/runtest.cmake") + endforeach() endforeach() endfunction(add_superlu_test) From 497cb412bacb21aec8e35c4a0250b9142cc8e6d4 Mon Sep 17 00:00:00 2001 From: wo80 Date: Tue, 8 Aug 2023 12:18:12 +0200 Subject: [PATCH 2/7] Remove variable ALINTST from TESTING The variable only containts a single C file, it does not simplify the code, but make it more complicated without any benefit. --- TESTING/CMakeLists.txt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/TESTING/CMakeLists.txt b/TESTING/CMakeLists.txt index 66decf60..fa7398fa 100644 --- a/TESTING/CMakeLists.txt +++ b/TESTING/CMakeLists.txt @@ -5,7 +5,6 @@ set(test_link_libs matgen) add_subdirectory(MATGEN) -set(ALINTST sp_ienv.c) set(NVAL 9 19) set(NRHS 2) set(LWORK 0 10000000) @@ -62,9 +61,9 @@ endfunction(add_superlu_test) if(enable_single) - set(SLINTST sdrive.c sp_sconvert.c sgst01.c sgst02.c sgst04.c sgst07.c) + set(SLINTST sdrive.c sp_ienv.c sp_sconvert.c sgst01.c sgst02.c sgst04.c sgst07.c) - add_executable(s_test ${ALINTST} ${SLINTST}) + add_executable(s_test ${SLINTST}) target_link_libraries(s_test ${test_link_libs}) if(MSVC) @@ -78,9 +77,9 @@ endif() if(enable_double) - set(DLINTST ddrive.c sp_dconvert.c dgst01.c dgst02.c dgst04.c dgst07.c) + set(DLINTST ddrive.c sp_ienv.c sp_dconvert.c dgst01.c dgst02.c dgst04.c dgst07.c) - add_executable(d_test ${ALINTST} ${DLINTST}) + add_executable(d_test ${DLINTST}) target_link_libraries(d_test ${test_link_libs}) if(MSVC) @@ -92,9 +91,9 @@ if(enable_double) endif() if(enable_complex) - set(CLINTST cdrive.c sp_cconvert.c cgst01.c cgst02.c cgst04.c cgst07.c) + set(CLINTST cdrive.c sp_ienv.c sp_cconvert.c cgst01.c cgst02.c cgst04.c cgst07.c) - add_executable(c_test ${ALINTST} ${CLINTST}) + add_executable(c_test ${CLINTST}) target_link_libraries(c_test ${test_link_libs}) if(MSVC) @@ -107,9 +106,9 @@ endif() if(enable_complex16) - set(ZLINTST zdrive.c sp_zconvert.c zgst01.c zgst02.c zgst04.c zgst07.c) + set(ZLINTST zdrive.c sp_ienv.c sp_zconvert.c zgst01.c zgst02.c zgst04.c zgst07.c) - add_executable(z_test ${ALINTST} ${ZLINTST}) + add_executable(z_test ${ZLINTST}) target_link_libraries(z_test ${test_link_libs}) if(MSVC) From 44548be464c1d1f5b213d338173761f0efad7214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= Date: Sat, 12 Aug 2023 22:21:39 +0200 Subject: [PATCH 3/7] Add source files to tests directly without variable The varialbes (C|D|S|Z)LINTST only added an indirectection without any benefit. --- TESTING/CMakeLists.txt | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/TESTING/CMakeLists.txt b/TESTING/CMakeLists.txt index fa7398fa..55643c69 100644 --- a/TESTING/CMakeLists.txt +++ b/TESTING/CMakeLists.txt @@ -61,9 +61,9 @@ endfunction(add_superlu_test) if(enable_single) - set(SLINTST sdrive.c sp_ienv.c sp_sconvert.c sgst01.c sgst02.c sgst04.c sgst07.c) - - add_executable(s_test ${SLINTST}) + add_executable(s_test + sdrive.c sgst01.c sgst02.c sgst04.c sgst07.c + sp_ienv.c sp_sconvert.c) target_link_libraries(s_test ${test_link_libs}) if(MSVC) @@ -72,14 +72,13 @@ if(enable_single) endif() add_superlu_test(s_test.out g20.rua s_test) - endif() if(enable_double) - set(DLINTST ddrive.c sp_ienv.c sp_dconvert.c dgst01.c dgst02.c dgst04.c dgst07.c) - - add_executable(d_test ${DLINTST}) + add_executable(d_test + ddrive.c dgst01.c dgst02.c dgst04.c dgst07.c + sp_ienv.c sp_dconvert.c) target_link_libraries(d_test ${test_link_libs}) if(MSVC) @@ -91,9 +90,9 @@ if(enable_double) endif() if(enable_complex) - set(CLINTST cdrive.c sp_ienv.c sp_cconvert.c cgst01.c cgst02.c cgst04.c cgst07.c) - - add_executable(c_test ${CLINTST}) + add_executable(c_test + cdrive.c cgst01.c cgst02.c cgst04.c cgst07.c + sp_ienv.c sp_cconvert.c) target_link_libraries(c_test ${test_link_libs}) if(MSVC) @@ -106,9 +105,9 @@ endif() if(enable_complex16) - set(ZLINTST zdrive.c sp_ienv.c sp_zconvert.c zgst01.c zgst02.c zgst04.c zgst07.c) - - add_executable(z_test ${ZLINTST}) + add_executable(z_test + zdrive.c zgst01.c zgst02.c zgst04.c zgst07.c + sp_ienv.c sp_zconvert.c) target_link_libraries(z_test ${test_link_libs}) if(MSVC) From 54803a7276526a3a1825e10e6f84e49b9787c559 Mon Sep 17 00:00:00 2001 From: wo80 Date: Tue, 8 Aug 2023 12:18:12 +0200 Subject: [PATCH 4/7] Remove unused function cat from TESTING/CMakeLists.txt --- TESTING/CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/TESTING/CMakeLists.txt b/TESTING/CMakeLists.txt index 55643c69..57782357 100644 --- a/TESTING/CMakeLists.txt +++ b/TESTING/CMakeLists.txt @@ -9,12 +9,6 @@ set(NVAL 9 19) set(NRHS 2) set(LWORK 0 10000000) -function(cat IN_FILE OUT_FILE) - file(READ ${IN_FILE} CONTENTS) - file(APPEND ${OUT_FILE} "${CONTENTS}") -endfunction() - - function(add_superlu_test output input target) set(TEST_INPUT "${SuperLU_SOURCE_DIR}/EXAMPLE/${input}") set(TEST_OUTPUT "${SuperLU_BINARY_DIR}/TESTING/${output}") From c2775ebff82ed148476b746ec12af06aa3212d4b Mon Sep 17 00:00:00 2001 From: wo80 Date: Tue, 8 Aug 2023 12:18:12 +0200 Subject: [PATCH 5/7] Simplify add_superlu_test Drop handling of output, ctest offers everything needed, everything else should not be part of tests. Remove runtest.cmake, as it is no longer needed. --- TESTING/CMakeLists.txt | 53 +++++++++++++----------------------------- TESTING/runtest.cmake | 9 ------- 2 files changed, 16 insertions(+), 46 deletions(-) delete mode 100644 TESTING/runtest.cmake diff --git a/TESTING/CMakeLists.txt b/TESTING/CMakeLists.txt index 57782357..2d2d6c69 100644 --- a/TESTING/CMakeLists.txt +++ b/TESTING/CMakeLists.txt @@ -11,43 +11,22 @@ set(LWORK 0 10000000) function(add_superlu_test output input target) set(TEST_INPUT "${SuperLU_SOURCE_DIR}/EXAMPLE/${input}") - set(TEST_OUTPUT "${SuperLU_BINARY_DIR}/TESTING/${output}") - - # Prepare a temporary file to "cat" to: - # "== LAPACK test matrices" - file(WRITE ${TEST_OUTPUT} "") - -## get_target_property(TEST_LOC ${target} LOCATION) - set(TEST_LOC ${CMAKE_CURRENT_BINARY_DIR}) - - foreach (n ${NVAL}) - foreach (s ${NRHS}) - foreach(l ${LWORK}) - set(testName "${target}_${n}_${s}_${l}") - set(SINGLE_OUTPUT ${SuperLU_BINARY_DIR}/TESTING/${testName}.out) - add_test( ${testName}_LA "${CMAKE_COMMAND}" - -DTEST=${TEST_LOC} -t "LA" -n ${n} -s ${s} -l ${l} - -DOUTPUT=${SINGLE_OUTPUT} - -DALL_OUTPUT=${TEST_OUTPUT} - -DHEADING=Dense\ matrix\ --\ n=${n},\ s=${s},\ lwork=${l} - -P "${SuperLU_SOURCE_DIR}/TESTING/runtest.cmake" - ) - endforeach() - endforeach() - endforeach() - -# file(APPEND ${TEST_OUTPUT} "== sparse matrix\n") foreach (s ${NRHS}) foreach(l ${LWORK}) + # LA tests + foreach (n ${NVAL}) + set(testName "${target}_${n}_${s}_${l}") + add_test( + NAME ${testName}_LA + COMMAND ${target} -t "LA" -n ${n} -s ${s} -l ${l}) + endforeach() + + # SP tests set(testName "${target}_${s}_${l}") - set(SINGLE_OUTPUT ${SuperLU_BINARY_DIR}/TESTING/${testName}.out) - add_test( ${testName}_SP "${CMAKE_COMMAND}" - -DTEST=${TEST_LOC} -t "SP" -s ${s} -l ${l} -f ${TEST_INPUT} - -DOUTPUT=${SINGLE_OUTPUT} - -DALL_OUTPUT=${TEST_OUTPUT} - -DHEADING=Sparse\ matrix\ ${TEST_INPUT}\ --\ s=${s},\ lwork=${l} - -P "${SuperLU_SOURCE_DIR}/TESTING/runtest.cmake") + add_test( + NAME ${testName}_SP + COMMAND ${target} -t "SP" -s ${s} -l ${l} -f "${TEST_INPUT}") endforeach() endforeach() @@ -65,7 +44,7 @@ if(enable_single) target_link_libraries(s_test ${WinGetOpt_LIBRARY}) endif() - add_superlu_test(s_test.out g20.rua s_test) + add_superlu_test(s_test g20.rua) endif() @@ -80,7 +59,7 @@ if(enable_double) target_link_libraries(d_test ${WinGetOpt_LIBRARY}) endif() - add_superlu_test(d_test.out g20.rua d_test) + add_superlu_test(d_test g20.rua) endif() if(enable_complex) @@ -94,7 +73,7 @@ if(enable_complex) target_link_libraries(c_test ${WinGetOpt_LIBRARY}) endif() - add_superlu_test(c_test.out cg20.cua c_test) + add_superlu_test(c_test cg20.cua) endif() @@ -109,5 +88,5 @@ if(enable_complex16) target_link_libraries(z_test ${WinGetOpt_LIBRARY}) endif() - add_superlu_test(z_test.out cg20.cua z_test) + add_superlu_test(z_test cg20.cua) endif() diff --git a/TESTING/runtest.cmake b/TESTING/runtest.cmake deleted file mode 100644 index 1ab16a2f..00000000 --- a/TESTING/runtest.cmake +++ /dev/null @@ -1,9 +0,0 @@ -# execute the test command that was added earlier. -execute_process( COMMAND "${TEST}" - OUTPUT_FILE "${OUTPUT}" - RESULT_VARIABLE RET ) -file(APPEND ${ALL_OUTPUT} ${HEADING}) -file(APPEND ${ALL_OUTPUT} "\n") -file(READ "${OUTPUT}" SINGLE_OUTPUT) -file(APPEND ${ALL_OUTPUT} "${SINGLE_OUTPUT}\n") -file(REMOVE ${OUTPUT}) # remove the individual output file. From 38deb3fa3b0af801e6066fda180708fe96c47078 Mon Sep 17 00:00:00 2001 From: wo80 Date: Tue, 8 Aug 2023 12:18:12 +0200 Subject: [PATCH 6/7] Move getopt dependency for MSVC compiler into test setup --- TESTING/CMakeLists.txt | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/TESTING/CMakeLists.txt b/TESTING/CMakeLists.txt index 2d2d6c69..9e9106e9 100644 --- a/TESTING/CMakeLists.txt +++ b/TESTING/CMakeLists.txt @@ -30,6 +30,12 @@ function(add_superlu_test output input target) endforeach() endforeach() + # Add getopt dependency to target in case of MSVC + if(MSVC) + target_include_directories(${target} PRIVATE ${WinGetOpt_INCLUDE_DIR}) + target_link_libraries(${target} ${WinGetOpt_LIBRARY}) + endif() + endfunction(add_superlu_test) @@ -38,12 +44,6 @@ if(enable_single) sdrive.c sgst01.c sgst02.c sgst04.c sgst07.c sp_ienv.c sp_sconvert.c) target_link_libraries(s_test ${test_link_libs}) - - if(MSVC) - target_include_directories(s_test PRIVATE ${WinGetOpt_INCLUDE_DIR}) - target_link_libraries(s_test ${WinGetOpt_LIBRARY}) - endif() - add_superlu_test(s_test g20.rua) endif() @@ -53,12 +53,6 @@ if(enable_double) ddrive.c dgst01.c dgst02.c dgst04.c dgst07.c sp_ienv.c sp_dconvert.c) target_link_libraries(d_test ${test_link_libs}) - - if(MSVC) - target_include_directories(d_test PRIVATE ${WinGetOpt_INCLUDE_DIR}) - target_link_libraries(d_test ${WinGetOpt_LIBRARY}) - endif() - add_superlu_test(d_test g20.rua) endif() @@ -67,12 +61,6 @@ if(enable_complex) cdrive.c cgst01.c cgst02.c cgst04.c cgst07.c sp_ienv.c sp_cconvert.c) target_link_libraries(c_test ${test_link_libs}) - - if(MSVC) - target_include_directories(c_test PRIVATE ${WinGetOpt_INCLUDE_DIR}) - target_link_libraries(c_test ${WinGetOpt_LIBRARY}) - endif() - add_superlu_test(c_test cg20.cua) endif() @@ -82,11 +70,5 @@ if(enable_complex16) zdrive.c zgst01.c zgst02.c zgst04.c zgst07.c sp_ienv.c sp_zconvert.c) target_link_libraries(z_test ${test_link_libs}) - - if(MSVC) - target_include_directories(z_test PRIVATE ${WinGetOpt_INCLUDE_DIR}) - target_link_libraries(z_test ${WinGetOpt_LIBRARY}) - endif() - add_superlu_test(z_test cg20.cua) endif() From 3e344c65e3a90c8e1d0fc448935a4e1d1c51173b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= Date: Sat, 12 Aug 2023 23:30:03 +0200 Subject: [PATCH 7/7] [readme] Remove description of output files for tests At least when using CMake this is gone. --- README | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README b/README index 720c1109..9011d8df 100644 --- a/README +++ b/README @@ -79,15 +79,9 @@ are described below. To install the library, type: make install - To run the installation test, type: + To run the regression tests, type: make test (or: ctest) - The test results are in the files below: - build/TESTING/s_test.out # single precision, real - build/TESTING/d_test.out # double precision, real - build/TESTING/c_test.out # single precision, complex - build/TESTING/z_test.out # double precision, complex - 2. Manual installation with makefile. Before installing the package, please examine the three things dependent