1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-18 13:55:11 -05:00

tests: Build and run all tests with make check

Simplifies the building and running of tests

Also exports the proper env variables so that the googletest output is
colored

ctest can use env variables for some of its options so we can for
example run
  CTEST_PROGRESS_OUTPUT=1 make check
to run ctest with the --progress flag

This also makes the travis test.sh script obsolete
This commit is contained in:
patrick96 2019-01-11 14:35:13 +01:00 committed by Patrick Ziegler
parent f74c524fff
commit 286eac393c
3 changed files with 7 additions and 17 deletions

View file

@ -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"

View file

@ -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

View file

@ -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
)