Run mlapack_test through ctest
The 'test' target is reserved to ctest and we avoid this cmake warning:
CMake Warning (dev) at src/mlpack/CMakeLists.txt:87 (add_custom_target):
Policy CMP0037 is not set: Target names should not be reserved and should
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
The target name "test" is reserved or not valid for certain CMake features,
such as generator expressions, and may result in undefined behavior.
This warning is for project developers. Use -Wno-dev to suppress it.
Using ctest over a custom target has also the advantage of allowing to use an
interpreter when cross-compiling.
Now this looks like this:
$ make test
Running tests...
Test project /home/xantares/projects/mlpack/build
Start 1: mlpack_test
1/1 Test #1: mlpack_test ...................... Passed 529.50 sec
100% tests passed, 0 tests failed out of 1
Total Test time (real) = 529.53 sec
Ctest can also be used directly with a timeout:
```ctest --output-on-failure --timeout 1800```
instead of
```travis_wait 30 ./bin/mlpack_test -p```
This commit is contained in:
@@ -17,6 +17,8 @@ option(ARMA_EXTRA_DEBUG "Compile with extra Armadillo debugging symbols." OFF)
|
||||
option(MATLAB_BINDINGS "Compile MATLAB bindings if MATLAB is found." OFF)
|
||||
option(TEST_VERBOSE "Run test cases with verbose output." OFF)
|
||||
|
||||
enable_testing ()
|
||||
|
||||
# Include modules in the CMake directory.
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake")
|
||||
|
||||
|
||||
@@ -82,10 +82,3 @@ install(TARGETS mlpack
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
add_dependencies(mlpack mlpack_headers)
|
||||
|
||||
# For 'make test'.
|
||||
add_custom_target(test
|
||||
${CMAKE_BINARY_DIR}/bin/mlpack_test "--log_level=test_suite" # Set UTF runtime param
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/ # This is where test files are put.
|
||||
COMMENT "Running mlpack test"
|
||||
DEPENDS mlpack_test)
|
||||
|
||||
@@ -94,3 +94,9 @@ add_custom_command(TARGET mlpack_test
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xjpf mnist_first250_training_4s_and_9s.tar.bz2
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
# For 'make test'.
|
||||
add_test (NAME mlpack_test
|
||||
COMMAND mlpack_test "--log_level=test_suite" # Set UTF runtime param
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/ # This is where test files are put.
|
||||
)
|
||||
Reference in New Issue
Block a user