[mlpack-git] master: Run mlapack_test through ctest (4fa02a0)

gitdub at mlpack.org gitdub at mlpack.org
Fri Apr 15 08:03:39 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/0c945f3d36d92cc49dd2fde536530b40d3129d0a...698248845c4fca0303d1fda6adf9df3af2433a0c

>---------------------------------------------------------------

commit 4fa02a0e81a33416af7e73a4708625ea7d2f347a
Author: Michel Zou <xantares09 at hotmail.com>
Date:   Thu Apr 14 22:04:49 2016 +0200

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


>---------------------------------------------------------------

4fa02a0e81a33416af7e73a4708625ea7d2f347a
 CMakeLists.txt                  | 2 ++
 src/mlpack/CMakeLists.txt       | 7 -------
 src/mlpack/tests/CMakeLists.txt | 6 ++++++
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d018fb9..b5bf072 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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")
 
diff --git a/src/mlpack/CMakeLists.txt b/src/mlpack/CMakeLists.txt
index df77a6d..28e56ec 100644
--- a/src/mlpack/CMakeLists.txt
+++ b/src/mlpack/CMakeLists.txt
@@ -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)
diff --git a/src/mlpack/tests/CMakeLists.txt b/src/mlpack/tests/CMakeLists.txt
index 4a33625..e5b08b4 100644
--- a/src/mlpack/tests/CMakeLists.txt
+++ b/src/mlpack/tests/CMakeLists.txt
@@ -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.
+)
\ No newline at end of file




More information about the mlpack-git mailing list