improve coverage creation
This commit is contained in:
parent
6a4978ef5e
commit
56283c947a
@ -90,7 +90,7 @@ addons:
|
||||
- libtommath-dev
|
||||
before_script:
|
||||
- sudo apt-get update -qq
|
||||
- sudo pip install cpp-coveralls
|
||||
- sudo gem install coveralls-lcov
|
||||
after_failure:
|
||||
- cat test_std.txt
|
||||
- cat test_err.txt
|
||||
|
9
build.sh
9
build.sh
@ -42,11 +42,14 @@ if [ -a test ] && [ -f test ] && [ -x test ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
lcov_opts="--capture --no-external --directory src -q"
|
||||
lcov_out=$(echo coverage_$1_$2_$3 | tr ' -=+' '_')".info"
|
||||
|
||||
if [ -a testok.txt ] && [ -f testok.txt ]; then
|
||||
[ "$LTC_COVERAGE" != "" ] && lcov $lcov_opts --output-file $lcov_out
|
||||
if [ "$LTC_COVERAGE" != "" ]; then
|
||||
./coverage_more.sh > test_coverage_more.txt || exit 1
|
||||
lcov_opts="--capture --no-external --directory src -q"
|
||||
lcov_out=$(echo coverage_$1_$2_$3 | tr ' -=+' '_')".info"
|
||||
lcov $lcov_opts --output-file $lcov_out
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
exit 1
|
||||
|
20
coverage.sh
20
coverage.sh
@ -20,7 +20,7 @@ fi
|
||||
# output version
|
||||
bash printinfo.sh
|
||||
|
||||
bash build.sh " $1" " $2" " $3 COVERAGE=1" "$4 -fprofile-arcs -ftest-coverage " "$5 -lgcov"
|
||||
bash build.sh " $1" " $2" " $3 COVERAGE=1" "$4" "$5"
|
||||
if [ -a testok.txt ] && [ -f testok.txt ]; then
|
||||
echo
|
||||
else
|
||||
@ -29,24 +29,14 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./sizes
|
||||
./constants
|
||||
|
||||
for i in $(for j in $(echo $(./hashsum -h | tail -n +3)); do echo $j; done | sort); do echo -n "$i: " && ./hashsum -a $i testprof/test.key ; done > hashsum_tv.txt
|
||||
difftroubles=$(diff -i -w -B hashsum_tv.txt notes/hashsum_tv.txt | grep '^<') || true
|
||||
if [ -n "$difftroubles" ]; then
|
||||
echo "FAILURE: hashsum_tv.tx"
|
||||
diff -i -w -B hashsum_tv.txt notes/hashsum_tv.txt
|
||||
echo "hashsum failed" && rm -f testok.txt && exit 1
|
||||
else
|
||||
echo "hashsum okay"
|
||||
fi
|
||||
./coverage_more.sh > test_coverage_more.txt || { rm -f testok.txt && exit 1 ; }
|
||||
|
||||
make lcov-single
|
||||
# if this was executed as './coverage.sh ...' create coverage locally
|
||||
if [[ "${0%% *}" == "./${0##*/}" ]]; then
|
||||
make lcov-single
|
||||
make lcov-html
|
||||
else
|
||||
cpp-coveralls -e 'demos/' -e 'testprof/' -e 'notes/' -e 'src/headers/'
|
||||
coveralls-lcov coverage.info
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
24
coverage_more.sh
Executable file
24
coverage_more.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
./sizes
|
||||
./constants
|
||||
|
||||
for i in $(for j in $(echo $(./hashsum -h | tail -n +3)); do echo $j; done | sort); do echo -n "$i: " && ./hashsum -a $i testprof/test.key ; done > hashsum_tv.txt
|
||||
difftroubles=$(diff -i -w -B hashsum_tv.txt notes/hashsum_tv.txt | grep '^<') || true
|
||||
if [ -n "$difftroubles" ]; then
|
||||
echo "FAILURE: hashsum_tv.tx"
|
||||
diff -i -w -B hashsum_tv.txt notes/hashsum_tv.txt
|
||||
echo "hashsum failed"
|
||||
exit 1
|
||||
else
|
||||
echo "hashsum okay"
|
||||
fi
|
||||
|
||||
|
||||
exit 0
|
||||
|
||||
# $Source$
|
||||
# $Revision$
|
||||
# $Date$
|
22
makefile
22
makefile
@ -34,6 +34,12 @@ endif
|
||||
|
||||
include makefile_include.mk
|
||||
|
||||
ifeq ($(COVERAGE),1)
|
||||
all_test: LIB_PRE = -Wl,--whole-archive
|
||||
all_test: LIB_POST = -Wl,--no-whole-archive
|
||||
CFLAGS += -fprofile-arcs -ftest-coverage
|
||||
EXTRALIBS += -lgcov
|
||||
endif
|
||||
|
||||
#AES comes in two flavours... enc+dec and enc
|
||||
src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
|
||||
@ -88,10 +94,6 @@ endef
|
||||
|
||||
$(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo))))
|
||||
|
||||
ifeq ($(COVERAGE),1)
|
||||
all_test: LIB_PRE = -Wl,--whole-archive
|
||||
all_test: LIB_POST = -Wl,--no-whole-archive
|
||||
endif
|
||||
|
||||
#This rule installs the library and the header files. This must be run
|
||||
#as root in order to have a high enough permission to write to the correct
|
||||
@ -117,14 +119,20 @@ cleancov-clean:
|
||||
rm -f `find . -type f -name "*.info" | xargs`
|
||||
rm -rf coverage/
|
||||
|
||||
# merges all coverage_*.info files into coverage.info
|
||||
coverage.info:
|
||||
lcov `find -name 'coverage_*.info' -exec echo -n " -a {}" \;` -o coverage.info
|
||||
|
||||
# generates html output from all coverage_*.info files
|
||||
lcov:
|
||||
lcov `find -name 'coverage_*.info' -exec echo -n " -a {}" \;` -o coverage.info -q 2>/dev/null
|
||||
lcov-html: coverage.info
|
||||
genhtml coverage.info --output-directory coverage -q
|
||||
|
||||
# combines all necessary steps to create the coverage from a single testrun with e.g.
|
||||
# CFLAGS="-DUSE_LTM -DLTM_DESC -I../libtommath" EXTRALIBS="../libtommath/libtommath.a" make coverage -j9
|
||||
lcov-single: | cleancov-clean lcov-single-create lcov
|
||||
lcov-single:
|
||||
$(MAKE) cleancov-clean
|
||||
$(MAKE) lcov-single-create
|
||||
$(MAKE) coverage.info
|
||||
|
||||
|
||||
#make the code coverage of the library
|
||||
|
39
testme.sh
39
testme.sh
@ -3,7 +3,8 @@
|
||||
if [ $# -lt 3 ]
|
||||
then
|
||||
echo "usage is: ${0##*/} <which makefile and other make options> <additional defines> <path to math provider>"
|
||||
echo "e.g. \"${0##*/} \"makefile -j3\" \"-DUSE_LTM -DLTM_DESC -I/path/to/libtommath\" /path/to/libtommath/libtommath.a\""
|
||||
echo "e.g. \"${0##*/} \"makefile -j9\" \"-DUSE_LTM -DLTM_DESC -I../libtommath\" ../libtommath/libtommath.a\""
|
||||
echo "to create aggregate coverage: pre-pend with LTC_COVERAGE=1"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
@ -13,53 +14,57 @@ echo "date="`date`
|
||||
# check sources
|
||||
bash check_source.sh "CHECK_SOURCES" " " "$1" "$2" "$3" || exit 1
|
||||
|
||||
mk="$1"
|
||||
|
||||
[ "$LTC_COVERAGE" != "" ] && mk="$mk COVERAGE=1"
|
||||
|
||||
# stock build
|
||||
bash run.sh "STOCK" " " "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "STOCK" " " "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# EASY build
|
||||
bash run.sh "EASY" "-DLTC_EASY" "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "EASY" "-DLTC_EASY" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# SMALL code
|
||||
bash run.sh "SMALL" "-DLTC_SMALL_CODE" "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "SMALL" "-DLTC_SMALL_CODE" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# NOTABLES
|
||||
bash run.sh "NOTABLES" "-DLTC_NO_TABLES" "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "NOTABLES" "-DLTC_NO_TABLES" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# SMALL+NOTABLES
|
||||
bash run.sh "SMALL+NOTABLES" "-DLTC_SMALL_CODE -DLTC_NO_TABLES" "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "SMALL+NOTABLES" "-DLTC_SMALL_CODE -DLTC_NO_TABLES" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# CLEANSTACK
|
||||
bash run.sh "CLEANSTACK" "-DLTC_CLEAN_STACK" "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "CLEANSTACK" "-DLTC_CLEAN_STACK" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# CLEANSTACK + SMALL
|
||||
bash run.sh "CLEANSTACK+SMALL" "-DLTC_SMALL_CODE -DLTC_CLEAN_STACK" "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "CLEANSTACK+SMALL" "-DLTC_SMALL_CODE -DLTC_CLEAN_STACK" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# CLEANSTACK + NOTABLES
|
||||
bash run.sh "CLEANSTACK+NOTABLES" "-DLTC_NO_TABLES -DLTC_CLEAN_STACK" "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "CLEANSTACK+NOTABLES" "-DLTC_NO_TABLES -DLTC_CLEAN_STACK" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# CLEANSTACK + NOTABLES + SMALL
|
||||
bash run.sh "CLEANSTACK+NOTABLES+SMALL" "-DLTC_NO_TABLES -DLTC_CLEAN_STACK -DLTC_SMALL_CODE" "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "CLEANSTACK+NOTABLES+SMALL" "-DLTC_NO_TABLES -DLTC_CLEAN_STACK -DLTC_SMALL_CODE" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# NO_FAST
|
||||
bash run.sh "NO_FAST" "-DLTC_NO_FAST" "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "NO_FAST" "-DLTC_NO_FAST" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# NO_FAST + NOTABLES
|
||||
bash run.sh "NO_FAST+NOTABLES" "-DLTC_NO_FAST -DLTC_NO_TABLES" "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "NO_FAST+NOTABLES" "-DLTC_NO_FAST -DLTC_NO_TABLES" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# NO_ASM
|
||||
bash run.sh "NO_ASM" "-DLTC_NO_ASM" "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "NO_ASM" "-DLTC_NO_ASM" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# NO_TIMING_RESISTANCE
|
||||
bash run.sh "NO_TIMING_RESISTANCE" "-DLTC_NO_ECC_TIMING_RESISTANT -DLTC_NO_RSA_BLINDING" "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "NO_TIMING_RESISTANCE" "-DLTC_NO_ECC_TIMING_RESISTANT -DLTC_NO_RSA_BLINDING" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# CLEANSTACK+NOTABLES+SMALL+NO_ASM+NO_TIMING_RESISTANCE
|
||||
bash run.sh "CLEANSTACK+NOTABLES+SMALL+NO_ASM+NO_TIMING_RESISTANCE" "-DLTC_CLEAN_STACK -DLTC_NO_TABLES -DLTC_SMALL_CODE -DLTC_NO_ECC_TIMING_RESISTANT -DLTC_NO_RSA_BLINDING" "$1" "$2" "$3" || exit 1
|
||||
bash run.sh "CLEANSTACK+NOTABLES+SMALL+NO_ASM+NO_TIMING_RESISTANCE" "-DLTC_CLEAN_STACK -DLTC_NO_TABLES -DLTC_SMALL_CODE -DLTC_NO_ECC_TIMING_RESISTANT -DLTC_NO_RSA_BLINDING" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# test build with no testing
|
||||
bash testbuild.sh "NOTEST" "-DLTC_NO_TEST" "$1" "$2" "$3" || exit 1
|
||||
bash testbuild.sh "NOTEST" "-DLTC_NO_TEST" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# test build with no file routines
|
||||
bash testbuild.sh "NOFILE" "-DLTC_NO_FILE" "$1" "$2" "$3" || exit 1
|
||||
bash testbuild.sh "NOFILE" "-DLTC_NO_FILE" "$mk" "$2" "$3" || exit 1
|
||||
|
||||
# $Source$
|
||||
# $Revision$
|
||||
|
Loading…
Reference in New Issue
Block a user