Skip to content

Commit

Permalink
Merge pull request #2 from jmealler/master
Browse files Browse the repository at this point in the history
Improves test workflow.
  • Loading branch information
poletti-marco committed Aug 21, 2014
2 parents 494514c + 40d91fc commit 938a662
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

set(TEST_SOURCES
dep_canonicalization.cpp
dependency_loop.cpp
Expand All @@ -24,16 +23,22 @@ type_already_bound.cpp
type_already_bound2.cpp
)

function(add_successful_compile NAME)
set(BIN ${NAME}-exec)
set(BUILD ${NAME}-build)
add_executable(${BIN} ${NAME}.cpp)
target_link_libraries(${BIN} fruit)
add_test(NAME ${BUILD} COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target ${BIN})
set_tests_properties(${NAME} PROPERTIES DEPENDS ${BUILD})
endfunction(add_successful_compile)

function(add_test_expected_to_pass NAME)
add_executable(${NAME}-exec ${NAME}.cpp)
target_link_libraries(${NAME}-exec fruit)
add_test(NAME ${NAME}
COMMAND valgrind --leak-check=full --malloc-fill=AA --track-origins=yes --read-var-info=yes --num-callers=50 --error-exitcode=1 $<TARGET_FILE:${NAME}-exec>)
add_successful_compile(${NAME})
endfunction(add_test_expected_to_pass)

function(add_test_expected_to_fail_at_runtime NAME MESSAGE)
add_executable(${NAME}-exec ${NAME}.cpp)
target_link_libraries(${NAME}-exec fruit)
add_test(NAME ${NAME}
COMMAND bash -c "
F=`mktemp`
Expand All @@ -51,6 +56,7 @@ function(add_test_expected_to_fail_at_runtime NAME MESSAGE)
fi
rm -f \${F}
")
add_successful_compile(${NAME})
endfunction(add_test_expected_to_fail_at_runtime)

set(COMPILERS_TO_TEST "g++" "clang++")
Expand Down

0 comments on commit 938a662

Please sign in to comment.