Fri, 11 Jan 2013 10:40:51 +0100
8005976: Break out AccessSpecializer into one pass before CodeGenerator instead of iterative applications from CodeGenerator
Summary: Now scope and slot information is guaranteed to be fixed AND NOT CHANGE before CodeGeneration. We want to keep it that way to build future type specializations and bring all type work out of CodeGenerator.
Reviewed-by: attila, hannesw
1 #!/bin/bash
2 #
3 # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 #
6 # This code is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License version 2 only, as
8 # published by the Free Software Foundation.
9 #
10 # This code is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # version 2 for more details (a copy is included in the LICENSE file that
14 # accompanied this code).
15 #
16 # You should have received a copy of the GNU General Public License version
17 # 2 along with this work; if not, write to the Free Software Foundation,
18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 #
20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 # or visit www.oracle.com if you need additional information or have any
22 # questions.
23 #
25 #best pass rate at test 262 known
26 TEST262_PASS_AT_LEAST=435
28 RUN_TEST="true"
29 RUN_TEST262="true"
30 RUN_NODE="true"
31 KEEP_OUTPUT="true"
32 CLEAN_AND_BUILD_NASHORN="true"
34 #the stable node version to sync against
35 NODE_LAST_STABLE=v0.6.18
37 #parse args
38 for arg in $*
39 do
40 if [ $arg = "--no-test" ]; then
41 RUN_TEST="false"
42 echo "**** WARNING - you have disabled 'ant test', which is a minimum checkin requirement..."
43 elif [ $arg = "--no-262" ]; then
44 RUN_TEST262="false"
45 elif [ $arg = "--no-node" ]; then
46 RUN_NODE="false"
47 elif [ $arg = "--no-build" ]; then
48 CLEAN_AND_BUILD_NASHORN="false"
49 elif [ $arg = "--no-logs" ]; then
50 KEEP_OUTPUT="false"
51 fi
52 done
54 function lastpart() {
55 arr=$(echo $1 | tr "/" "\n")
56 for x in $arr
57 do
58 _last=$x
59 done
60 echo $_last
61 }
63 function check_installed() {
64 which $1 >/dev/null
65 if [ $? -ne 0 ]; then
66 echo "Error $1 not installed: $?"
67 exit 2
68 fi
69 }
71 check_installed hg
72 check_installed git
73 check_installed mv
74 check_installed git
76 PWD=$(pwd);
78 while [ -z $NASHORN_ROOT ]
79 do
80 if [ -e $PWD/.hg ]; then
81 NASHORN_ROOT=${PWD}
82 break
83 fi
84 PWD=$(dirname ${PWD})
85 done
87 echo "Nashorn root detected at ${NASHORN_ROOT}"
89 COMMON_ROOT=$(dirname $NASHORN_ROOT)
90 echo "Common root is ${COMMON_ROOT}"
92 echo "Running checkintest..."
94 ABSOLUTE_NASHORN_HOME=$COMMON_ROOT/$(lastpart $NASHORN_ROOT)
96 if [ $CLEAN_AND_BUILD_NASHORN != "false" ]; then
97 echo "Cleaning and building nashorn at $ABSOLUTE_NASHORN_HOME/nashorn..."
98 $(cd $ABSOLUTE_NASHORN_HOME/nashorn; ant clean >/dev/null 2>/dev/null)
99 $(cd $ABSOLUTE_NASHORN_HOME/nashorn; ant jar >/dev/null 2>/dev/null)
100 echo "Done."
101 fi
103 function failure_check() {
104 while read line
105 do
106 LINE=$(echo $line | grep "Tests run")
107 if [ "${LINE}" != "" ]; then
108 RESULT=$(echo $line | grep "Failures: 0" | grep "Errors: 0")
109 if [ "${RESULT}" == "" ]; then
110 TESTNAME=$2
111 echo "There were errors in ${TESTNAME} : ${LINE}"
112 exit 1
113 fi
114 fi
115 done < $1
116 }
118 function test() {
119 TEST_OUTPUT=$ABSOLUTE_NASHORN_HOME/$(mktemp tmp.XXXXX)
120 echo "Running 'ant test' on nashorn from ${ABSOLUTE_NASHORN_HOME}/nashorn..."
121 $(cd $ABSOLUTE_NASHORN_HOME/nashorn; ant test >$TEST_OUTPUT)
122 echo "Done."
124 failure_check $TEST_OUTPUT
126 echo "**** SUCCESS: 'ant test' successful"
128 if [ $KEEP_OUTPUT == "true" ]; then
129 cp $TEST_OUTPUT ./checkintest.test.log
130 rm -fr $TEST_OUTPUT
131 fi
132 }
134 if [ $RUN_TEST != "false" ]; then
135 test;
136 fi
138 function test262() {
140 echo "Running 'ant test262parallel' on nashorn from ${ABSOLUTE_NASHORN_HOME}/nashorn..."
141 TEST262_OUTPUT=$ABSOLUTE_NASHORN_HOME/$(mktemp tmp.XXXXX)
143 echo "Looking for ${ABSOLUTE_NASHORN_HOME}/test/test262..."
145 if [ ! -e $ABSOLUTE_NASHORN_HOME/nashorn/test/test262 ]; then
146 echo "test262 is missing... looking in $COMMON_ROOT..."
147 if [ ! -e $COMMON_ROOT/test262 ]; then
148 echo "... not there either... cloning from repo..."
149 hg clone http://hg.ecmascript.org/tests/test262 $COMMON_ROOT/test262 >/dev/null 2>/dev/null
150 echo "Done."
151 fi
152 echo "Adding soft link ${COMMON_ROOT}/test262 -> ${ABSOLUTE_NASHORN_HOME}/test/test262..."
153 ln -s $COMMON_ROOT/test262 $ABSOLUTE_NASHORN_HOME/nashorn/test/test262
154 echo "Done."
155 fi
157 echo "Ensuring test262 is up to date..."
158 $(cd $ABSOLUTE_NASHORN_HOME/nashorn/test/test262; hg pull -u >/dev/null 2>/dev/null)
159 echo "Done."
161 echo "Running test262..."
162 $(cd $ABSOLUTE_NASHORN_HOME/nashorn; ant test262parallel > $TEST262_OUTPUT)
164 FAILED=$(cat $TEST262_OUTPUT|grep "Tests run:"| cut -d ' ' -f 15 |tr -cd '"[[:digit:]]')
165 if [ $FAILED -gt $TEST262_PASS_AT_LEAST ]; then
166 echo "FAILURE: There are ${FAILED} failures in test262 and can be no more than ${TEST262_PASS_AT_LEAST}"
167 cp $TEST262_OUTPUT ./checkintest.test262.log
168 echo "See ./checkintest.test262.log"
169 echo "Terminating due to error"
170 exit 1
171 elif [ $FAILED -lt $TEST262_PASS_AT_LEAST ]; then
172 echo "There seem to have been fixes to 262. ${FAILED} < ${TEST262_PASS_AT_LEAST}. Please update limit in bin/checkintest.sh"
173 fi
175 echo "**** SUCCESS: Test262 passed with no more than ${TEST262_PASS_AT_LEAST} failures."
177 if [ $KEEP_OUTPUT == "true" ]; then
178 cp $TEST262_OUTPUT ./checkintest.test262.log
179 rm -fr $TEST262_OUTPUT
180 fi
181 }
183 if [ $RUN_TEST262 != "false" ]; then
184 test262;
185 fi;
187 function testnode() {
188 TESTNODEJAR_OUTPUT=$ABSOLUTE_NASHORN_HOME/$(mktemp tmp.XXXXX)
190 echo "Running node tests..."
191 #replace node jar properties nashorn with this nashorn
193 NODEJAR_PROPERTIES=~/nodejar.properties
195 NODE_HOME=$(cat $NODEJAR_PROPERTIES | grep ^node.home | cut -f2 -d=)
196 NASHORN_HOME=$(cat $NODEJAR_PROPERTIES | grep ^nashorn.home | cut -f2 -d=)
198 ABSOLUTE_NODE_HOME=$COMMON_ROOT/$(lastpart $NODE_HOME)
200 echo "Writing nodejar.properties..."
202 cat > $NODEJAR_PROPERTIES << EOF
203 node.home=../node
204 nashorn.home=../$(lastpart $NASHORN_ROOT)
205 EOF
206 echo "Done."
207 echo "Checking node home ${ABSOLUTE_NODE_HOME}..."
209 if [ ! -e $ABSOLUTE_NODE_HOME ]; then
210 echo "Node base dir not found. Cloning node..."
211 $(cd $COMMON_ROOT; git clone https://github.com/joyent/node.git $(lastpart $NODE_HOME) >/dev/null 2>/dev/null)
212 echo "Done."
213 echo "Updating to last stable version ${NODE_LAST_STABLE}..."
214 $(cd $ABSOLUTE_NODE_HOME; git checkout $NODE_LAST_STABLE >/dev/null 2>/dev/null)
215 echo "Done."
216 echo "Running configure..."
217 $(cd $ABSOLUTE_NODE_HOME; ./configure >/dev/null 2>/dev/null)
218 echo "Done."
219 fi
221 echo "Ensuring node is built..."
222 #make sure node is built
223 $(cd $ABSOLUTE_NODE_HOME; make >/dev/null 2>/dev/null)
224 echo "Done."
226 NODEJAR_HOME=$COMMON_ROOT/nodejar
228 if [ ! -e $NODEJAR_HOME ]; then
229 echo "No node jar home found. cloning from depot..."
230 $(cd $COMMON_ROOT; hg clone https://hg.kenai.com/hg/nodejs~source nodejar >/dev/null 2>/dev/null)
231 $(cd $COMMON_ROOT/nodejar; ant >/dev/null)
232 echo "Done."
233 echo "Copying node files..."
234 $(cd $COMMON_ROOT/nodejar; ant copy-node-files >/dev/null 2>/dev/null)
235 echo "Patching node files..."
236 $(cd $COMMON_ROOT/nodejar; ant patch-node-files >/dev/null 2>/dev/null)
237 echo "Done."
238 fi
240 echo "Ensuring node.jar is up to date from source depot..."
241 $(cd $COMMON_ROOT/nodejar; hg pull -u >/dev/null 2>/dev/null)
242 echo "Done."
244 echo "Installing nashorn..."
245 $(cd $COMMON_ROOT/nodejar; ant >/dev/null)
246 echo "Done."
248 echo "Running node.jar test..."
249 $(cd $COMMON_ROOT/nodejar; mvn clean verify >$TESTNODEJAR_OUTPUT)
250 echo "Done."
252 failure_check $TESTNODEJAR_OUTPUT
254 echo "**** SUCCESS: Node test successful."
256 if [ $KEEP_OUTPUT == "true" ]; then
257 rm -fr $TESTNODEJAR_OUTPUT
258 cp $TESTNODEJAR_OUTPUT ./checkintest.nodejar.log
259 fi
260 }
262 if [ $RUN_NODE != "false" ]; then
263 testnode;
264 fi;
266 echo "Finished"