coverage.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. set -e
  3. if [ "$TRAVIS_CI" == "private" ]; then
  4. exit 0
  5. fi
  6. if [ "$#" != "5" ]; then
  7. echo "Usage is: ${0} \"coverage\" \"<prepend CFLAGS>\" \"<makefile>\" \"<append CFLAGS>\" <math library to link to>"
  8. echo "CC=gcc ${0} \"coverage\" \" \" \"makefile\" \"-DUSE_LTM -DLTM_DESC -I../libtommath\" ../libtommath/libtommath.a"
  9. exit -1
  10. fi
  11. if [ -z "$(echo $CC | grep "gcc")" ]; then
  12. echo "no gcc detected, early exit success"
  13. exit 0
  14. fi
  15. # output version
  16. bash printinfo.sh
  17. bash build.sh " $1" " $2" " $3 COVERAGE=1" "$4 -fprofile-arcs -ftest-coverage " "$5 -lgcov"
  18. if [ -a testok.txt ] && [ -f testok.txt ]; then
  19. echo
  20. else
  21. echo
  22. echo "Test failed"
  23. exit 1
  24. fi
  25. ./sizes
  26. ./constants
  27. for i in $(./hashsum | tail -n +3 | awk '{print $1}' | sort); do echo -n "$i: " && ./hashsum $i testprof/test.key ; done > hashsum_tv.txt
  28. difftroubles=$(diff -i -w -B hashsum_tv.txt notes/hashsum_tv.txt | grep '^<') || true
  29. if [ -n "$difftroubles" ]; then
  30. echo "FAILURE: hashsum_tv.tx"
  31. diff -i -w -B hashsum_tv.txt notes/hashsum_tv.txt
  32. echo "hashsum failed" && rm -f testok.txt && exit 1
  33. else
  34. echo "hashsum okay"
  35. fi
  36. # if this was executed as './coverage.sh ...' create coverage locally
  37. if [[ "${0%% *}" == "./${0##*/}" ]]; then
  38. make lcov-single
  39. else
  40. cpp-coveralls -e 'demos/' -e 'testprof/' -e 'notes/' -e 'src/headers/'
  41. fi
  42. exit 0
  43. # $Source$
  44. # $Revision$
  45. # $Date$