Browse Source

Add coverage support scoped to only the zcash-gtest run; invoke with make zcash-cov; make cov is a superset.

pull/145/head
Nathan Wilcox 8 years ago
parent
commit
d16d5ef832
  1. 2
      .gitignore
  2. 26
      Makefile.am
  3. 33
      zcutil/build.sh

2
.gitignore

@ -102,8 +102,10 @@ build
#lcov
*.gcno
*.gcda
/*.info
test_bitcoin.coverage/
zcash-gtest.coverage/
total.coverage/
coverage_percent.txt

26
Makefile.am

@ -160,7 +160,7 @@ baseline_filtered_combined.info: leveldb_baseline_filtered.info baseline_filtere
$(LCOV) -a leveldb_baseline_filtered.info -a baseline_filtered.info -o $@
test_bitcoin.info: baseline_filtered_combined.info
$(MAKE) -C src/ check
$(MAKE) -C src/ bitcoin_test_check
$(LCOV) -c -d $(abs_builddir)/src -t test_bitcoin -o $@
$(LCOV) -z -d $(abs_builddir)/src
$(LCOV) -z -d $(abs_builddir)/src/leveldb
@ -168,6 +168,15 @@ test_bitcoin.info: baseline_filtered_combined.info
test_bitcoin_filtered.info: test_bitcoin.info
$(LCOV) -r $< "/usr/include/*" -o $@
zcash-gtest.info: baseline_filtered_combined.info
$(MAKE) -C src/ zcash-gtest_check
$(LCOV) -c -d $(abs_builddir)/src -t test_bitcoin -o $@
$(LCOV) -z -d $(abs_builddir)/src
$(LCOV) -z -d $(abs_builddir)/src/leveldb
zcash-gtest_filtered.info: zcash-gtest.info
$(LCOV) -r $< "/usr/include/*" -o $@
block_test.info: test_bitcoin_filtered.info
$(MKDIR_P) qa/tmp
-@TIMEOUT=15 qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -jar $(JAVA_COMPARISON_TOOL) qa/tmp/compTool 0
@ -181,18 +190,27 @@ block_test_filtered.info: block_test.info
test_bitcoin_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -o $@
total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info block_test_filtered.info
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a block_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
zcash-gtest_coverage.info: baseline_filtered_combined.info zcash-gtest_filtered.info
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a zcash-gtest_filtered.info -o $@
total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info zcash-gtest_filtered.info block_test_filtered.info
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a zcash-gtest_filtered.info -a block_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
test_bitcoin.coverage/.dirstamp: test_bitcoin_coverage.info
$(GENHTML) -s $< -o $(@D)
@touch $@
zcash-gtest.coverage/.dirstamp: zcash-gtest_coverage.info
$(GENHTML) -s $< -o $(@D)
@touch $@
cov-zcash: zcash-gtest.coverage/.dirstamp
total.coverage/.dirstamp: total_coverage.info
$(GENHTML) -s $< -o $(@D)
@touch $@
cov: test_bitcoin.coverage/.dirstamp total.coverage/.dirstamp
cov: test_bitcoin.coverage/.dirstamp cov-zcash total.coverage/.dirstamp
endif

33
zcutil/build.sh

@ -1,12 +1,39 @@
#!/bin/sh
set -ex
#!/bin/bash
set -eu -o pipefail
if [ "x$*" = 'x--help' ]
then
cat <<EOF
Usage:
$0 --help
Show this help message and exit.
$0 [ --enable-lcov ] [ MAKEARGS... ]
Build Zcash and most of its transitive dependencies from
source. MAKEARGS are applied to both dependencies and Zcash itself. If
--enable-lcov is passed, Zcash is configured to add coverage
instrumentation, thus enabling "make cov" to work.
EOF
exit 0
fi
set -x
cd "$(dirname "$(readlink -f "$0")")/.."
# If --enable-lcov is the first argument, enable lcov coverage support:
LCOV_ARG=''
if [ "x${1:-}" = 'x--enable-lcov' ]
then
LCOV_ARG='--enable-lcov'
shift
fi
# BUG: parameterize the platform/host directory:
PREFIX="$(pwd)/depends/x86_64-unknown-linux-gnu/"
make "$@" -C ./depends/ V=1 NO_QT=1
./autogen.sh
./configure --prefix="${PREFIX}" --with-gui=no CXXFLAGS='-O0 -g'
./configure --prefix="${PREFIX}" --with-gui=no "$LCOV_ARG" CXXFLAGS='-O0 -g'
make "$@" V=1

Loading…
Cancel
Save