diff options
author | Julien Marrec <julien.marrec@gmail.com> | 2020-02-21 15:46:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-03-16 17:33:27 (GMT) |
commit | b00d736a0b47fee296e136fcd3511e51cb63468c (patch) | |
tree | 57cfbae9bf93d2f218a81da859679fc8d55afdb1 /Tests/FindRuby/CMakeLists.txt | |
parent | ffa08d256fa0aaa52afcb05b50f4d4a485d84171 (diff) | |
download | CMake-b00d736a0b47fee296e136fcd3511e51cb63468c.zip CMake-b00d736a0b47fee296e136fcd3511e51cb63468c.tar.gz CMake-b00d736a0b47fee296e136fcd3511e51cb63468c.tar.bz2 |
FindRuby: Add dedicated tests
Issue: #20370
Diffstat (limited to 'Tests/FindRuby/CMakeLists.txt')
-rw-r--r-- | Tests/FindRuby/CMakeLists.txt | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Tests/FindRuby/CMakeLists.txt b/Tests/FindRuby/CMakeLists.txt new file mode 100644 index 0000000..193cb4f --- /dev/null +++ b/Tests/FindRuby/CMakeLists.txt @@ -0,0 +1,44 @@ +if(CMake_TEST_FindRuby) + + # Looks for ruby >=1.9.9, which is true on any Ubuntu (that installs it) or macOS (> 10.9) + add_test(NAME FindRuby.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindRuby/Test" + "${CMake_BINARY_DIR}/Tests/FindRuby/Test" + ${build_generator_args} + --build-project TestRuby + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + + # Looks for ruby >= 50.1.0, which should logically fail + add_test(NAME FindRuby.Fail COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindRuby/Fail" + "${CMake_BINARY_DIR}/Tests/FindRuby/Fail" + ${build_generator_args} + --build-project TestRubyFail + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + set_tests_properties(FindRuby.Fail PROPERTIES + PASS_REGULAR_EXPRESSION "Could NOT find Ruby: Found unsuitable version \".*\", but required is.*least \"[0-9]+\\.[0-9]+\\.[0-9]+\" \\(found .*\\)") + + # Looks for 1.9.9 EXACTLY, which unlike the "FindRuby" test above will fail on every machine + # since this version doesn't exist (ruby goes from 1.9.3 to 2.0.0) + add_test(NAME FindRuby.FailExact COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindRuby/FailExact" + "${CMake_BINARY_DIR}/Tests/FindRuby/FailExact" + ${build_generator_args} + --build-project TestRubyFailExact + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + set_tests_properties(FindRuby.FailExact PROPERTIES + PASS_REGULAR_EXPRESSION "Could NOT find Ruby: Found unsuitable version \".*\", but required is.*exact version \"[0-9]+\\.[0-9]+\\.[0-9]+\" \\(found .*\\)") + +endif() |