forked from data61/mirza-archived
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoverage.sh
executable file
·42 lines (36 loc) · 1.06 KB
/
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
40
41
42
#!/usr/bin/env bash
# Usage: ./coverage.sh [--launch] [rest of args]
export n=0
export enable_report_launch=false
unset args
# Gets rid of the `--launch` flag
for i in "$@"
do
if [ "$i" = "--launch" ]
then
enable_report_launch=true
else
# Storing everything other than --launch in `args`
args[$((n++))]="$i"
fi
shift
done
if [ "$enable_report_launch" = true ]
then
# The line where the link is starts with this phrase
export report_link_header="An index of the generated HTML coverage reports is available at "
echo "Report is being generated. Please wait..."
test_report=`./run_tests.sh --coverage "${args[@]}" 2>&1 |
egrep -i "$report_link_header" |
sed "s/$report_link_header//g"`
echo "Report generation complete."
echo "Your report lives in $test_report"
echo "$OSTYPE"
case "$OSTYPE" in
"darwin"*) open $test_report ;;
"linux"*) sensible-browser $test_report ;;
*) echo "Please open $test_report in your favorite browser" ;;
esac
else
./run_tests.sh --coverage "${args[@]}"
fi