blob: 164c9e0826fab3ae23aa0368a92e72bd1cf1a2f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
#!/usr/bin/env bash
if ! command -v gcov > /dev/null; then
echo "Please install gcov"
exit 1
fi
if ! command -v lcov > /dev/null; then
echo "Please install lcov"
exit 1
fi
# Default make jobs
MAKE_JOBS=${MAKE_JOBS:-4}
# Default temp directory
if [ -z "${TMPDIR}" ];
then
if [ -d "${HOME}/tmp" ]; then
TMPDIR="${HOME}/tmp"
else
TMPDIR="/tmp"
fi
fi
DEBUG_CXXFLAGS="-DDEBUG -DCRYPTOPP_COVERAGE=1 -g3 -O1 -coverage"
NOASM_CXXFLAGS="-DNDEBUG -DCRYPTOPP_DISABLE_ASM -DCRYPTOPP_COVERAGE=1 -g3 -O1 -coverage"
RELEASE_CXXFLAGS="-DNDEBUG -DCRYPTOPP_COVERAGE=1 -g3 -O1 -coverage"
# Clean old artifacts
rm -rf TestCoverage/ >/dev/null
make distclean >/dev/null
echo "**************************************************"
echo "***** Baseline build *****"
echo "**************************************************"
make clean > /dev/null
if ! make -j "${MAKE_JOBS}";
then
echo "Baseline build failed"
exit 1
fi
# Create a baseline
lcov --base-directory . --directory . -i -c -o cryptest_base.info
echo "**************************************************"
echo "***** Debug build *****"
echo "**************************************************"
make clean > /dev/null
if ! CXXFLAGS="${DEBUG_CXXFLAGS}" make -j "${MAKE_JOBS}";
then
echo "Debug build failed"
exit 1
fi
# Run test programs
./cryptest.exe v
./cryptest.exe tv all
# Gather data
lcov --base-directory . --directory . -c -o cryptest_debug.info
echo "**************************************************"
echo "***** No ASM build *****"
echo "**************************************************"
make clean > /dev/null
if ! CXXFLAGS="${NOASM_CXXFLAGS}" make -j "${MAKE_JOBS}";
then
echo "No ASM build failed"
exit 1
fi
# Run test programs
./cryptest.exe v
./cryptest.exe tv all
# Gather data
lcov --base-directory . --directory . -c -o cryptest_noasm.info
echo "**************************************************"
echo "***** Release build *****"
echo "**************************************************"
make clean > /dev/null
if ! CXXFLAGS="${RELEASE_CXXFLAGS}" make -j "${MAKE_JOBS}";
then
echo "Release build failed"
exit 1
fi
# Run test programs
./cryptest.exe v
./cryptest.exe tv all
./cryptest.exe b 0.5
# Gather data
lcov --base-directory . --directory . -c -o cryptest_release.info
echo "**************************************************"
echo "***** HTML processing *****"
echo "**************************************************"
if [ ! -e cryptest_debug.info ]; then
echo "WARN: cryptest_debug.info does not exist"
fi
if [ ! -e cryptest_noasm.info ]; then
echo "WARN: cryptest_noasm.info does not exist"
fi
if [ ! -e cryptest_release.info ]; then
echo "WARN: cryptest_release.info does not exist"
fi
# The man page at https://linux.die.net/man/1/lcov says to add cryptest_base.info,
# but it causes an error in the command below.
# --add-tracefile cryptest_base.info
lcov --add-tracefile cryptest_debug.info \
--add-tracefile cryptest_noasm.info \
--add-tracefile cryptest_release.info \
--output-file cryptest_all.info
lcov --remove cryptest_all.info \
'/usr/*' 'adhoc*.*' 'fipstest*.*' 'fips140*.*' \
--output-file cryptest.info
genhtml -o TestCoverage/ -t "Crypto++ test coverage" --num-spaces 4 cryptest.info
exit 0
|