Repository: kudu Updated Branches: refs/heads/master a0f425f76 -> edf36ebe0
cmake: Throw cmake error if unit test does not exist Previously, if the unit test file did not exist, CMake would not notice and the problem was difficult to debug at test runtime. Change-Id: I6c7d048f44624c8406198a098e0a7ecb44f8a08e Reviewed-on: http://gerrit.cloudera.org:8080/5222 Tested-by: Kudu Jenkins Reviewed-by: Adar Dembo <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/edf36ebe Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/edf36ebe Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/edf36ebe Branch: refs/heads/master Commit: edf36ebe00b0c4e2da23386e8e92e36fdaae91d2 Parents: a0f425f Author: Mike Percy <[email protected]> Authored: Fri Nov 25 13:55:01 2016 +0000 Committer: Adar Dembo <[email protected]> Committed: Tue Nov 29 21:38:53 2016 +0000 ---------------------------------------------------------------------- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/edf36ebe/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c4e9df..f9b191b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -645,7 +645,7 @@ function(ADD_KUDU_TEST REL_TEST_NAME) # This test has a corresponding .cc file, set it up as an executable. set(TEST_PATH "${EXECUTABLE_OUTPUT_PATH}/${TEST_NAME}") ADD_KUDU_TEST_NO_CTEST(${REL_TEST_NAME}) - else() + elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${REL_TEST_NAME}) # No executable, just invoke the test (probably a script) directly. get_filename_component(TEST_NAME_WITH_EXT ${REL_TEST_NAME} NAME) set(TEST_PATH "${EXECUTABLE_OUTPUT_PATH}/${TEST_NAME_WITH_EXT}") @@ -655,6 +655,8 @@ function(ADD_KUDU_TEST REL_TEST_NAME) # on an add_custom_command() that copies the test file into place). execute_process(COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/${REL_TEST_NAME} ${EXECUTABLE_OUTPUT_PATH}) + else() + message(FATAL_ERROR "Neither ${REL_TEST_NAME} nor ${REL_TEST_NAME}.cc were found in ${CMAKE_CURRENT_SOURCE_DIR}/") endif() add_test(${TEST_NAME}
