-
Notifications
You must be signed in to change notification settings - Fork 5
/
test_coverage.sh
executable file
·39 lines (33 loc) · 1.18 KB
/
test_coverage.sh
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
#!/bin/sh
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Coverage
make
generate_coverage () {
# Generate coverage files
find . -name '*.gcda' | xargs gcov
lcov --capture --directory . --output-file coverage.info
genhtml coverage.info --output-directory ../coverage
}
# Clean coverage files
find . -name '*.gcda' -exec rm {} \;
rm -rdf ../coverage
./gdelta.exe -e -o gdelta.gdelta ../gdelta.cpp ../gdelta.h
./gdelta.exe -d -o gdelta.out ../gdelta.cpp ./gdelta.gdelta
if cmp -s ./gdelta.out ../gdelta.h; then
echo "Successfully reconstructed gdelta.h from gdelta.cpp, no issues found"
else
generate_coverage
echo "Failed to delta/reconstruct gdelta.h from gdelta.cpp, this is likely a bug please compare build/gdelta.out, gdelta.h, gdelta.cpp"
exit
fi
./gdelta.exe -e -o gdelta.gdelta ../gdelta.h ../gdelta.cpp
./gdelta.exe -d -o gdelta.out ../gdelta.h ./gdelta.gdelta
if cmp -s ./gdelta.out ../gdelta.cpp; then
echo "Successfully reconstructed gdelta.cpp from gdelta.h, no issues found"
else
generate_coverage
echo "Failed to delta/reconstruct gdelta.cpp from gdelta.h, this is likely a bug please compare build/gdelta.out, gdelta.h, gdelta.cpp"
exit
fi
generate_coverage