1#!/bin/bash
2
3set -e
4
5if [ "$TRAVIS_CI" == "private" ]; then
6    exit 0
7fi
8
9if [ "$#" != "5" ]; then
10    echo "Usage is: ${0} \"coverage\" \"<prepend CFLAGS>\" \"<makefile>\" \"<append CFLAGS>\" <math library to link to>"
11    echo "CC=gcc ${0} \"coverage\" \" \" \"makefile\" \"-DUSE_LTM -DLTM_DESC -I../libtommath\" ../libtommath/libtommath.a"
12    exit -1
13fi
14
15if [ -z "$(echo $CC | grep "gcc")" ]; then
16    echo "no gcc detected, early exit success"
17    exit 0
18fi
19
20if [ "$(echo $3 | grep -v 'makefile[.]')" == "" ]; then
21    echo "only run $0 for the regular makefile, early exit success"
22    exit 0
23fi
24
25# output version
26bash printinfo.sh
27
28bash build.sh " $1" " $2" " $3 COVERAGE=1" "$4" "$5"
29if [ -a testok.txt ] && [ -f testok.txt ]; then
30   echo
31else
32   echo
33   echo "Test failed"
34   exit 1
35fi
36
37./coverage_more.sh > test_coverage_more.txt || { rm -f testok.txt && exit 1 ; }
38
39make lcov-single
40# if this was executed as './coverage.sh ...' create coverage locally
41if [[ "${0%% *}" == "./${0##*/}" ]]; then
42   make lcov-html
43else
44   coveralls-lcov coverage.info
45fi
46
47exit 0
48
49# ref:         HEAD -> master, tag: v1.18.2
50# git commit:  7e7eb695d581782f04b24dc444cbfde86af59853
51# commit time: 2018-07-01 22:49:01 +0200
52