forked from irods/irods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_coverage_test.sh
executable file
·56 lines (49 loc) · 1.48 KB
/
run_coverage_test.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
SCRIPTNAME=`basename $0`
# check arguments
if [ $# -lt 1 -o $# -gt 2 ] ; then
echo "Usage: $SCRIPTNAME username [nose parameter(s)]"
exit 1
fi
if [ $# -eq 2 ] ; then
NOSECMD="nosetests $2"
else
NOSECMD="nosetests *.py"
fi
# check lcov version
LCOVVERSION=`lcov --version | awk '{print $4}'`
LCOVVERSIONMAJOR=`echo $LCOVVERSION | awk -F'.' '{print $1}'`
if (( "$LCOVVERSIONMAJOR" < "1" )); then
echo "ERROR: LCOV is version [$LCOVVERSION] ... this script requires >= 1.8"
exit 1
elif (( "$LCOVVERSIONMAJOR" == "1" )); then
LCOVVERSIONMINOR=`echo $LCOVVERSION | awk -F'.' '{print $2}'`
if (( "$LCOVVERSIONMINOR" < "8" )); then
echo "ERROR: LCOV is version [$LCOVVERSION] ... this script requires >= 1.8"
exit 1
fi
fi
# prep
USERNAME=$1
D=`date +%Y%m%dT%H%M%S`
echo "DETECTED: username[$USERNAME] timestamp[$D]"
# sync
echo "----- SYNCING TEST FILES -----"
rsync -avz /home/$USERNAME/irods/tests/ ./
# coverage baseline
echo "----- GENERATING COVERAGE BASELINE -----"
/var/lib/irods/tests/coverage-pre.sh 2>&1 | tail -n1
# tests
echo "----- RUNNING TESTS -----"
echo "running: [$NOSECMD]"
$NOSECMD
# coverage report
if [ "$?" == "0" ] ; then
echo "----- GENERATING COVERAGE REPORT -----"
/var/lib/irods/tests/coverage-post.sh 2>&1 | tail -n4
echo "--> coverageresults-$D"
mv /var/lib/irods/coverageresults coverageresults-$D
echo "----- SYNCING COVERAGE REPORT TO WWW -----"
rsync -az ./coverageresults-$D/ /var/www/dev
echo "http://127.0.0.1:8080/dev"
fi