improve the scripts for building unit tests:

* support unsupported/
* use egrep instead of grep, properly escape special chars.
This commit is contained in:
Benoit Jacob 2009-11-25 21:26:37 -05:00
parent f795681da0
commit 5923bcb1b9
8 changed files with 20 additions and 18 deletions

View File

@ -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"?

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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
./buildtests "$1" "$2" && ctest -R "$1"

View File

@ -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...

View File

@ -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)

View File

@ -1,8 +1,3 @@
include(EigenTesting)
enable_testing()
find_package(Adolc)
include_directories(../../test)