forked from dherman/es4
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run-spidermonkey-tests.sh
executable file
·106 lines (96 loc) · 3.19 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
# The following licensing terms and conditions apply and must be
# accepted in order to use the Reference Implementation:
#
# 1. This Reference Implementation is made available to all
# interested persons on the same terms as Ecma makes available its
# standards and technical reports, as set forth at
# http://www.ecma-international.org/publications/.
#
# 2. All liability and responsibility for any use of this Reference
# Implementation rests with the user, and not with any of the parties
# who contribute to, or who own or hold any copyright in, this Reference
# Implementation.
#
# 3. THIS REFERENCE IMPLEMENTATION IS PROVIDED BY THE COPYRIGHT
# HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# End of Terms and Conditions
#
# Copyright (c) 2007 Adobe Systems Inc., The Mozilla Foundation, Opera
# Software ASA, and others.
#
# Usage:
# run-spidermonkey-tests.sh [-p prefix] [-d dirname] [-v] [limit]
#
# Options:
# -v causes output to go to stdout instead of the logfile (used for autobuilds)
# -p selects a test file prefix (eg 15.10 for regexp tests)
# -s selects a section name (eg Array for array tests)
# -n dry run
#
# Observe that -p and -d are not redundant because test files in some
# directories do not have predictable prefixes (eg many regexp tests start
# with the prefix "regress-").
LIMIT=""
PREFIX=""
SECNAME=""
VERBOSE=0
NOEXEC=0
ROOT=tests/spidermonkey
LOG=spidermonkey-test.log
rm -f $LOG
#Open LOG with file descriptor 6
exec 6<> $LOG
while getopts "p:s:vn" OPTIONS
do
case $OPTIONS in
p) PREFIX=$OPTARG ;;
s) SECNAME=$OPTARG ;;
v) exec 6>&1; VERBOSE=1 ;; #redirect fd 6 to stdout instead of logfile
n) NOEXEC=1 ;;
esac
done
shift $(($OPTIND -1))
LIMIT=$1
if [ $NOEXEC = 0 ]; then
make dump 1>&6 2>&6
fi
for ECMA in $ROOT/ecma*
do
for SECTION in $(find $ECMA -mindepth 1 -maxdepth 1 -type d)
do
if [[ $SECNAME == "" || $(basename $SECTION) == $SECNAME ]]; then
for FILE in $(find $SECTION -type f -name $PREFIX\*.js)
do
# -z:string is null, -o:logical OR
if [ \( -z "$LIMIT" \) -o \( "$LIMIT" == $( dirname $FILE ) \) ]; then
echo $FILE
if [ $NOEXEC = 0 ]; then
if [ -s $SECTION/shell.js ]; then
make run-dumped FLAGS=-3 FILE="$ECMA/shell.js $SECTION/shell.js $FILE" 1>&6 2>&6
else
make run-dumped FLAGS=-3 FILE="$ECMA/shell.js $FILE" 1>&6 2>&6
fi
fi
fi
done
fi
done
done
if [[ $VERBOSE == 0 ]]
then
#close fd 6
exec 6>&-
fi
perl analyze-spidermonkey-log.pl $LOG