From 73ebf452eccdef983d672f5f4ebae945b0816ba3 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 18 Nov 2017 01:52:48 +0100 Subject: [PATCH] tests: improve coverage with integration tests (#2082) - install luacov.runner in tests/_runner.lua. - use Lua's `dofile` to execute the test files, which will give us coverage for them. - CMakeLists.txt: revert DO_COVERAGE env injection - revert cd: make f absolute if not in source_dir --- .travis.yml | 2 +- tests/run.sh | 8 ++++++-- tests/themes/run.sh | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index c51b390ee..019b425e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -213,8 +213,8 @@ script: travis_run_in_fold "make.check-qa" make check-qa fi - | - set -e if [ "$TEST_PREV_COMMITS" = 1 ] && ! [ "$TRAVIS_PULL_REQUEST" = false ]; then + set -e # Check each commit separately (to make git-bisect less annoying). # Fix Travis' commit range (https://github.com/travis-ci/travis-ci/issues/4596). commit_range="${TRAVIS_COMMIT_RANGE/.../..}" diff --git a/tests/run.sh b/tests/run.sh index 089778466..3b40b9896 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -241,9 +241,13 @@ for f in $tests; do continue fi fi + # Make the filename absolute if it is not. + if [ "$f#/" = "$f" ]; then + f="$source_dir/$f" + fi - # Send the test file to awesome. - DISPLAY=$D "$AWESOME_CLIENT" 2>&1 < "$f" + # Execute the test file in awesome. + DISPLAY=$D "$AWESOME_CLIENT" 2>&1 "dofile('$f')" # Tail the log and quit, when awesome quits. # Use a single `grep`, otherwise `--line-buffered` would be required. diff --git a/tests/themes/run.sh b/tests/themes/run.sh index 8d5a1f2c5..c2abda2e7 100755 --- a/tests/themes/run.sh +++ b/tests/themes/run.sh @@ -41,5 +41,5 @@ for theme_file in themes/*/theme.lua; do AWESOME_RC_FILE="$config_file" \ AWESOME_THEMES_PATH="$build_dir/themes" \ AWESOME_ICON_PATH="$PWD/icons" \ - "$source_dir/tests/run.sh" themes/tests.lua + "$source_dir/tests/run.sh" "$source_dir/tests/themes/tests.lua" done