diff --git a/.travis.yml b/.travis.yml index ffaf579e..52d7b3eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,7 +46,7 @@ matrix: - compiler: gcc env: BUILD_TYPE=Coverage POLYBAR_BUILD_TYPE=tests BUILD_TESTS=ON addons: {apt: {packages: [*base_deps, *optional_deps]}} - script: ${TRAVIS_BUILD_DIR}/common/travis/tests.sh + script: make check after_success: - cd ${TRAVIS_BUILD_DIR} - bash <(curl -s https://codecov.io/bash) -F unittests -a "-ap" -Z || echo "Codecov did not collect coverage reports" diff --git a/common/travis/tests.sh b/common/travis/tests.sh deleted file mode 100755 index 2c0191c2..00000000 --- a/common/travis/tests.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -r=0 - -make all_unit_tests || exit $? - -for test in tests/unit_test.*; do - [ -x "$test" ] || continue - - if $test; then - printf "\033[1;32m%s\033[0m\n" "${test##*/} passed" - else - r=1 - printf "\033[1;31m%s\033[0m\n" "${test##*/} failed" - fi -done -exit $r diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b5916d8e..e787fa82 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -57,3 +57,9 @@ add_unit_test(components/command_line) add_unit_test(components/bar) add_unit_test(components/builder) add_unit_test(components/parser) + +# Run make check to build and run all unit tests +add_custom_target(check + COMMAND GTEST_COLOR=1 ctest --output-on-failure + DEPENDS all_unit_tests + )