3 # Copyright (C) 2012 Apple Inc. All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
8 # 1. Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
14 # THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
15 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
18 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 # Script to run selected LayoutTests/fast/{js,regex} tests using jsc
28 jscCmd="/System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc"
29 testRoot=/tmp/LayoutTests
30 resultsRoot=`date \+/tmp/results-%Y-%m-%d-%H-%M-%S`
37 echo "usage: $cmdName [[--jsc | -j] <path-to-jsc>] [[--results-dir | -r] <results-path>]"
38 echo " [[--test-root | -t] <test-root-path>] [[--test-list | -l] <test-list-file>]"
58 echo "Unrecognized option \"$1\""
68 echo "Extra argument \"$1\""
72 if [ $testList = "unset" ]
74 testList=$testRoot/fast/js/jsc-test-list
77 preScript=$testRoot/fast/js/resources/standalone-pre.js
78 postScript=$testRoot/fast/js/resources/standalone-post.js
79 passList=$resultsRoot/passed
80 failList=$resultsRoot/failed
81 crashList=$resultsRoot/crashed
89 rm -f jsc-tests-passed jsc-tests-failed
91 for test in `cat $testList`
95 testName=`basename $test`
96 dirName=`dirname $test`
98 expectedOut="$testRoot/$dirName/${testName}-expected.txt"
99 actualOut="$resultsRoot/$dirName/${testName}-out.txt"
100 actualErr="$resultsRoot/$dirName/${testName}-err.txt"
101 diffOut="$resultsRoot/$dirName/${testName}-diff.txt"
102 jsTest="$testRoot/$dirName/script-tests/${testName}.js"
104 if [ ! -d "$resultsRoot/$dirName" ]
106 mkdir -p "$resultsRoot/$dirName"
109 if [ -f $expectedOut -a -f $jsTest ]
111 echo "Testing $test ... \c"
112 let numTestsRun=$numTestsRun+1
113 $jscCmd $preScript $jsTest $postScript 2>$actualErr > $actualOut
116 if [ $JSC_RES -eq 0 ]
118 diff $actualOut $expectedOut > $diffOut
129 if [ $JSC_RES -gt 128 ]
134 echo "ERROR: $JSC_RES"
138 if [ $testPassed -eq 1 ]
140 echo "$test" >> $passList
141 let numPassed=$numPassed+1
143 echo "$test" >> $failList
144 let numFailed=$numFailed+1
145 if [ $testCrashed -eq 1 ]
147 echo "$test" >> $crashList
148 let numCrashed=$numCrashed+1
154 if [ $numPassed -eq $numTestsRun ]
156 echo "All $numTestsRun tests passed!" | tee $resultsRoot/summary
158 echo "$numPassed tests passed, $numFailed tests failed, $numCrashed tests crashed." | tee $resultsRoot/summary
161 echo "Test results in $resultsRoot"