forked from ceph/teuthology
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcov-init.sh
executable file
·35 lines (28 loc) · 1.03 KB
/
cov-init.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
#!/bin/bash
set -e
usage () {
printf '%s: usage: %s TEST_DIR OUTPUT_DIR CEPH_BUILD_TARBALL\n' "$(basename "$0")" "$(basename "$0")" 1>&2
exit 1
}
TEST_DIR=$1
OUTPUT_DIR=$2
CEPH_TARBALL=$3
if [ -z "$TEST_DIR" ] || [ -z "$OUTPUT_DIR" ] || [ -z "$CEPH_TARBALL" ]; then
usage
fi
SHA1=`cat $TEST_DIR/ceph-sha1`
mkdir -p $OUTPUT_DIR/ceph
echo "Retrieving source and .gcno files..."
wget -q -O- "https://github.com/ceph/ceph/tarball/$SHA1" | tar xzf - --strip-components=1 -C $OUTPUT_DIR/ceph
tar zxf $CEPH_TARBALL -C $OUTPUT_DIR
cp $OUTPUT_DIR/usr/local/lib/ceph/coverage/*.gcno $OUTPUT_DIR/ceph/src
mkdir $OUTPUT_DIR/ceph/src/.libs
cp $OUTPUT_DIR/usr/local/lib/ceph/coverage/.libs/*.gcno $OUTPUT_DIR/ceph/src/.libs
rm -rf $OUTPUT_DIR/usr
# leave ceph tarball around in case we need to inspect core files
echo "Initializing lcov files..."
lcov -d $OUTPUT_DIR/ceph/src -z
lcov -d $OUTPUT_DIR/ceph/src -c -i -o $OUTPUT_DIR/base_full.lcov
lcov -r $OUTPUT_DIR/base_full.lcov /usr/include\* -o $OUTPUT_DIR/base.lcov
rm $OUTPUT_DIR/base_full.lcov
echo "Done."