Skip to content

Commit

Permalink
build: Don't delete test-executable when test fails
Browse files Browse the repository at this point in the history
This is totally annoying when someone wants to debug tests.

To preserve a nice build-order (so different test builds aren't
mixed), the executables were excluded from the "ALL" target.

Closes #135
  • Loading branch information
Makman2 committed Aug 16, 2017
1 parent ab76d31 commit 0793ea6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions CE3D2/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function(add_ce3d2_test test_file)
get_filename_component(test_name ${test_file} NAME_WE)

add_executable(${test_name}
EXCLUDE_FROM_ALL
# TestUtilities are embedded automatically into every test.
${CE3D2_TEST_ROOT}/TestUtilities
${test_file})
Expand All @@ -17,13 +18,19 @@ function(add_ce3d2_test test_file)
add_test(${test_name} ${test_name})

add_custom_command(
TARGET ${test_name}
POST_BUILD
OUTPUT ${test_name}_execution_stamp
DEPENDS ${test_name}
COMMAND ${test_name} --log_level=error --report_level=no
COMMAND touch ${test_name}_execution_stamp
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running ${test_name}..."
VERBATIM)

add_custom_target(
${test_name}_run
ALL
DEPENDS ${test_name}_execution_stamp)

# Copy test files if existent.
get_filename_component(test_file_directory ${test_file} DIRECTORY)
set(test_data_directory "${test_name}Files")
Expand Down

0 comments on commit 0793ea6

Please sign in to comment.