aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-11-25 21:26:37 -0500
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-11-25 21:26:37 -0500
commit5923bcb1b94cd5a79dfc57f2ffe6271d999ea67d (patch)
tree8b4d720e2e271a1d22b7d1eb3435846b284ec952
parentf795681da0fec9cd8a56f6987c903ec9a530d509 (diff)
improve the scripts for building unit tests:
* support unsupported/ * use egrep instead of grep, properly escape special chars.
-rw-r--r--CMakeLists.txt4
-rw-r--r--cmake/EigenTesting.cmake7
-rw-r--r--scripts/CMakeLists.txt3
-rwxr-xr-xscripts/buildtests.in (renamed from test/buildtests.in)7
-rwxr-xr-xscripts/check.in4
-rw-r--r--signature_of_eigen3_matrix_library2
-rw-r--r--test/CMakeLists.txt6
-rw-r--r--unsupported/test/CMakeLists.txt5
8 files changed, 20 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 33e7584c4..10c72ab38 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -152,6 +152,9 @@ add_subdirectory(doc EXCLUDE_FROM_ALL)
include(CTest)
enable_testing() # must be called from the root CMakeLists, see man page
+include(EigenTesting)
+ei_init_testing()
+
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest
else()
@@ -164,6 +167,7 @@ add_subdirectory(demos EXCLUDE_FROM_ALL)
add_subdirectory(blas EXCLUDE_FROM_ALL)
+# must be after test and unsupported, for configuring buildtests.in
add_subdirectory(scripts EXCLUDE_FROM_ALL)
# TODO: consider also replacing EIGEN_BUILD_BTL by a custom target "make btl"?
diff --git a/cmake/EigenTesting.cmake b/cmake/EigenTesting.cmake
index 43ae53cc1..ce567abc3 100644
--- a/cmake/EigenTesting.cmake
+++ b/cmake/EigenTesting.cmake
@@ -107,7 +107,10 @@ endmacro(ei_add_test_internal)
#
# Again, ctest -R allows to run all matching tests.
macro(ei_add_test testname)
- set(cmake_tests_list "${cmake_tests_list}${testname}\n")
+ get_property(EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST)
+ set(EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}${testname}\n")
+ set_property(GLOBAL PROPERTY EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}")
+
file(READ "${testname}.cpp" test_source)
set(parts 0)
string(REGEX MATCHALL "CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+"
@@ -204,10 +207,12 @@ macro(ei_init_testing)
define_property(GLOBAL PROPERTY EIGEN_TESTED_BACKENDS BRIEF_DOCS " " FULL_DOCS " ")
define_property(GLOBAL PROPERTY EIGEN_MISSING_BACKENDS BRIEF_DOCS " " FULL_DOCS " ")
define_property(GLOBAL PROPERTY EIGEN_TESTING_SUMMARY BRIEF_DOCS " " FULL_DOCS " ")
+ define_property(GLOBAL PROPERTY EIGEN_TESTS_LIST BRIEF_DOCS " " FULL_DOCS " ")
set_property(GLOBAL PROPERTY EIGEN_TESTED_BACKENDS "")
set_property(GLOBAL PROPERTY EIGEN_MISSING_BACKENDS "")
set_property(GLOBAL PROPERTY EIGEN_TESTING_SUMMARY "")
+ set_property(GLOBAL PROPERTY EIGEN_TESTS_LIST "")
endmacro(ei_init_testing)
if(CMAKE_COMPILER_IS_GNUCXX)
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index b75e99d5e..acf3bb6e9 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -1,3 +1,6 @@
+get_property(EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST)
+configure_file(buildtests.in ${CMAKE_BINARY_DIR}/buildtests)
+
configure_file(check.in ${CMAKE_BINARY_DIR}/check)
configure_file(debug.in ${CMAKE_BINARY_DIR}/debug)
configure_file(release.in ${CMAKE_BINARY_DIR}/release)
diff --git a/test/buildtests.in b/scripts/buildtests.in
index c24234930..1cc8e956f 100755
--- a/test/buildtests.in
+++ b/scripts/buildtests.in
@@ -3,12 +3,13 @@
if [ $# == 0 -o $# -ge 3 ]
then
echo "usage: ./buildtests regexp [jobs]"
- echo " makes tests matching the regexp, with <jobs> concurrent make jobs"
+ echo " makes tests matching the regexp, with [jobs] concurrent make jobs"
exit 0
fi
-TESTSLIST="${cmake_tests_list}"
-targets_to_make=`echo "$TESTSLIST" | grep "$1" | sed s/^/test_/g | xargs echo`
+TESTSLIST="${EIGEN_TESTS_LIST}"
+
+targets_to_make=`echo "$TESTSLIST" | egrep "$1" | sed s/^/test_/g | xargs echo`
if [ $# == 1 ]
then
diff --git a/scripts/check.in b/scripts/check.in
index 2a862fd80..ff3c96441 100755
--- a/scripts/check.in
+++ b/scripts/check.in
@@ -4,9 +4,9 @@
if [ $# == 0 -o $# -ge 3 ]
then
echo "usage: ./check regexp [jobs]"
- echo " makes and runs tests matching the regexp, with <jobs> concurrent make jobs"
+ echo " makes and runs tests matching the regexp, with [jobs] concurrent make jobs"
exit 0
fi
# TODO when ctest 2.8 comes out, honor the jobs parameter
-./buildtests $* && ctest -R $1 \ No newline at end of file
+./buildtests "$1" "$2" && ctest -R "$1"
diff --git a/signature_of_eigen3_matrix_library b/signature_of_eigen3_matrix_library
index 477732ef4..80aaf4621 100644
--- a/signature_of_eigen3_matrix_library
+++ b/signature_of_eigen3_matrix_library
@@ -1 +1 @@
-This file is just there as a signature to help identify directories containing Eigen3. When writing for a script looking for Eigen3, just look for this file. This is especially useful to help disambiguate with Eigen2...
+This file is just there as a signature to help identify directories containing Eigen3. When writing a script looking for Eigen3, just look for this file. This is especially useful to help disambiguate with Eigen2...
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index c91ec328b..ffe89915a 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -3,10 +3,6 @@ add_custom_target(buildtests)
add_custom_target(check COMMAND "ctest")
add_dependencies(check buildtests)
-
-include(EigenTesting)
-ei_init_testing()
-
option(EIGEN_SPLIT_LARGE_TESTS "Split large tests into smaller executables" ON)
find_package(GSL)
@@ -169,5 +165,3 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif(CMAKE_COMPILER_IS_GNUCXX)
ei_add_property(EIGEN_TESTING_SUMMARY "CXX_FLAGS: ${CMAKE_CXX_FLAGS}\n")
ei_add_property(EIGEN_TESTING_SUMMARY "Sparse lib flags: ${SPARSE_LIBS}\n")
-
-configure_file(buildtests.in ${CMAKE_BINARY_DIR}/buildtests)
diff --git a/unsupported/test/CMakeLists.txt b/unsupported/test/CMakeLists.txt
index 057c2026e..58af79351 100644
--- a/unsupported/test/CMakeLists.txt
+++ b/unsupported/test/CMakeLists.txt
@@ -1,8 +1,3 @@
-
-include(EigenTesting)
-
-enable_testing()
-
find_package(Adolc)
include_directories(../../test)