diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/FindBLAS/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindBLAS/Test/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/FindBLAS/Test/main.c | 14 | ||||
-rw-r--r-- | Tests/FindLAPACK/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindLAPACK/Test/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/FindLAPACK/Test/main.c | 20 | ||||
-rw-r--r-- | Tests/FindPython/CMakeLists.txt | 23 | ||||
-rw-r--r-- | Tests/FindPython/Implementation/CMakeLists.txt | 37 | ||||
-rw-r--r-- | Tests/FindPython/IronPython/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/FindPython/IronPython2/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/include/foo_C.h | 1 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/include/foo_CXX.h | 1 |
15 files changed, 168 insertions, 4 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5b3d2b4..5011863 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1414,6 +1414,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH foreach(_mod IN ITEMS ALSA Boost + BLAS BZip2 CURL Cups @@ -1433,6 +1434,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH ICU JPEG JsonCpp + LAPACK LibArchive LibLZMA LibRHash diff --git a/Tests/FindBLAS/CMakeLists.txt b/Tests/FindBLAS/CMakeLists.txt new file mode 100644 index 0000000..667195d --- /dev/null +++ b/Tests/FindBLAS/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindBLAS.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindBLAS/Test" + "${CMake_BINARY_DIR}/Tests/FindBLAS/Test" + ${build_generator_args} + --build-project TestFindBLAS + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindBLAS/Test/CMakeLists.txt b/Tests/FindBLAS/Test/CMakeLists.txt new file mode 100644 index 0000000..59418f3 --- /dev/null +++ b/Tests/FindBLAS/Test/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindBLAS C) +include(CTest) + +find_package(BLAS REQUIRED) + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt BLAS::BLAS) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_link_libraries(test_var PRIVATE ${BLAS_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindBLAS/Test/main.c b/Tests/FindBLAS/Test/main.c new file mode 100644 index 0000000..7360dee --- /dev/null +++ b/Tests/FindBLAS/Test/main.c @@ -0,0 +1,14 @@ +#include <assert.h> +#include <string.h> + +// declare what parts of the blas C-API we need +void cblas_dswap(const int N, double* X, const int incX, double* Y, + const int incY); + +int main() +{ + double x[4] = { 1, 2, 3, 4 }; + double y[4] = { 8, 7, 7, 6 }; + cblas_dswap(4, x, 1, y, 1); + return 0; +} diff --git a/Tests/FindLAPACK/CMakeLists.txt b/Tests/FindLAPACK/CMakeLists.txt new file mode 100644 index 0000000..2081d59 --- /dev/null +++ b/Tests/FindLAPACK/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindLAPACK.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindLAPACK/Test" + "${CMake_BINARY_DIR}/Tests/FindLAPACK/Test" + ${build_generator_args} + --build-project TestFindLAPACK + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindLAPACK/Test/CMakeLists.txt b/Tests/FindLAPACK/Test/CMakeLists.txt new file mode 100644 index 0000000..8afa36a --- /dev/null +++ b/Tests/FindLAPACK/Test/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindLAPACK C) +include(CTest) + +find_package(LAPACK REQUIRED) + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt LAPACK::LAPACK) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_link_libraries(test_var PRIVATE ${LAPACK_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindLAPACK/Test/main.c b/Tests/FindLAPACK/Test/main.c new file mode 100644 index 0000000..5873e7b --- /dev/null +++ b/Tests/FindLAPACK/Test/main.c @@ -0,0 +1,20 @@ +#include <assert.h> +#include <string.h> + +// declare what parts of the lapack C-API we need +void dgesv_(int*, int*, double*, int*, int*, double*, int*, int*); + +int main() +{ + double A[8] = { + 0, 1, 2, 3, 4, 5, 6, 7, + }; + double B[2] = { 0, 5 }; + int ipiv[2] = { 0, 0 }; + int info = 0; + + int dim = 2; + int numCols = 1; + dgesv_(&dim, &numCols, A, &dim, ipiv, B, &dim, &info); + return 0; +} diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index c72b5e2..072a993 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -314,6 +314,29 @@ if(CMake_TEST_FindPython_Conda) ) endif() +if (CMake_TEST_FindPython AND CMake_TEST_FindPython_IronPython) + add_test(NAME FindPython.Implementation.CPython COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Implementation" + "${CMake_BINARY_DIR}/Tests/FindPython/Implementation.CPython" + ${build_generator_args} + --build-project TestImplementationCPython + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_REQUESTED_IMPLEMENTATIONS=CPython + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Implementation.IronPython COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Implementation" + "${CMake_BINARY_DIR}/Tests/FindPython/Implementation.IronPython" + ${build_generator_args} + --build-project TestImplementationIronPython + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_REQUESTED_IMPLEMENTATION=IronPython + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +endif() + if(CMake_TEST_FindPython_IronPython) add_test(NAME FindPython.IronPython2.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> diff --git a/Tests/FindPython/Implementation/CMakeLists.txt b/Tests/FindPython/Implementation/CMakeLists.txt new file mode 100644 index 0000000..d64fa1e --- /dev/null +++ b/Tests/FindPython/Implementation/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestImplementation${Python_REQUESTED_IMPLEMENTATION} C) + + +set (Python${Python_REQUESTED_VERSION}_FIND_IMPLEMENTATIONS ${Python_REQUESTED_IMPLEMENTATION}) + +find_package(Python${Python_REQUESTED_VERSION} COMPONENTS Interpreter) +if (NOT Python${Python_REQUESTED_VERSION}_FOUND OR NOT Python${Python_REQUESTED_VERSION}_Interpreter_FOUND) + message (FATAL_ERROR "Fail to found Python${Python_REQUESTED_VERSION}") +endif() + +if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython" + AND NOT Python${Python_REQUESTED_VERSION}_INTERPRETER_ID STREQUAL "IronPython") + message (FATAL_ERROR "Erroneous interpreter ID (${Python${Python_REQUESTED_VERSION}_INTERPRETER_ID})") +endif() +if (Python_REQUESTED_IMPLEMENTATION STREQUAL "CPython" + AND Python${Python_REQUESTED_VERSION}_INTERPRETER_ID STREQUAL "IronPython") + message (FATAL_ERROR "Erroneous interpreter ID (${Python${Python_REQUESTED_VERSION}_INTERPRETER_ID})") +endif() + + +set (Python_FIND_IMPLEMENTATIONS ${Python_REQUESTED_IMPLEMENTATION}) + +find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter) +if (NOT Python_FOUND OR NOT Python_Interpreter_FOUND) + message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}") +endif() + +if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython" + AND NOT Python_INTERPRETER_ID STREQUAL "IronPython") + message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})") +endif() +if (Python_REQUESTED_IMPLEMENTATION STREQUAL "CPython" + AND Python_INTERPRETER_ID STREQUAL "IronPython") + message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})") +endif() diff --git a/Tests/FindPython/IronPython/CMakeLists.txt b/Tests/FindPython/IronPython/CMakeLists.txt index c96a3e0..3493c29 100644 --- a/Tests/FindPython/IronPython/CMakeLists.txt +++ b/Tests/FindPython/IronPython/CMakeLists.txt @@ -2,11 +2,20 @@ cmake_minimum_required(VERSION 3.1) project(TestIronPython C) -find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter Compiler) +set (Python_FIND_IMPLEMENTATIONS IronPython) + +find_package(Python ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Compiler) if (NOT Python_FOUND) message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}") endif() +if (NOT Python_Interpreter_FOUND) + message (FATAL_ERROR "Fail to found Python Interpreter") +endif() +if (NOT Python_INTERPRETER_ID STREQUAL "IronPython") + message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})") +endif() + if (NOT Python_Compiler_FOUND) message (FATAL_ERROR "Fail to found Python Compiler") endif() diff --git a/Tests/FindPython/IronPython2/CMakeLists.txt b/Tests/FindPython/IronPython2/CMakeLists.txt index 43ec309..1db798c 100644 --- a/Tests/FindPython/IronPython2/CMakeLists.txt +++ b/Tests/FindPython/IronPython2/CMakeLists.txt @@ -2,11 +2,20 @@ cmake_minimum_required(VERSION 3.1) project(TestIronPython2 C) -find_package(Python2 REQUIRED COMPONENTS Interpreter Compiler) +set (Python2_FIND_IMPLEMENTATIONS "IronPython") + +find_package(Python2 COMPONENTS Interpreter Compiler) if (NOT Python2_FOUND) message (FATAL_ERROR "Fail to found Python 2") endif() +if (NOT Python2_Interpreter_FOUND) + message (FATAL_ERROR "Fail to found Python 2 Interpreter") +endif() +if (NOT Python2_INTERPRETER_ID STREQUAL "IronPython") + message (FATAL_ERROR "Erroneous interpreter ID (${Python2_INTERPRETER_ID})") +endif() + if (NOT Python2_Compiler_FOUND) message (FATAL_ERROR "Fail to found Python 2 Compiler") endif() diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake index 1696037..3119341 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake @@ -17,14 +17,14 @@ endif() file(STRINGS ${foobar_pch_h_header} foobar_pch_h_header_strings) -if (NOT foobar_pch_h_header_strings MATCHES ";#include <stddef.h>(;|$)") +if (NOT foobar_pch_h_header_strings MATCHES ";#include \"[^\"]*PrecompileHeaders/include/foo_C.h\";#include <stddef.h>(;|$)") set(RunCMake_TEST_FAILED "Generated foo pch header\n ${foobar_pch_h_header}\nhas bad content:\n ${foobar_pch_h_header_strings}") return() endif() file(STRINGS ${foobar_pch_hxx_header} foobar_pch_hxx_header_strings) -if (NOT foobar_pch_hxx_header_strings MATCHES ";#include <cstddef>(;|$)") +if (NOT foobar_pch_hxx_header_strings MATCHES ";#include \"[^\"]*PrecompileHeaders/include/foo_CXX.h\";#include <cstddef>(;|$)") set(RunCMake_TEST_FAILED "Generated foo pch header\n ${foobar_pch_hxx_header}\nhas bad content:\n ${foobar_pch_hxx_header_strings}") return() endif() diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake index cdc42b2..bb18a64 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake @@ -7,6 +7,8 @@ add_executable(foobar ) target_include_directories(foobar PUBLIC include) target_precompile_headers(foobar PRIVATE + "$<$<COMPILE_LANGUAGE:C>:${CMAKE_CURRENT_SOURCE_DIR}/include/foo_C.h>" + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/include/foo_CXX.h>" "$<$<COMPILE_LANGUAGE:C>:<stddef.h$<ANGLE-R>>" "$<$<COMPILE_LANGUAGE:CXX>:<cstddef$<ANGLE-R>>" ) diff --git a/Tests/RunCMake/PrecompileHeaders/include/foo_C.h b/Tests/RunCMake/PrecompileHeaders/include/foo_C.h new file mode 100644 index 0000000..f4de601 --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/include/foo_C.h @@ -0,0 +1 @@ +#include "foo.h" diff --git a/Tests/RunCMake/PrecompileHeaders/include/foo_CXX.h b/Tests/RunCMake/PrecompileHeaders/include/foo_CXX.h new file mode 100644 index 0000000..f4de601 --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/include/foo_CXX.h @@ -0,0 +1 @@ +#include "foo.h" |