improve coverage creation
This commit is contained in:
parent
6a4978ef5e
commit
56283c947a
@ -90,7 +90,7 @@ addons:
|
|||||||
- libtommath-dev
|
- libtommath-dev
|
||||||
before_script:
|
before_script:
|
||||||
- sudo apt-get update -qq
|
- sudo apt-get update -qq
|
||||||
- sudo pip install cpp-coveralls
|
- sudo gem install coveralls-lcov
|
||||||
after_failure:
|
after_failure:
|
||||||
- cat test_std.txt
|
- cat test_std.txt
|
||||||
- cat test_err.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
|
||||||
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
|
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
|
exit 0
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
|
20
coverage.sh
20
coverage.sh
@ -20,7 +20,7 @@ fi
|
|||||||
# output version
|
# output version
|
||||||
bash printinfo.sh
|
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
|
if [ -a testok.txt ] && [ -f testok.txt ]; then
|
||||||
echo
|
echo
|
||||||
else
|
else
|
||||||
@ -29,24 +29,14 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./sizes
|
./coverage_more.sh > test_coverage_more.txt || { rm -f testok.txt && exit 1 ; }
|
||||||
./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
|
|
||||||
|
|
||||||
|
make lcov-single
|
||||||
# if this was executed as './coverage.sh ...' create coverage locally
|
# if this was executed as './coverage.sh ...' create coverage locally
|
||||||
if [[ "${0%% *}" == "./${0##*/}" ]]; then
|
if [[ "${0%% *}" == "./${0##*/}" ]]; then
|
||||||
make lcov-single
|
make lcov-html
|
||||||
else
|
else
|
||||||
cpp-coveralls -e 'demos/' -e 'testprof/' -e 'notes/' -e 'src/headers/'
|
coveralls-lcov coverage.info
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
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
|
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
|
#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
|
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))))
|
$(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
|
#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
|
#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 -f `find . -type f -name "*.info" | xargs`
|
||||||
rm -rf coverage/
|
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
|
# generates html output from all coverage_*.info files
|
||||||
lcov:
|
lcov-html: coverage.info
|
||||||
lcov `find -name 'coverage_*.info' -exec echo -n " -a {}" \;` -o coverage.info -q 2>/dev/null
|
|
||||||
genhtml coverage.info --output-directory coverage -q
|
genhtml coverage.info --output-directory coverage -q
|
||||||
|
|
||||||
# combines all necessary steps to create the coverage from a single testrun with e.g.
|
# 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
|
# 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
|
#make the code coverage of the library
|
||||||
|
39
testme.sh
39
testme.sh
@ -3,7 +3,8 @@
|
|||||||
if [ $# -lt 3 ]
|
if [ $# -lt 3 ]
|
||||||
then
|
then
|
||||||
echo "usage is: ${0##*/} <which makefile and other make options> <additional defines> <path to math provider>"
|
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
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -13,53 +14,57 @@ echo "date="`date`
|
|||||||
# check sources
|
# check sources
|
||||||
bash check_source.sh "CHECK_SOURCES" " " "$1" "$2" "$3" || exit 1
|
bash check_source.sh "CHECK_SOURCES" " " "$1" "$2" "$3" || exit 1
|
||||||
|
|
||||||
|
mk="$1"
|
||||||
|
|
||||||
|
[ "$LTC_COVERAGE" != "" ] && mk="$mk COVERAGE=1"
|
||||||
|
|
||||||
# stock build
|
# stock build
|
||||||
bash run.sh "STOCK" " " "$1" "$2" "$3" || exit 1
|
bash run.sh "STOCK" " " "$mk" "$2" "$3" || exit 1
|
||||||
|
|
||||||
# EASY build
|
# 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
|
# 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
|
# 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
|
# 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
|
# 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
|
# 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
|
# 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
|
# 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
|
# 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
|
# 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
|
# 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
|
# 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
|
# 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
|
# 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
|
# 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$
|
# $Source$
|
||||||
# $Revision$
|
# $Revision$
|
||||||
|
Loading…
x
Reference in New Issue
Block a user