# Coverage report
pushd /usr/src/packages/BUILD/snapper-*
-make coveralls STRIP_PATH_PREFIX="$(pwd)"
+make coverage
popd
+# Must call coveralls-lcov from the git directory
+BUILDDIR=(/usr/src/packages/BUILD/snapper-*) # expand glob
+make -f Makefile.repo coveralls BUILDDIR="${BUILDDIR[@]}"
# get the plain package names and remove all packages at once
rpm -ev --nodeps `rpm -q --qf '%{NAME} ' -p /usr/src/packages/RPMS/**/*.rpm`
if ENABLE_COVERAGE
# Run `make coverage` after all the tests have been run.
+# See also make -f Makefile.repo coveralls
COVERAGE_INFO = coverage/coverage.info
-.PHONY: coverage coveralls
+.PHONY: coverage
coverage:
mkdir -p $(dir $(COVERAGE_INFO))
lcov --capture --no-external --exclude '*/testsuite*/*' --output-file $(COVERAGE_INFO) --directory . --quiet
lcov --list $(COVERAGE_INFO)
genhtml --output-directory coverage --legend --title "Snapper code coverage" -q $(COVERAGE_INFO)
-
-coveralls: coverage
- ## Strip the absolute path prefix from the coverage data
- ## so coveralls.io can find the source files at GitHub.
- ## STRIP_PATH_PREFIX should be set at 'make' time.
- sed -i -e 's#^SF:'"$${STRIP_PATH_PREFIX}"'/\(.*\)#SF:\1#' "$(COVERAGE_INFO)"
- ## Send the code coverage to coveralls.io
- ## COVERALLS_TOKEN is set in Travis config and passed via .travis.yml
- LC_ALL=en_US.UTF-8 coveralls-lcov --repo-token "$${COVERALLS_TOKEN}" "$(COVERAGE_INFO)"
endif
# Create all the files necessary for building the package with OBS:
reconf: all
./config.status --recheck
./config.status
+
+# This needs access to the build (and test) results so you would expect it
+# in Makefile.am
+# But the coveralls tool needs info from the Git checkout.
+COVERAGE_INFO=$(BUILDDIR)/coverage/coverage.info
+coveralls:
+ # Strip the absolute path prefix from the coverage data
+ # so coveralls.io can find the source files at GitHub.
+ sed -i -e 's#^SF:'"$${BUILDDIR?}"'/\(.*\)#SF:\1#' "$(COVERAGE_INFO)"
+ # Send the code coverage to coveralls.io
+ # COVERALLS_TOKEN is set in Travis config and passed via .travis.yml
+ LC_ALL=en_US.UTF-8 coveralls-lcov --repo-token "$${COVERALLS_TOKEN}" "$(COVERAGE_INFO)"