-
Notifications
You must be signed in to change notification settings - Fork 8
/
run-spidermonkey-tests.sh
executable file
·70 lines (58 loc) · 1.41 KB
/
run-spidermonkey-tests.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
#
# Usage:
# run-spidermonkey-tests.sh [-p prefix] [limit]
LIMIT=""
PREFIX=""
ROOT=tests/spidermonkey
LOG=spidermonkey-test.log
rm -f $LOG
if [ "$1" = "-p" ]; then
PREFIX=$2
shift ; shift
fi
LIMIT=$1
for ECMA in $ROOT/ecma*
do
for SECTION in $(find $ECMA -mindepth 1 -maxdepth 1 -type d)
do
for FILE in $(find $SECTION -type f -name $PREFIX\*.js)
do
if [ \( -z "$LIMIT" \) -o \( "$LIMIT" == $( dirname $FILE ) \) ]
then
echo $FILE
if [ -s $SECTION/shell.js ]
then
make run FILE="$ECMA/shell.js $SECTION/shell.js $FILE" >>$LOG 2>&1
else
make run FILE="$ECMA/shell.js $FILE" >>$LOG 2>&1
fi
fi
done
done
done
echo "----------------------------------------------"
echo "TOTALS"
if [ ! -z $LIMIT ]
then
echo " (under $LIMIT)"
fi
echo "----------------------------------------------"
function count {
grep -F -c "$1" "$LOG"
}
function percent {
echo "scale=2; 100 * ($1 / ($1 + $2))" | bc
}
function report {
printf "%10.10s=%-.f, %10.10s=%-.f (%.2f%% %s)\n" $1 $2 $3 $4 $(percent $2 $4) $1
}
FINISHED=$(count 'evaluated!')
CRASHED=$(( $(count '**ERROR**') + $(count 'Alarm clock') ))
PASSED=$(count 'PASSED!')
FAILED=$(count 'FAILED!')
echo -n "tests in suite:"
report "FINISHED" $FINISHED "CRASHED" $CRASHED
echo -n "cases in tests:"
report "PASSED" $PASSED "FAILED" $FAILED
echo "----------------------------------------------"