Building hdf5 using cmake/ctest takes a long time to run the 2553 tests. Is there a way to skip the tests when using the cmake
or ctest
command? Thanks!
Yes that is possible. For example use "ctest -R " to run the tests which satifies the regular expression . Another useful command is "ctest -E " which runs the tests which do not statify the specified regular expression. Furthermore, you can use “ctest --help” to find a more detailed explanation of the various ctest options. The mentioned commands are for Linux but I assume similar commands exist for MacOS and Windows.
If you are using the ctest script mode and our CTestScript.cmake file - yes there are multiple ways to accomplish skipping tests altogether. Or if you just want to run specific tests, see the previous post and the ctest --help. There are also configure options to not build any tests; BUILD_TESTING.
Thanks for the replies! I tried to uncomment the line
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF")
in HDF5options.cmake
previously for CMake-hdf5-1.10.5
, but cmake
terminated with an error message “No tests were found!!!” with an error code -1 (255). The error code caused my bash
script to terminate before calling make -C build install
(I have set -e
in my bash
script).
I also tried ctest -E '.*'
and it also caused ctest
to terminate with the same error message and an error code -1.
I guess my earlier question should be clarified that “is there a way for ctest
to terminate gracefully (without an error code) when disabling all the tests when building HDF5?”
It seems that the answer is negative. I now appended || true
after ctest
to circumvent the error code. The kernel of the build script now looks like
ctest -S HDF5config.cmake,BUILD_GENERATOR=Unix,INSTALLDIR=$INSTALLDIR -C Release -V -O hdf5.log || true
make -C build install
The || true
part is counterintuitive but is needed when running make -C build install
followed by ctest
with -e
set in a bash
script.
BTW, for HDF-4.2.15, uncommenting the line set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF")
in HDF4options.cmake
had no effect but ctest -E '.*'
does disable the tests (with an error code). Maybe there is a bug in CTestScript.cmake
of CMake-hdf-4.2.15
?
Using our scripts there is another way, Look at the HDF5config.cmake file around line 200 - uncomment LOCAL_SKIP_TEST line.
LOCAL_SKIP_TEST=TRUE
is exactly what I need for HDF5. No more error code from ctest
. Thanks!
This option was not available in CMake-hdf-4.2.15
, but the tests in hdf4 run very quickly.
That “LOCAL_SKIP_TEST” option is an option for our CTestScript.cmake file. It may not be in the options file for HDF4 but could be added the same as it exists in HDF5Options.cmake.