From: Sebastian Harl Date: Thu, 26 Dec 2013 12:34:45 +0000 (+0100) Subject: Moved coverage.sh to the t/ subdirectory. X-Git-Tag: sysdb-0.1.0~275 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=7428c306d4b24990f4156902b71b63b37db626ac;hp=7e415d94ab1dbe672af0cafa42f4e2c7dec4a491 Moved coverage.sh to the t/ subdirectory. --- diff --git a/Makefile.am b/Makefile.am index 1cf1e53..10794f0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,7 +8,7 @@ if BUILD_TESTING SUBDIRS += t endif -EXTRA_DIST = autogen.sh coverage.sh version-gen.sh +EXTRA_DIST = autogen.sh version-gen.sh version: FORCE @# As a side-effect, this updates version. diff --git a/coverage.sh b/coverage.sh deleted file mode 100755 index a62f883..0000000 --- a/coverage.sh +++ /dev/null @@ -1,58 +0,0 @@ -#! /bin/bash -# -# SysDB -- coverage.sh -# -# Create a test coverage report for the System DataBase. - -set -e - -if ! which lcov || ! which genhtml; then - echo "lcov is required in order to generate a test coverage report" >&2 - exit 1 -fi - -cd $( dirname "$0" ) - -if test -e coverage; then - echo "coverage exists already; please remove manually" >&2 - exit 1 -fi - -V=$( grep '^PACKAGE_VERSION' Makefile | cut -d' ' -f3 ) -if test -z "$V"; then - echo "Unable to determine package version" >&2 - exit 1 -fi - -make dist - -tmpdir=$( mktemp -d -t ) -trap "rm -rf $tmpdir" EXIT - -srcdir=$( pwd ) - -cd $tmpdir -tar --strip-components=1 -zxf "$srcdir"/sysdb-$V.tar.gz -if test -d "$srcdir"/.git/; then - # copy Git database for version-gen.sh - cp -a "$srcdir"/.git . -fi - -./configure --enable-gcov --disable-shared CFLAGS="-O0 -g" -make - -V1=$( grep '^PACKAGE_VERSION' Makefile | cut -d' ' -f3 ) -if test -z "$V1"; then - # this should not happen - V1="$V" -fi - -lcov --base-directory src --directory src --zerocount -make test -lcov --base-directory src --directory src --no-external \ - --capture -o sysdb_coverage.info - -genhtml -o "$srcdir"/coverage \ - -t "SysDB $V1 test coverage" --num-spaces=4 --legend \ - sysdb_coverage.info - diff --git a/t/Makefile.am b/t/Makefile.am index c74da44..7aa6d77 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -1,3 +1,5 @@ +EXTRA_DIST = coverage.sh + # coverage related flags are only set when gcov is enabled AM_CFLAGS = @STRICT_CFLAGS@ @COVERAGE_CFLAGS@ AM_LDFLAGS = @COVERAGE_LDFLAGS@ diff --git a/t/coverage.sh b/t/coverage.sh new file mode 100755 index 0000000..5bb1de0 --- /dev/null +++ b/t/coverage.sh @@ -0,0 +1,58 @@ +#! /bin/bash +# +# SysDB -- t/coverage.sh +# +# Create a test coverage report for the System DataBase. + +set -e + +if ! which lcov || ! which genhtml; then + echo "lcov is required in order to generate a test coverage report" >&2 + exit 1 +fi + +cd $( dirname "$0" )/.. + +if test -e t/coverage; then + echo "t/coverage exists already; please remove manually" >&2 + exit 1 +fi + +V=$( grep '^PACKAGE_VERSION' Makefile | cut -d' ' -f3 ) +if test -z "$V"; then + echo "Unable to determine package version" >&2 + exit 1 +fi + +make dist + +tmpdir=$( mktemp -d -t ) +trap "rm -rf $tmpdir" EXIT + +srcdir=$( pwd ) + +cd $tmpdir +tar --strip-components=1 -zxf "$srcdir"/sysdb-$V.tar.gz +if test -d "$srcdir"/.git/; then + # copy Git database for version-gen.sh + cp -a "$srcdir"/.git . +fi + +./configure --enable-gcov --disable-shared CFLAGS="-O0 -g" +make + +V1=$( grep '^PACKAGE_VERSION' Makefile | cut -d' ' -f3 ) +if test -z "$V1"; then + # this should not happen + V1="$V" +fi + +lcov --base-directory src --directory src --zerocount +make test +lcov --base-directory src --directory src --no-external \ + --capture -o sysdb_coverage.info + +genhtml -o "$srcdir"/t/coverage \ + -t "SysDB $V1 test coverage" --num-spaces=4 --legend \ + sysdb_coverage.info +