aboutsummaryrefslogtreecommitdiffstats
path: root/trunk/infrastructure/rhino1_7R1/testsrc
diff options
context:
space:
mode:
authoralexanders@b2ef00c0-3703-41da-baef-cfe82387ac0c <none@none>2010-02-03 00:48:31 +0000
committeralexanders@b2ef00c0-3703-41da-baef-cfe82387ac0c <none@none>2010-02-03 00:48:31 +0000
commit1a5e3c2d64be1c05a422fd78b23a31de155eca64 (patch)
tree71b2236dd23d409b0ce8a9576758123922b57898 /trunk/infrastructure/rhino1_7R1/testsrc
parent4a9748e10084ca99fadec4f0fb1a3c22af7f3794 (diff)
downloadetherpad-1a5e3c2d64be1c05a422fd78b23a31de155eca64.tar.gz
etherpad-1a5e3c2d64be1c05a422fd78b23a31de155eca64.tar.xz
etherpad-1a5e3c2d64be1c05a422fd78b23a31de155eca64.zip
removed duplicate trunk directory
--HG-- extra : convert_revision : svn%3Ab2ef00c0-3703-41da-baef-cfe82387ac0c/trunk%404
Diffstat (limited to 'trunk/infrastructure/rhino1_7R1/testsrc')
-rw-r--r--trunk/infrastructure/rhino1_7R1/testsrc/base.skip685
-rw-r--r--trunk/infrastructure/rhino1_7R1/testsrc/build.xml183
-rw-r--r--trunk/infrastructure/rhino1_7R1/testsrc/opt1.skip26
-rw-r--r--trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/JsDriver.java838
-rw-r--r--trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/ShellTest.java346
-rw-r--r--trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/StandardTests.java212
-rw-r--r--trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/results.html105
-rw-r--r--trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/tests/Bug409702Test.java49
-rw-r--r--trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/tests/JavaAcessibilityTest.java99
-rw-r--r--trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/tests/PrivateAccessClass.java89
10 files changed, 2632 insertions, 0 deletions
diff --git a/trunk/infrastructure/rhino1_7R1/testsrc/base.skip b/trunk/infrastructure/rhino1_7R1/testsrc/base.skip
new file mode 100644
index 0000000..35d6c54
--- /dev/null
+++ b/trunk/infrastructure/rhino1_7R1/testsrc/base.skip
@@ -0,0 +1,685 @@
+# Rhino base skip list: these are tests that are always skipped for Rhino
+
+# These tests are skipped by Rhino either because a bug with a regression
+# test has yet to be fixed, or because the test is not applicable to Rhino.
+#
+
+# timer resolution test
+js1_5/extensions/regress-363258.js
+
+# Needs investigation
+js1_7/regress/regress-406477.js
+e4x/extensions/regress-410192.js
+
+# should be investigated: OutOfMemoryError
+js1_5/Regress/regress-330352.js
+
+# test consumes much memory, will get OutOfMemoryError depending on JVM
+# settings
+js1_5/extensions/regress-367501-04.js
+
+# stress test that can potentially time out
+js1_5/Regress/regress-404755.js
+
+# should be investigated: semicolon insertion
+ecma_3/LexicalConventions/7.9.1.js
+ecma_3/extensions/7.9.1.js
+
+# tests that do not work on non-English locales or for timezones outside the US
+ecma_3/Date/15.9.5.5.js
+js1_5/Regress/regress-58116.js
+
+# Fails on Macs?
+lc2/JavaToJS/char-002.js
+
+# Stress test; Reports of StackOverflowError (Mac only?)
+js1_5/Regress/regress-98901.js
+
+# performance regression test
+js1_5/Array/regress-99120-01.js
+js1_5/extensions/regress-371636.js
+
+# large concatenation of strings
+js1_5/Function/regress-338121-01.js
+js1_5/Function/regress-338121-02.js
+js1_5/Function/regress-338121-03.js
+
+# needs investigation: Date corner case
+ecma_3/Date/15.9.5.5-02.js
+
+# Infinite recursion
+e4x/Regress/regress-394941.js
+
+# GC tests
+js1_5/GC
+
+# bad test: random string generated will be too long about 1% of the time
+lc3/JavaArray/ToArray-001.js
+
+# would imply we would always need an activation for every non-leaf func
+js1_5/Regress/regress-383682.js
+
+# test depends on E4X, but test framework calls version(150)
+js1_5/Regress/regress-309242.js
+
+# performance test: Global vars should not be more than 2.5 times slower than local
+js1_5/Regress/regress-169559.js
+
+# infinite recursion
+js1_5/Regress/regress-234389.js
+
+# object watch not implemented
+js1_5/Regress/regress-240577.js
+js1_5/Function/regress-364023.js
+js1_5/Object/regress-362872-01.js
+js1_5/Object/regress-362872-02.js
+js1_5/Regress/regress-385393-06.js
+js1_5/extensions/regress-385393-09.js
+js1_7/GC/regress-381374.js
+
+# toLocaleFormat not implemented
+js1_5/extensions/toLocaleFormat-01.js
+js1_5/extensions/toLocaleFormat-02.js
+
+# source too complex
+js1_5/Expressions/regress-394673.js
+
+# import, export not implemented
+js1_5/Regress/regress-249211.js
+js1_7/lexical/regress-346642-03.js
+
+# concatentated string too large
+js1_5/Regress/regress-280769-1.js
+
+# stack overflow
+js1_5/Regress/regress-280769-2.js
+
+# performance tests
+js1_5/Regress/regress-313967-01.js
+js1_5/Regress/regress-313967-02.js
+js1_5/Array/regress-99120-02.js
+
+# concatentated string too large
+js1_5/Regress/regress-347306-01.js
+
+# import, export not implemented
+js1_5/decompilation/regress-349484.js
+
+# concatenated string too large
+js1_5/String/regress-157334-01.js
+js1_5/String/regress-56940-01.js
+js1_5/String/regress-56940-02.js
+
+# runs out of heap
+js1_5/Regress/regress-271716-n.js
+js1_5/Regress/regress-303213.js
+js1_5/Regress/regress-312588.js
+js1_5/Array/regress-157652.js
+js1_5/Regress/regress-330352.js
+
+# Tests that create very large strings by concatentation
+js1_5/extensions/regress-336409-1.js
+js1_5/extensions/regress-336409-2.js
+js1_5/extensions/regress-336410-1.js
+js1_5/extensions/regress-336410-2.js
+e4x/XML/regress-324422-1.js
+js1_5/Function/regress-338001.js
+js1_5/Regress/regress-159334.js
+js1_5/Regress/regress-191633.js
+js1_5/Regress/regress-280769-3.js
+js1_5/Regress/regress-280769-4.js
+js1_5/String/regress-314890.js
+js1_5/String/regress-322772.js
+js1_5/extensions/regress-363988.js
+
+# bug 152646 Will not fix this in Rhino; too much of a corner case
+js1_5/Regress/regress-152646.js
+
+#Verify error for bad branch
+js1_5/Regress/regress-96526-001.js
+js1_5/Regress/regress-96526-002.js
+js1_5/Regress/regress-96526-003.js
+
+# JSObject not used for Rhino LiveConnect
+lc3/ConvertJSObject
+lc3/Exceptions/throw_js_types.js
+lc3/JavaClass/ToJSObject-001.js
+lc3/JSObject/ToJSObject-001.js
+
+#Rhino implements Date.toLocaleTimeString() differently than SpiderMonkey
+ecma_3/Date/15.9.5.7.js
+
+#Rhino - as permitted by ECMA - does not allow indirect calls to eval
+js1_4/Eval/eval-001.js
+js1_4/Eval/eval-002.js
+js1_4/Eval/eval-003.js
+js1_5/Regress/regress-68498-003.js
+
+#Rhino compiled mode is limited by Java classfile size limitations
+#js1_5/Regress/regress-80981.js
+#js1_5/Regress/regress-90445.js
+#js1_5/Regress/regress-111557.js
+
+#Rhino relies on JVM to throw StackOverflow exception and does not
+#detect too deep recursion explicitly.
+js1_5/extensions/regress-192465.js
+js1_5/extensions/regress-226507.js
+js1_5/Regress/regress-89443.js
+
+# Skip these two; see http://bugzilla.mozilla.org/show_bug.cgi?id=81086, large
+# switch statement
+#ecma_3/Statements/regress-74474-002.js
+#ecma_3/Statements/regress-74474-003.js
+#Compiled mode cannot catch infinite recursion errors
+js1_5/Regress/regress-96128-n.js
+js1_5/Exceptions/regress-121658.js
+
+# This test uses the (non-ECMA) 'it' object of SpiderMonkey
+js1_2/version120/regress-99663.js
+
+# This test uses the gc() function of SpiderMonkey
+ecma_3/Function/regress-104584.js
+
+#This test uses the Error.stack property of SpiderMonkey (non-ECMA)
+js1_5/Exceptions/errstack-001.js
+
+#This test uses the clone() function in SpiderMonkey's js.c file
+#js1_5/Regress/regress-127557.js # apparently works, which doesn't make sense
+
+#These tests break with new Unicode in JDK 1.4
+ecma/String/15.5.4.11-2.js
+ecma/String/15.5.4.11-5.js
+ecma/String/15.5.4.12-1.js
+ecma/String/15.5.4.12-4.js
+ecma/String/15.5.4.12-5.js
+
+# Rhino doesn't implement the (non-ECMA) f.caller property
+js1_5/Function/regress-222029-001.js
+js1_5/Function/regress-222029-002.js
+
+# WONTFIX bug 119719
+js1_5/Regress/regress-119719.js
+
+# Bug Number 240317 relaxed errors for reserved identifiers but Rhino did not
+js1_5/Regress/regress-240317.js
+
+# Spidermonkey now defaults lineNumber and fileName
+# to the location and file where the exception occured.
+# exclude new test which assumes the defaults are
+# set according to Spidermonkey.
+js1_5/extensions/regress-50447-1.js
+
+# Invalid bug
+e4x/Regress/regress-278112.js
+
+# Invalid test? Cannot convert NaN to java.lang.Long
+lc3/template.js
+
+# Depends on generators being closed due to a call to gc(). Java finalizers
+# are not run immediately in a call to gc(), but instead usuallly are run
+# later on a different thread.
+js1_7/geniter/regress-347739.js
+js1_7/geniter/regress-349012-01.js
+js1_7/geniter/regress-349331.js
+
+# function named "yield"
+js1_7/lexical/regress-351515.js
+
+# unimplemented "options" shell function
+js1_7/block/regress-347559.js
+js1_5/Regress/regress-383674.js
+
+# decompilation
+js1_7/block/regress-344601.js
+js1_7/block/regress-351794.js
+js1_5/Regress/regress-10278.js
+
+# bad test: will fail if time of day increments a second between calls to Date()
+ecma/Date/15.9.2.1.js
+ecma/Date/15.9.2.2-2.js
+
+# JS 1.7 not yet implemented
+js1_7/decompilation
+# "y" flag for regexps
+js1_7/regexp/yflag.js
+# yield and xml-filtering predicate
+js1_7/geniter/regress-352605.js
+# js1_7 needs investigation
+js1_7/extensions/basic-for-each.js
+js1_7/extensions/regress-346642-06.js
+js1_7/extensions/regress-351102-03.js
+js1_7/extensions/regress-351102-04.js
+js1_7/extensions/regress-351102-05.js
+js1_7/extensions/regress-351102-07.js
+js1_7/extensions/regress-353214-01.js
+js1_7/extensions/regress-353214-02.js
+js1_7/extensions/regress-353249.js
+js1_7/extensions/regress-353454.js
+js1_7/extensions/regress-354945-02.js
+js1_7/extensions/regress-355145.js
+js1_7/extensions/regress-367629.js
+js1_7/extensions/regress-368213.js
+js1_7/extensions/regress-368224.js
+js1_7/extensions/regress-379482.js
+js1_7/extensions/regress-379566.js
+js1_7/extensions/regress-381301.js
+js1_7/extensions/regress-381303.js
+js1_7/iterable/regress-340526-02.js
+js1_7/regress/regress-350387.js
+js1_7/regress/regress-351503-01.js
+js1_7/regress/regress-351503-02.js
+js1_7/regress/regress-352870-01.js
+js1_7/regress/regress-352870-02.js
+js1_7/regress/regress-363040-01.js
+js1_7/regress/regress-363040-02.js
+js1_7/regress/regress-375695.js
+js1_7/regress/regress-379483.js
+
+# JS 1.8 not yet implemented
+js1_8
+
+# nondeterministic
+js1_5/Regress/regress-211590.js
+
+# long-running tests
+ecma/Date/15.9.5.10-2.js
+ecma/Date/15.9.5.11-2.js
+ecma/Date/15.9.5.12-2.js
+ecma/Date/15.9.5.8.js
+js1_5/Regress/regress-366122.js
+
+# "options" built-in function
+ecma_2/Exceptions/lexical-011.js
+ecma_2/Exceptions/lexical-014.js
+ecma_2/Exceptions/lexical-016.js
+ecma_2/Exceptions/lexical-021.js
+ecma_2/LexicalConventions/keywords-001.js
+js1_6/Regress/regress-378492.js
+js1_5/Regress/regress-115436.js
+js1_5/Regress/regress-214761.js
+js1_5/Regress/regress-253150.js
+js1_5/Regress/regress-306633.js
+js1_7/iterable/regress-355075-01.js
+js1_7/iterable/regress-355075-02.js
+
+# Function "exec" must be called directly, and not by way of a function of
+# another name.
+js1_5/extensions/regress-367119-01.js
+js1_5/extensions/regress-367119-02.js
+
+# Obsolete JS 1.2 behavior
+js1_2/operator/equality.js
+js1_3/regress/function-001-n.js
+js1_3/Script/function-001-n.js
+js1_2/function/function-001-n.js
+ecma_2/Exceptions/function-001.js
+
+# likely bugs. need investigation
+js1_6/Array/regress-386030.js
+ecma_3/Array/regress-387501.js
+js1_7/lexical/regress-336376-01.js
+
+# minor decompilation incompatibility
+js1_5/extensions/regress-384680.js
+
+# uninvestigated failures. May be some bugs in here.
+e4x/Regress/regress-373082.js
+e4x/XML/regress-376773.js
+e4x/decompilation/regress-352013.js
+e4x/decompilation/regress-352789.js
+e4x/extensions/regress-374163.js
+js1_5/Regress/regress-346237.js
+js1_5/decompilation/regress-351219.js
+js1_5/decompilation/regress-352453.js
+js1_5/decompilation/regress-353146.js
+js1_5/decompilation/regress-375882.js
+js1_5/extensions/regress-330569.js
+js1_5/extensions/regress-351448.js
+js1_5/extensions/regress-355736.js
+js1_5/extensions/regress-374589.js
+e4x/Expressions/11.1.4-01.js
+e4x/Expressions/11.1.4-02.js
+e4x/Expressions/11.1.4-03.js
+e4x/Expressions/11.1.4-04.js
+e4x/Expressions/11.1.4-08.js
+e4x/Expressions/11.1.4.js
+e4x/Expressions/11.6.1.js
+e4x/GC/regress-280844-1.js
+e4x/GC/regress-280844-1.js
+e4x/GC/regress-280844-2.js
+e4x/GC/regress-280844-2.js
+e4x/GC/regress-313952-02.js
+e4x/GC/regress-324278.js
+e4x/GC/regress-324278.js
+e4x/GC/regress-339785.js
+e4x/GC/regress-357063-01.js
+e4x/GC/regress-357063-02.js
+e4x/Global/13.1.2.1.js
+e4x/Regress/regress-257679.js
+e4x/Regress/regress-278112.js
+e4x/Regress/regress-308111.js
+e4x/Regress/regress-308111.js
+e4x/Regress/regress-309897.js
+e4x/Regress/regress-309897.js
+e4x/Regress/regress-311580.js
+e4x/Regress/regress-319872.js
+e4x/Regress/regress-319872.js
+e4x/Regress/regress-321547.js
+e4x/Regress/regress-322499.js
+e4x/Regress/regress-323338-1.js
+e4x/Regress/regress-323338-2.js
+e4x/Regress/regress-327564.js
+e4x/Regress/regress-329257.js
+e4x/Regress/regress-331558.js
+e4x/Regress/regress-344455.js
+e4x/Regress/regress-347155.js
+e4x/Regress/regress-347155.js
+e4x/decompilation/regress-350226.js
+e4x/Regress/regress-350238.js
+e4x/decompilation/regress-350531.js
+e4x/Regress/regress-350629.js
+e4x/decompilation/regress-351706.js
+e4x/decompilation/regress-351988.js
+e4x/Regress/regress-352097.js
+e4x/Regress/regress-352223.js
+e4x/decompilation/regress-352649.js
+e4x/Regress/regress-354998.js
+e4x/Regress/regress-355478.js
+e4x/Regress/regress-356238-02.js
+e4x/Regress/regress-356238-03.js
+e4x/Regress/regress-361451.js
+e4x/Regress/regress-364017.js
+e4x/Regress/regress-369740.js
+e4x/Regress/regress-370016.js
+e4x/Regress/regress-370048-01.js
+e4x/Regress/regress-370048-02.js
+e4x/Regress/regress-370372.js
+e4x/Regress/regress-371369.js
+e4x/Regress/regress-372563.js
+e4x/TypeConversion/10.2.1.js
+e4x/TypeConversion/10.5.1.js
+e4x/TypeConversion/10.5.js
+e4x/TypeConversion/10.6.1.js
+e4x/TypeConversion/10.6.js
+e4x/TypeConversion/regress-302097.js
+e4x/Types/9.1.1.10.js
+e4x/Types/9.1.1.11.js
+e4x/Types/9.1.1.12.js
+e4x/Types/9.1.1.13.js
+e4x/Types/9.1.1.4.js
+e4x/Types/9.1.1.5.js
+e4x/Types/9.1.1.7.js
+e4x/Types/9.1.1.8.js
+e4x/Types/9.1.1.9.js
+e4x/Types/9.2.1.10.js
+e4x/Types/9.2.1.3.js
+e4x/Types/9.2.1.4.js
+e4x/Types/9.2.1.5.js
+e4x/Types/9.2.1.6.js
+e4x/Types/9.2.1.7.js
+e4x/Types/9.2.1.9.js
+e4x/XML/13.4.3.js
+e4x/XML/13.4.4.1.js
+e4x/XML/13.4.4.10.js
+e4x/XML/13.4.4.17.js
+e4x/XML/13.4.4.26.js
+e4x/XML/13.4.4.28.js
+e4x/XML/13.4.4.3-01.js
+e4x/XML/13.4.4.3-02.js
+e4x/XML/regress-324422-2.js
+e4x/XMLList/regress-373072.js
+e4x/decompilation/decompile-xml-escapes.js
+e4x/extensions/regress-312196.js
+e4x/extensions/regress-313080.js
+e4x/extensions/regress-337226.js
+e4x/extensions/regress-352846-01.js
+e4x/extensions/regress-352846-02.js
+e4x/extensions/regress-352846-03.js
+e4x/extensions/regress-353165.js
+ecma/Array/15.4.3.1-2.js
+ecma/Array/15.4.5.1-1.js
+ecma/Boolean/15.6.3.1-1.js
+ecma/FunctionObjects/15.3.3.1-2.js
+ecma/Number/15.7.3.1-3.js
+ecma/ObjectObjects/15.2.3.1-1.js
+ecma/Statements/12.6.3-11.js
+ecma/Statements/12.6.3-2.js
+ecma/String/15.5.3.1-1.js
+ecma/String/15.5.4.11-2.js
+ecma/String/15.5.4.11-5.js
+ecma/String/15.5.4.12-1.js
+ecma/String/15.5.4.12-4.js
+ecma/String/15.5.4.12-5.js
+ecma_2/RegExp/exec-001.js
+ecma_2/RegExp/regexp-enumerate-001.js
+ecma_2/String/replace-001.js
+ecma_2/instanceof/instanceof-003.js
+ecma_3/Array/regress-322135-02.js
+ecma_3/Array/regress-322135-03.js
+ecma_3/Array/regress-322135-04.js
+ecma_3/Date/15.9.3.2-1.js
+ecma_3/Exceptions/15.11.7.6-001.js
+ecma_3/Object/8.6.1-01.js
+ecma_3/RegExp/regress-188206.js
+ecma_3/RegExp/regress-289669.js
+ecma_3/RegExp/regress-307456.js
+ecma_3/RegExp/regress-309840.js
+ecma_3/RegExp/regress-311414.js
+ecma_3/RegExp/regress-330684.js
+ecma_3/RegExp/regress-334158.js
+ecma_3/RegExp/regress-367888.js
+ecma_3/Statements/regress-121744.js
+ecma_3/String/15.5.4.14.js
+ecma_3/String/regress-304376.js
+ecma_3/extensions/regress-274152.js
+js1_1/regress/function-001.js
+js1_2/function/Function_object.js
+js1_2/function/regexparg-1.js
+js1_2/function/tostring-1.js
+js1_2/function/tostring-2.js
+js1_2/version120/regress-99663.js
+js1_4/Eval/eval-001.js
+js1_4/Eval/eval-002.js
+js1_4/Eval/eval-003.js
+js1_5/Array/regress-313153.js
+js1_5/Array/regress-330812.js
+js1_5/Array/regress-345961.js
+js1_5/Array/regress-350256-03.js
+js1_5/Array/regress-364104.js
+js1_5/Date/regress-301738-02.js
+js1_5/Date/regress-309925-02.js
+js1_5/Date/regress-346363.js
+js1_5/Date/toLocaleFormat.js
+js1_5/Exceptions/errstack-001.js
+js1_5/Exceptions/regress-121658.js
+js1_5/Exceptions/regress-315147.js
+js1_5/Exceptions/regress-332472.js
+js1_5/Exceptions/regress-333728.js
+js1_5/Exceptions/regress-342359.js
+js1_5/Exceptions/regress-350650-n.js
+js1_5/decompilation/regress-346902.js
+js1_5/decompilation/regress-346904.js
+js1_5/Expressions/regress-96526-delelem.js
+js1_5/Function/regress-222029-001.js
+js1_5/Function/regress-222029-002.js
+js1_5/Function/regress-344120.js
+js1_5/GC/regress-203278-2.js
+js1_5/GC/regress-278725.js
+js1_5/GC/regress-316885-01.js
+js1_5/GC/regress-324278.js
+js1_5/GC/regress-346794.js
+js1_5/GC/regress-348532.js
+js1_5/GetSet/getset-002.js
+js1_5/GetSet/regress-353264.js
+js1_5/LexicalConventions/regress-343675.js
+js1_5/Object/regress-308806-01.js
+js1_5/Regress/regress-103602.js
+js1_5/Regress/regress-106244.js
+js1_5/Regress/regress-119719.js
+js1_5/Regress/regress-139316.js
+js1_5/Regress/regress-173067.js
+js1_5/Regress/regress-203278-1.js
+js1_5/Regress/regress-213482.js
+js1_5/Regress/regress-247179.js
+js1_5/Regress/regress-248444.js
+js1_5/Regress/regress-252892.js
+js1_5/Regress/regress-261886.js
+js1_5/Regress/regress-261887.js
+js1_5/Regress/regress-274035.js
+js1_5/Regress/regress-280769-5.js
+js1_5/Regress/regress-280769.js
+js1_5/Regress/regress-281606.js
+js1_5/Regress/regress-290575.js
+js1_5/Regress/regress-294302.js
+js1_5/Regress/regress-315974.js
+js1_5/Regress/regress-317533.js
+js1_5/Regress/regress-319391.js
+js1_5/Regress/regress-320119.js
+js1_5/Regress/regress-321971.js
+js1_5/Regress/regress-323314-1.js
+js1_5/Regress/regress-325925.js
+js1_5/Regress/regress-328664.js
+js1_5/Regress/regress-329530.js
+js1_5/Regress/regress-334807-02.js
+js1_5/Regress/regress-334807-04.js
+js1_5/Regress/regress-336100.js
+js1_5/decompilation/regress-346892.js
+js1_5/decompilation/regress-346915.js
+js1_5/decompilation/regress-349491.js
+js1_5/decompilation/regress-349596.js
+js1_5/Regress/regress-349648.js
+js1_5/decompilation/regress-349650.js
+js1_5/decompilation/regress-350242.js
+js1_5/decompilation/regress-350263.js
+js1_5/Regress/regress-350268.js
+js1_5/decompilation/regress-350271.js
+js1_5/decompilation/regress-350666.js
+js1_5/Regress/regress-350692.js
+js1_5/decompilation/regress-351104.js
+js1_5/decompilation/regress-351597.js
+js1_5/decompilation/regress-351693.js
+js1_5/decompilation/regress-351793.js
+js1_5/Regress/regress-352009.js
+js1_5/decompilation/regress-352013.js
+js1_5/Regress/regress-352197.js
+js1_5/decompilation/regress-352202.js
+js1_5/decompilation/regress-352375.js
+js1_5/decompilation/regress-352649.js
+js1_5/decompilation/regress-353000.js
+js1_5/Regress/regress-354924.js
+js1_5/Regress/regress-355341.js
+js1_5/Regress/regress-355344.js
+js1_5/Regress/regress-355556.js
+js1_5/decompilation/regress-355992.js
+js1_5/Regress/regress-356693.js
+js1_5/Regress/regress-360969-05.js
+js1_5/Regress/regress-360969-06.js
+js1_5/Regress/regress-361467.js
+js1_5/Regress/regress-3649-n.js
+js1_5/Regress/regress-372364.js
+js1_5/Regress/regress-68498-003.js
+js1_5/Regress/regress-96526-002.js
+js1_5/extensions/getset-001.js
+js1_5/extensions/getset-003.js
+js1_5/extensions/regress-164697.js
+js1_5/extensions/regress-192465.js
+js1_5/extensions/regress-245148.js
+js1_5/extensions/regress-254375.js
+js1_5/extensions/regress-303277.js
+js1_5/extensions/regress-306738.js
+js1_5/extensions/regress-313630.js
+js1_5/extensions/regress-333541.js
+js1_5/extensions/regress-335700.js
+js1_5/extensions/regress-338804-02.js
+js1_5/extensions/regress-342960.js
+js1_5/extensions/regress-345967.js
+js1_5/extensions/regress-346494.js
+js1_5/extensions/regress-347306-02.js
+js1_5/extensions/regress-348986.js
+js1_5/extensions/regress-349616.js
+js1_5/extensions/regress-350531.js
+js1_5/extensions/regress-352060.js
+js1_5/extensions/regress-352094.js
+js1_5/extensions/regress-352372.js
+js1_5/extensions/regress-352455.js
+js1_5/extensions/regress-353214.js
+js1_5/extensions/regress-354541-02.js
+js1_5/extensions/regress-354541-04.js
+js1_5/extensions/regress-355339.js
+js1_5/extensions/regress-355497.js
+js1_5/extensions/regress-355820.js
+js1_5/extensions/regress-356085.js
+js1_5/extensions/regress-361346.js
+js1_5/extensions/regress-361360.js
+js1_5/extensions/regress-361552.js
+js1_5/extensions/regress-361558.js
+js1_5/extensions/regress-361571.js
+js1_5/extensions/regress-361964.js
+js1_5/extensions/regress-365869.js
+js1_5/extensions/regress-367923.js
+js1_5/extensions/regress-368859.js
+js1_5/extensions/regress-50447-1.js
+js1_6/Array/regress-290592.js
+js1_6/Array/regress-310425-01.js
+js1_6/Array/regress-320887.js
+js1_6/Regress/regress-350417.js
+js1_6/decompilation/regress-352084.js
+js1_6/decompilation/regress-352613-01.js
+js1_6/decompilation/regress-352613-02.js
+js1_6/Regress/regress-355002.js
+js1_6/Regress/regress-372565.js
+js1_6/String/regress-306591.js
+js1_6/extensions/regress-312385-01.js
+js1_6/extensions/regress-352392.js
+lc2/Arrays/array-008-n.js
+js1_5/Regress/regress-240317.js
+js1_5/Regress/regress-252892.js
+e4x/Expressions/regress-366123.js
+e4x/decompilation/regress-352459.js
+ecma/Date/15.9.5.31-1.js
+ecma/Date/15.9.5.35-1.js
+ecma_3/RegExp/regress-375642.js
+js1_5/Regress/regress-306727.js
+js1_5/Regress/regress-308566.js
+js1_5/Regress/regress-312260.js
+js1_5/Regress/regress-322430.js
+js1_5/decompilation/regress-356083.js
+js1_5/decompilation/regress-356248.js
+js1_5/extensions/regress-361856.js
+js1_5/extensions/regress-365527.js
+js1_5/extensions/regress-376052.js
+js1_6/Regress/regress-353078.js
+ecma_3/RegExp/regress-375715-01-n.js
+js1_5/extensions/regress-380581.js
+js1_5/extensions/regress-381205.js
+js1_5/extensions/regress-381211.js
+e4x/Regress/regress-383255.js
+ecma_3/RegExp/regress-375711.js
+ecma_3/RegExp/regress-375715-04.js
+js1_5/Regress/regress-367561-03.js
+js1_5/extensions/regress-367630.js
+js1_5/extensions/regress-375801.js
+js1_5/extensions/regress-380831.js
+js1_5/extensions/regress-382509.js
+js1_5/extensions/regress-383965.js
+js1_6/Regress/regress-382509.js
+js1_5/Function/regress-364023.js
+e4x/Regress/regress-380833.js
+js1_5/extensions/regress-358594-01.js
+js1_5/extensions/regress-358594-02.js
+js1_5/extensions/regress-358594-03.js
+js1_5/extensions/regress-358594-04.js
+js1_5/extensions/regress-358594-05.js
+js1_5/extensions/regress-358594-06.js
+js1_7/extensions/regress-380933.js
+ecma_3/extensions/regress-368516.js
+js1_5/extensions/regress-351463-01.js
+js1_5/extensions/regress-355655.js
+js1_7/block/regress-352422.js
+js1_7/block/regress-352786.js
+js1_7/block/regress-352907.js
+js1_7/block/regress-376410.js
+js1_7/block/regress-411279.js
+ecma_3/Number/15.7.4.2-01.js
+ecma_3/Number/15.7.4.3-01.js
+ecma_3/Number/15.7.4.7-2.js
diff --git a/trunk/infrastructure/rhino1_7R1/testsrc/build.xml b/trunk/infrastructure/rhino1_7R1/testsrc/build.xml
new file mode 100644
index 0000000..bc05516
--- /dev/null
+++ b/trunk/infrastructure/rhino1_7R1/testsrc/build.xml
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="testsrc" basedir="..">
+ <!--
+ Location of mozilla/js/tests directory
+ -->
+ <property name="test.library.dir" location="../tests" />
+
+ <!--
+ Destination to which testing classes should be built
+ -->
+ <property name="test.classes" value="${build.dir}/test/classes" />
+
+ <!--
+ Output directory for HTML files generated by jsdriver
+ -->
+ <property name="test.output" value="${build.dir}/test/output" />
+
+ <!--
+ Timeout in milliseconds for tests
+ -->
+ <property name="test.timeout" value="60000" />
+
+ <!--
+ Maximum heap size for VM executing test cases.
+ -->
+ <property name="test.vm.mx" value="256m" />
+
+ <target name="junit-compile">
+ <mkdir dir="${test.classes}" />
+ <get src="http://mirrors.ibiblio.org/pub/mirrors/maven2/junit/junit/3.8.2/junit-3.8.2.jar" dest="lib/junit.jar" usetimestamp="true"/>
+ <javac
+ srcdir="testsrc"
+ destdir="${test.classes}" debug="true"
+ target="${target-jvm}"
+ source="${source-level}"
+ >
+ <classpath>
+ <pathelement path="lib/junit.jar" />
+ <pathelement path="${classes}" />
+ <pathelement path="${test-classes}" />
+ </classpath>
+ <include name="org/mozilla/javascript/drivers/StandardTests.java" />
+ </javac>
+ <antcall target="copy-files" />
+ </target>
+
+ <target name="compile">
+ <mkdir dir="${test.classes}" />
+ <javac
+ srcdir="testsrc"
+ destdir="${test.classes}" debug="true"
+ target="${target-jvm}"
+ source="${source-level}"
+ >
+ <classpath>
+ <pathelement path="${classes}" />
+ </classpath>
+ <sourcepath path="testsrc" />
+ <include name="org/mozilla/javascript/drivers/JsDriver.java" />
+ </javac>
+ <antcall target="copy-files" />
+ </target>
+
+ <target name="copy-files">
+ <copy todir="${test.classes}">
+ <fileset dir="testsrc">
+ <exclude name="**/*.java build.xml"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="clean">
+ <delete dir="${test.classes}" />
+ </target>
+
+ <target name="coverage-instrument">
+ <get src="http://mirrors.ibiblio.org/pub/mirrors/maven2/emma/emma/2.0.5312/emma-2.0.5312.jar" dest="lib/emma.jar" usetimestamp="true"/>
+ <get src="http://mirrors.ibiblio.org/pub/mirrors/maven2/emma/emma_ant/2.0.5312/emma_ant-2.0.5312.jar" dest="lib/emma_ant.jar" usetimestamp="true"/>
+ <property name="coverage.dir" location="${build.dir}/coverage"/>
+ <property name="coverage.classes.dir" location="${build.dir}/coverage/classes"/>
+ <mkdir dir="${coverage.classes.dir}"/>
+ <path id="emma.lib">
+ <pathelement location="lib/emma.jar" />
+ <pathelement location="lib/emma_ant.jar" />
+ </path>
+ <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
+ <property name="coverage.instrumentationfile" location="${coverage.dir}/instrumentation"/>
+ <emma enabled="true">
+ <instr
+ instrpath="${classes}" outdir="${coverage.classes.dir}"
+ outfile="${coverage.instrumentationfile}" mode="copy"/>
+ </emma>
+ <copy todir="${coverage.classes.dir}">
+ <fileset dir="src" excludes="**/*.java"/>
+ </copy>
+ <copy todir="${coverage.classes.dir}">
+ <fileset dir="${classes}"/>
+ </copy>
+ <property name="coverage.outfile" location="${coverage.dir}/coverage"/>
+ </target>
+
+ <target name="junit" depends="junit-compile,coverage-instrument">
+ <junit printsummary="on" fork="true" forkmode="once" maxmemory="${test.vm.mx}" showoutput="true">
+ <sysproperty key="java.awt.headless" value="true" />
+ <sysproperty key="mozilla.js.tests" value="${test.library.dir}" />
+ <sysproperty key="mozilla.js.tests.timeout" value="${test.timeout}" />
+ <sysproperty key="emma.coverage.out.file" value="${coverage.outfile}"/>
+ <classpath>
+ <pathelement location="${xbean.jar}"/>
+ <pathelement location="${jsr173.jar}"/>
+ <pathelement path="${coverage.classes.dir}" />
+ <pathelement path="${classes}" />
+ <pathelement path="${test.classes}" />
+ <pathelement path="lib/emma.jar"/>
+ <pathelement path="lib/junit.jar" />
+ </classpath>
+ <batchtest todir="build/test">
+ <fileset dir="${test.classes}" includes="**/*Tests.class"/>
+ </batchtest>
+ <formatter type="plain" usefile="false" />
+ <formatter type="xml"/>
+ </junit>
+ <mkdir dir="build/test/report"/>
+ <junitreport todir="build/test/report">
+ <fileset dir="build/test" includes="*.xml"/>
+ <report todir="build/test/report"/>
+ </junitreport>
+ </target>
+
+ <target name="junit-coveragereport" depends="junit">
+ <property name="coverage.report.dir" location="${build.dir}/coverage/report"/>
+ <mkdir dir="${coverage.report.dir}"/>
+ <delete dir="${coverage.report.dir}"/>
+ <mkdir dir="${coverage.report.dir}"/>
+ <emma enabled="true">
+ <report>
+ <fileset dir="${basedir}">
+ <include name="build/coverage/instrumentation"/>
+ <include name="build/coverage/coverage"/>
+ </fileset>
+ <sourcepath>
+ <dirset dir="${basedir}">
+ <include name="src"/>
+ </dirset>
+ </sourcepath>
+ <html outfile="${coverage.report.dir}/index.html"/>
+ </report>
+ </emma>
+ </target>
+
+ <target name="jsdriver" depends="compile">
+ <tstamp>
+ <format property="test.timestamp" pattern="yyyy.MM.dd.HH.mm.ss" />
+ </tstamp>
+ <mkdir dir="${test.output}" />
+ <java
+ fork="true"
+ classname="org.mozilla.javascript.drivers.JsDriver"
+ maxmemory="${test.vm.mx}"
+ >
+ <classpath>
+ <pathelement location="${xbean.jar}"/>
+ <pathelement location="${jsr173.jar}"/>
+ <pathelement path="${classes}" />
+ <pathelement path="${test.classes}" />
+ </classpath>
+ <arg value="-p" />
+ <arg file="${test.library.dir}" />
+ <arg value="-f" />
+ <arg value="${test.output}/rhino-test-results.${test.timestamp}.html" />
+ <arg value="--timeout" />
+ <arg value="${test.timeout}" />
+ </java>
+ </target>
+
+ <target name="copy-source">
+ <mkdir dir="${dist.dir}/testsrc"/>
+ <copy todir="${dist.dir}/testsrc">
+ <fileset dir="testsrc"
+ includes="**/*.java,**/*.properties,**/*.xml,**/*.html,**/*.skip" />
+ </copy>
+ </target>
+</project>
diff --git a/trunk/infrastructure/rhino1_7R1/testsrc/opt1.skip b/trunk/infrastructure/rhino1_7R1/testsrc/opt1.skip
new file mode 100644
index 0000000..7006882
--- /dev/null
+++ b/trunk/infrastructure/rhino1_7R1/testsrc/opt1.skip
@@ -0,0 +1,26 @@
+# Rhino skip list: opt1.skip. Tests to be run at -opt 1
+# These tests are skipped by Rhino either because a bug with a regression
+# test has yet to be fixed, or because the test is not applicable to Rhino.
+
+# program too large/complex
+ecma_3/Statements/regress-302439.js
+ecma_3/Statements/regress-324650.js
+ecma_3/Statements/regress-74474-002.js
+ecma_3/Statements/regress-74474-003.js
+js1_5/Regress/regress-244470.js
+js1_5/Regress/regress-308085.js
+js1_5/Regress/regress-80981.js
+js1_5/Regress/regress-89443.js
+js1_5/extensions/regress-226507.js
+
+# program too large/complex; could have better error message
+js1_5/Regress/regress-111557.js
+js1_5/Regress/regress-155081-2.js
+js1_5/Regress/regress-155081.js
+js1_5/extensions/regress-311161.js
+
+# Missing line number information on error
+js1_5/Regress/regress-167328.js
+js1_5/extensions/regress-50447.js
+js1_5/Exceptions/regress-257751.js
+
diff --git a/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/JsDriver.java b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/JsDriver.java
new file mode 100644
index 0000000..8bae79f
--- /dev/null
+++ b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/JsDriver.java
@@ -0,0 +1,838 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Java port of jsDriver.pl.
+ *
+ * The Initial Developer of the Original Code is
+ * David P. Caldwell.
+ * Portions created by David P. Caldwell are Copyright (C)
+ * 2007 David P. Caldwell. All Rights Reserved.
+ *
+ *
+ * Contributor(s):
+ * David P. Caldwell <inonit@inonit.com>
+ * Norris Boyd <norrisboyd@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * the GNU General Public License Version 2 or later (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of those above. If
+ * you wish to allow use of your version of this file only under the terms of
+ * the GPL and not to allow others to use your version of this file under the
+ * MPL, indicate your decision by deleting the provisions above and replacing
+ * them with the notice and other provisions required by the GPL. If you do
+ * not delete the provisions above, a recipient may use your version of this
+ * file under either the MPL or the GPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+package org.mozilla.javascript.drivers;
+
+import java.io.*;
+import java.util.*;
+
+import org.w3c.dom.*;
+
+import org.mozilla.javascript.tools.shell.*;
+
+/**
+ * @version $Id: JsDriver.java,v 1.5 2007/10/11 19:44:10 szegedia%freemail.hu Exp $
+ */
+public class JsDriver {
+ private JsDriver() {
+ }
+
+ private static String join(String[] list) {
+ String rv = "";
+ for (int i=0; i<list.length; i++) {
+ rv += list[i];
+ if (i+1 != list.length) {
+ rv += ",";
+ }
+ }
+ return rv;
+ }
+
+ private static class Tests {
+ private File testDirectory;
+ private String[] list;
+ private String[] skip;
+
+ Tests(File testDirectory, String[] list, String[] skip) {
+ this.testDirectory = testDirectory;
+ this.list = getTestList(list);
+ this.skip = getTestList(skip);
+ }
+
+ private String[] getTestList(String[] tests) {
+ ArrayList list = new ArrayList();
+ for (int i=0; i < tests.length; i++) {
+ if (tests[i].startsWith("@"))
+ addTestsFromFile(tests[i].substring(1), list);
+ else
+ list.add(tests[i]);
+ }
+ return (String[])list.toArray(new String[0]);
+ }
+
+ private void addTestsFromFile(String filename, ArrayList list) {
+ try {
+ Properties props = new Properties();
+ props.load(new FileInputStream(new File(filename)));
+ list.addAll(props.keySet());
+ } catch (IOException e) {
+ throw new RuntimeException("Could not read file '" + filename + "'", e);
+ }
+ }
+
+ private boolean matches(String[] patterns, String path) {
+ for (int i=0; i<patterns.length; i++) {
+ if (path.startsWith(patterns[i])) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean matches(String path) {
+ if (list.length == 0) return true;
+ return matches(list, path);
+ }
+
+ private boolean excluded(String path) {
+ if (skip.length == 0) return false;
+ return matches(skip, path);
+ }
+
+ private void addFiles(List rv, String prefix, File directory) {
+ File[] files = directory.listFiles();
+ if (files == null) throw new RuntimeException("files null for " + directory);
+ for (int i=0; i<files.length; i++) {
+ String path = prefix + files[i].getName();
+ if (ShellTest.DIRECTORY_FILTER.accept(files[i])) {
+ addFiles(rv, path + "/", files[i]);
+ } else {
+ boolean isTopLevel = prefix.length() == 0;
+ if (ShellTest.TEST_FILTER.accept(files[i]) && matches(path) && !excluded(path) && !isTopLevel) {
+ rv.add(new Script(path, files[i]));
+ }
+ }
+ }
+ }
+
+ static class Script {
+ private String path;
+ private File file;
+
+ Script(String path, File file) {
+ this.path = path;
+ this.file = file;
+ }
+
+ String getPath() {
+ return path;
+ }
+
+ File getFile() {
+ return file;
+ }
+ }
+
+ Script[] getFiles() {
+ ArrayList rv = new ArrayList();
+ addFiles(rv, "", testDirectory);
+ return (Script[])rv.toArray(new Script[0]);
+ }
+ }
+
+ private static class ConsoleStatus extends ShellTest.Status {
+ private File jsFile;
+
+ private Arguments.Console console;
+ private boolean trace;
+
+ private boolean failed;
+
+ ConsoleStatus(Arguments.Console console, boolean trace) {
+ this.console = console;
+ this.trace = trace;
+ }
+
+ void running(File jsFile) {
+ try {
+ console.println("Running: " + jsFile.getCanonicalPath());
+ this.jsFile = jsFile;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ void failed(String s) {
+ console.println("Failed: " + jsFile + ": " + s);
+ failed = true;
+ }
+
+ void threw(Throwable t) {
+ console.println("Failed: " + jsFile + " with exception.");
+ console.println(ShellTest.getStackTrace(t));
+ failed = true;
+ }
+
+ void timedOut() {
+ console.println("Failed: " + jsFile + ": timed out.");
+ failed = true;
+ }
+
+ void exitCodesWere(int expected, int actual) {
+ if (expected != actual) {
+ console.println("Failed: " + jsFile + " expected " + expected + " actual " + actual);
+ failed = true;
+ }
+ }
+
+ void outputWas(String s) {
+ if (!failed) {
+ console.println("Passed: " + jsFile);
+ if (trace) {
+ console.println(s);
+ }
+ }
+ }
+ }
+
+ // returns true if node was found, false otherwise
+ private static boolean setContent(Element node, String id, String content) {
+ if (node.getAttribute("id").equals(id)) {
+ node.setTextContent(node.getTextContent() + "\n" + content);
+ return true;
+ } else {
+ NodeList children = node.getChildNodes();
+ for (int i=0; i<children.getLength(); i++) {
+ if (children.item(i) instanceof Element) {
+ Element e = (Element)children.item(i);
+ boolean rv = setContent( e, id, content );
+ if (rv) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private static Element getElementById(Element node, String id) {
+ if (node.getAttribute("id").equals(id)) {
+ return node;
+ } else {
+ NodeList children = node.getChildNodes();
+ for (int i=0; i<children.getLength(); i++) {
+ if (children.item(i) instanceof Element) {
+ Element rv = getElementById( (Element)children.item(i), id );
+ if (rv != null) {
+ return rv;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private static String newlineLineEndings(String s) {
+ StringBuffer rv = new StringBuffer();
+ for (int i=0; i<s.length(); i++) {
+ if (s.charAt(i) == '\r') {
+ if (i+1<s.length() && s.charAt(i+1) == '\n') {
+ // just skip \r
+ } else {
+ // Macintosh, substitute \n
+ rv.append('\n');
+ }
+ } else {
+ rv.append(s.charAt(i));
+ }
+ }
+ return rv.toString();
+ }
+
+ private static class HtmlStatus extends ShellTest.Status {
+ private String testPath;
+ private String bugUrl;
+ private String lxrUrl;
+ private Document html;
+ private Element failureHtml;
+ private boolean failed;
+
+ private String output;
+
+ HtmlStatus(String lxrUrl, String bugUrl, String testPath, Document html, Element failureHtml) {
+ this.testPath = testPath;
+ this.bugUrl = bugUrl;
+ this.lxrUrl = lxrUrl;
+ this.html = html;
+ this.failureHtml = failureHtml;
+ }
+
+ void running(File file) {
+ }
+
+ void failed(String s) {
+ failed = true;
+ setContent(failureHtml, "failureDetails.reason", "Failure reason: \n" + s);
+ }
+
+ void exitCodesWere(int expected, int actual) {
+ if (expected != actual) {
+ failed = true;
+ setContent(failureHtml, "failureDetails.reason", "expected exit code " + expected + " but got " + actual);
+ }
+ }
+
+ void threw(Throwable e) {
+ failed = true;
+ setContent(failureHtml, "failureDetails.reason", "Threw Java exception:\n" + newlineLineEndings(ShellTest.getStackTrace(e)));
+ }
+
+ void timedOut() {
+ failed = true;
+ setContent(failureHtml, "failureDetails.reason", "Timed out.");
+ }
+
+ void outputWas(String s) {
+ this.output = s;
+ }
+
+ private String getLinesStartingWith(String prefix) {
+ BufferedReader r = new BufferedReader(new StringReader(output));
+ String line = null;
+ String rv = "";
+ try {
+ while( (line = r.readLine()) != null ) {
+ if (line.startsWith(prefix)) {
+ if (rv.length() > 0) {
+ rv += "\n";
+ }
+ rv += line;
+ }
+ }
+ return rv;
+ } catch (IOException e) {
+ throw new RuntimeException("Can't happen.");
+ }
+ }
+
+ boolean failed() {
+ return failed;
+ }
+
+ void finish() {
+ if (failed) {
+ getElementById(failureHtml, "failureDetails.status").setTextContent(getLinesStartingWith("STATUS:"));
+
+ String bn = getLinesStartingWith("BUGNUMBER:");
+ Element bnlink = getElementById(failureHtml, "failureDetails.bug.href");
+ if (bn.length() > 0) {
+ String number = bn.substring("BUGNUMBER: ".length());
+ if (!number.equals("none")) {
+ bnlink.setAttribute("href", bugUrl + number);
+ getElementById(bnlink, "failureDetails.bug.number").setTextContent(number);
+ } else {
+ bnlink.getParentNode().removeChild(bnlink);
+ }
+ } else {
+ bnlink.getParentNode().removeChild(bnlink);
+ }
+
+ getElementById(failureHtml, "failureDetails.lxr").setAttribute("href", lxrUrl + testPath);
+ getElementById(failureHtml, "failureDetails.lxr.text").setTextContent(testPath);
+
+ getElementById(html.getDocumentElement(), "retestList.text").setTextContent(
+ getElementById(html.getDocumentElement(), "retestList.text").getTextContent()
+ + testPath
+ + "\n"
+ );
+
+ getElementById(html.getDocumentElement(), "failureDetails").appendChild(failureHtml);
+ }
+ }
+ }
+
+ private static class XmlStatus extends ShellTest.Status {
+ private Element target;
+ private Date start;
+
+ XmlStatus(String path, Element root) {
+ this.target = root.getOwnerDocument().createElement("test");
+ this.target.setAttribute("path", path);
+ root.appendChild(target);
+ }
+
+ void running(File file) {
+ this.start = new Date();
+ }
+
+ private Element createElement(Element parent, String name) {
+ Element rv = parent.getOwnerDocument().createElement(name);
+ parent.appendChild(rv);
+ return rv;
+ }
+
+ private void finish() {
+ Date end = new Date();
+ long elapsed = end.getTime() - start.getTime();
+ this.target.setAttribute("elapsed", String.valueOf(elapsed));
+ }
+
+ private void setTextContent(Element e, String content) {
+ e.setTextContent( newlineLineEndings(content) );
+ }
+
+ void exitCodesWere(int expected, int actual) {
+ finish();
+ Element exit = createElement(target, "exit");
+ exit.setAttribute("expected", String.valueOf(expected));
+ exit.setAttribute("actual", String.valueOf(actual));
+ }
+
+ void timedOut() {
+ finish();
+ createElement(target, "timedOut");
+ }
+
+ void failed(String s) {
+ finish();
+ Element failed = createElement(target, "failed");
+ setTextContent(failed, s);
+ }
+
+ void outputWas(String message) {
+ finish();
+ Element output = createElement(target, "output");
+ setTextContent(output, message);
+ }
+
+ void threw(Throwable t) {
+ finish();
+ Element threw = createElement(target, "threw");
+ setTextContent(threw, ShellTest.getStackTrace(t));
+ }
+ }
+
+ private static class Results {
+ private ShellContextFactory factory;
+ private Arguments arguments;
+ private File output;
+ private boolean trace;
+
+ private Document html;
+ private Element failureHtml;
+
+ private Document xml;
+
+ private Date start;
+ private int tests;
+ private int failures;
+
+ Results(ShellContextFactory factory, Arguments arguments, boolean trace) {
+ this.factory = factory;
+ this.arguments = arguments;
+
+ File output = arguments.getOutputFile();
+ if (output == null) {
+ output = new File("rhino-test-results." + new java.text.SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date()) + ".html");
+ }
+ this.output = output;
+
+ this.trace = trace;
+ }
+
+ private Document parse(InputStream in) {
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ javax.xml.parsers.DocumentBuilder dom = factory.newDocumentBuilder();
+ return dom.parse(in);
+ } catch (Throwable t) {
+ throw new RuntimeException("Parser failure", t);
+ }
+ }
+
+ private Document getTemplate() {
+ return parse(getClass().getResourceAsStream("results.html"));
+ }
+
+ private void write(Document template, boolean xml) {
+ try {
+ File output = this.output;
+ javax.xml.transform.TransformerFactory factory = javax.xml.transform.TransformerFactory.newInstance();
+ javax.xml.transform.Transformer xform = factory.newTransformer();
+ if (xml) {
+ xform.setOutputProperty(javax.xml.transform.OutputKeys.METHOD, "xml");
+ xform.setOutputProperty(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ output = new File(output.getCanonicalPath() + ".xml");
+ }
+ xform.transform(
+ new javax.xml.transform.dom.DOMSource(template),
+ new javax.xml.transform.stream.StreamResult( new FileOutputStream(output) )
+ );
+ } catch (IOException e) {
+ arguments.getConsole().println("Could not write results file to " + output + ": ");
+ e.printStackTrace(System.err);
+ } catch (javax.xml.transform.TransformerConfigurationException e) {
+ throw new RuntimeException("Parser failure", e);
+ } catch (javax.xml.transform.TransformerException e) {
+ throw new RuntimeException("Parser failure", e);
+ }
+ }
+
+ void start() {
+ this.html = getTemplate();
+ this.failureHtml = getElementById(html.getDocumentElement(), "failureDetails.prototype");
+ if (this.failureHtml == null) {
+ try {
+ javax.xml.transform.TransformerFactory.newInstance().newTransformer().transform(
+ new javax.xml.transform.dom.DOMSource(html),
+ new javax.xml.transform.stream.StreamResult(System.err)
+ );
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ throw new RuntimeException("No");
+ }
+ this.failureHtml.getParentNode().removeChild(this.failureHtml);
+
+ try {
+ this.xml = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder()
+ .getDOMImplementation().createDocument(null, "results", null)
+ ;
+ xml.getDocumentElement().setAttribute("timestamp", String.valueOf(new Date().getTime()));
+ xml.getDocumentElement().setAttribute("optimization", String.valueOf(arguments.getOptimizationLevel()));
+ xml.getDocumentElement().setAttribute("strict", String.valueOf(arguments.isStrict()));
+ xml.getDocumentElement().setAttribute("timeout", String.valueOf(arguments.getTimeout()));
+ } catch (javax.xml.parsers.ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ }
+
+ this.start = new Date();
+ }
+
+ void run(Tests.Script script, ShellTest.Parameters parameters) {
+ String path = script.getPath();
+ File test = script.getFile();
+ ConsoleStatus cStatus = new ConsoleStatus(arguments.getConsole(), trace);
+ HtmlStatus hStatus = new HtmlStatus(arguments.getLxrUrl(), arguments.getBugUrl(), path, html, (Element)failureHtml.cloneNode(true));
+ XmlStatus xStatus = new XmlStatus(path, this.xml.getDocumentElement());
+ ShellTest.Status status = ShellTest.Status.compose(new ShellTest.Status[] { cStatus, hStatus, xStatus });
+ try {
+ ShellTest.run(factory, test, parameters, status);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ tests++;
+ if (hStatus.failed()) {
+ failures++;
+ }
+ hStatus.finish();
+ }
+
+ private void set(Document document, String id, String value) {
+ getElementById(document.getDocumentElement(), id).setTextContent(value);
+ }
+
+ void finish() {
+ Date end = new Date();
+ long elapsedMs = end.getTime() - start.getTime();
+ set(html, "results.testlist", join(arguments.getTestList()));
+ set(html, "results.skiplist", join(arguments.getSkipList()));
+ String pct = new java.text.DecimalFormat("##0.00").format( (double)failures / (double)tests * 100.0 );
+ set(html, "results.results", "Tests attempted: " + tests + " Failures: " + failures + " (" + pct + "%)");
+ set(html, "results.platform", "java.home=" + System.getProperty("java.home")
+ + "\n" + "java.version=" + System.getProperty("java.version")
+ + "\n" + "os.name=" + System.getProperty("os.name")
+ );
+ set(html, "results.classpath", System.getProperty("java.class.path").replace(File.pathSeparatorChar, ' '));
+ int elapsedSeconds = (int)(elapsedMs / 1000);
+ int elapsedMinutes = elapsedSeconds / 60;
+ elapsedSeconds = elapsedSeconds % 60;
+ String elapsed = "" + elapsedMinutes + " minutes, " + elapsedSeconds + " seconds";
+ set(html, "results.elapsed", elapsed);
+ set(html, "results.time", new java.text.SimpleDateFormat("MMMM d yyyy h:mm:ss aa").format(new java.util.Date()));
+ write(html, false);
+ write(xml, true);
+ }
+ }
+
+ private static class ShellTestParameters extends ShellTest.Parameters {
+ private int timeout;
+
+ ShellTestParameters(int timeout) {
+ this.timeout = timeout;
+ }
+
+ int getTimeoutMilliseconds() {
+ return timeout;
+ }
+ }
+
+ void run(Arguments arguments) throws Throwable {
+ if (arguments.help()) {
+ System.out.println("See mozilla/js/tests/README-jsDriver.html; note that some options are not supported.");
+ System.out.println("Consult the Java source code at testsrc/org/mozilla/javascript/JsDriver.java for details.");
+ System.exit(0);
+ }
+
+ ShellContextFactory factory = new ShellContextFactory();
+ factory.setOptimizationLevel(arguments.getOptimizationLevel());
+ factory.setStrictMode(arguments.isStrict());
+
+ File path = arguments.getTestsPath();
+ if (path == null) {
+ path = new File("../tests");
+ }
+ if (!path.exists()) {
+ throw new RuntimeException("JavaScript tests not found at " + path.getCanonicalPath());
+ }
+ Tests tests = new Tests(path, arguments.getTestList(), arguments.getSkipList());
+ Tests.Script[] all = tests.getFiles();
+ arguments.getConsole().println("Running " + all.length + " tests.");
+
+ Results results = new Results(factory, arguments, arguments.trace());
+
+ results.start();
+ for (int i=0; i<all.length; i++) {
+ results.run(all[i], new ShellTestParameters(arguments.getTimeout()));
+ }
+ results.finish();
+ }
+
+ public static void main(Arguments arguments) throws Throwable {
+ JsDriver driver = new JsDriver();
+ driver.run(arguments);
+ }
+
+ private static class Arguments {
+ private ArrayList options = new ArrayList();
+
+ private Option bugUrl = new Option("b", "bugurl", false, false, "http://bugzilla.mozilla.org/show_bug.cgi?id=");
+ private Option optimizationLevel = new Option("o", "optimization", false, false, "-1");
+ private Option strict = new Option(null, "strict", false, true, null);
+ private Option outputFile = new Option("f", "file", false, false, null);
+ private Option help = new Option("h", "help", false, true, null);
+ private Option logFailuresToConsole = new Option("k", "confail", false, true, null);
+ private Option testList = new Option("l", "list", true, false, null);
+ private Option skipList = new Option("L", "neglist", true, false, null);
+ private Option testsPath = new Option("p", "testpath", false, false, null);
+ private Option trace = new Option("t", "trace", false, true, null);
+ private Option lxrUrl = new Option("u", "lxrurl", false, false, "http://lxr.mozilla.org/mozilla/source/js/tests/");
+ private Option timeout = new Option(null, "timeout", false, false, "60000");
+
+ public static class Console {
+ public void print(String message) {
+ System.out.print(message);
+ }
+ public void println(String message) {
+ System.out.println(message);
+ }
+ }
+ private Console console = new Console();
+
+ private class Option {
+ private String letterOption;
+ private String wordOption;
+ private boolean array;
+ private boolean flag;
+ private boolean ignored;
+
+ private ArrayList values = new ArrayList();
+
+ // array: can this option have multiple values?
+ // flag: is this option a simple true/false switch?
+ Option(String letterOption, String wordOption, boolean array, boolean flag, String unspecified) {
+ this.letterOption = letterOption;
+ this.wordOption = wordOption;
+ this.flag = flag;
+ this.array = array;
+ if (!flag && !array) {
+ this.values.add(unspecified);
+ }
+ options.add(this);
+ }
+
+ Option ignored() {
+ this.ignored = true;
+ return this;
+ }
+
+ int getInt() {
+ return Integer.parseInt( getValue() );
+ }
+
+ String getValue() {
+ return (String)values.get(0);
+ }
+
+ boolean getSwitch() {
+ return values.size() > 0;
+ }
+
+ File getFile() {
+ if (getValue() == null) return null;
+ return new File(getValue());
+ }
+
+ String[] getValues() {
+ return (String[])values.toArray(new String[0]);
+ }
+
+ void process(List arguments) {
+ String option = (String)arguments.get(0);
+ String dashLetter = (letterOption == null) ? (String)null : "-" + letterOption;
+ if (option.equals(dashLetter) || option.equals("--" + wordOption)) {
+ arguments.remove(0);
+ if (flag) {
+ values.add(0, (String)null );
+ } else if (array) {
+ while( arguments.size() > 0 && !( (String)arguments.get(0) ).startsWith("-") ) {
+ values.add(arguments.remove(0));
+ }
+ } else {
+ values.set(0, arguments.remove(0));
+ }
+ if (ignored) {
+ System.err.println("WARNING: " + option + " is ignored in the Java version of the test driver.");
+ }
+ }
+ }
+ }
+
+ // -b URL, --bugurl=URL
+ public String getBugUrl() {
+ return bugUrl.getValue();
+ }
+
+ // -c PATH, --classpath=PATH
+ // Does not apply; we will use the VM's classpath
+
+ // -e TYPE ..., --engine=TYPE ...
+ // Does not apply; was used to select between SpiderMonkey and Rhino
+
+ // Not in jsDriver.pl
+ public int getOptimizationLevel() {
+ return optimizationLevel.getInt();
+ }
+
+ // --strict
+ public boolean isStrict() {
+ return strict.getSwitch();
+ }
+
+ // -f FILE, --file=FILE
+ public File getOutputFile() {
+ return outputFile.getFile();
+ }
+
+ // -h, --help
+ public boolean help() {
+ return help.getSwitch();
+ }
+
+ // -j PATH, --javapath=PATH
+ // Does not apply; we will use this JVM
+
+ // -k, --confail
+ // TODO Currently this is ignored; not clear precisely what it means (perhaps we should not be logging ordinary
+ // pass/fail to the console currently?)
+ public boolean logFailuresToConsole() {
+ return logFailuresToConsole.getSwitch();
+ }
+
+ // -l FILE,... or --list=FILE,...
+ public String[] getTestList() {
+ return testList.getValues();
+ }
+
+ // -L FILE,... or --neglist=FILE,...
+ public String[] getSkipList() {
+ return skipList.getValues();
+ }
+
+ // -p PATH, --testpath=PATH
+ public File getTestsPath() {
+ return testsPath.getFile();
+ }
+
+ // -s PATH, --shellpath=PATH
+ // Does not apply; we will use the Rhino shell with any classes given on the classpath
+
+ // -t, --trace
+ public boolean trace() {
+ return trace.getSwitch();
+ }
+
+ // -u URL, --lxrurl=URL
+ public String getLxrUrl() {
+ return lxrUrl.getValue();
+ }
+
+ //
+ // New arguments
+ //
+
+ // --timeout
+ // Milliseconds to wait for each test
+ public int getTimeout() {
+ return timeout.getInt();
+ }
+
+ public Console getConsole() {
+ return console;
+ }
+
+ void process(List arguments) {
+ while(arguments.size() > 0) {
+ String option = (String)arguments.get(0);
+ if (option.startsWith("--")) {
+ // preprocess --name=value options into --name value
+ if (option.indexOf("=") != -1) {
+ arguments.set(0, option.substring(option.indexOf("=")));
+ arguments.add(1, option.substring(option.indexOf("=") + 1));
+ }
+ } else if (option.startsWith("-")) {
+ // could be multiple single-letter options, e.g. -kht, so preprocess them into -k -h -t
+ if (option.length() > 2) {
+ for (int i=2; i<option.length(); i++) {
+ arguments.add(1, "-" + option.substring(i,i+1));
+ }
+ arguments.set(0, option.substring(0,2));
+ }
+ }
+ int lengthBefore = arguments.size();
+ for (int i=0; i<options.size(); i++) {
+ if (arguments.size() > 0) {
+ ((Option)options.get(i)).process(arguments);
+ }
+ }
+
+ if (arguments.size() == lengthBefore) {
+ System.err.println("WARNING: ignoring unrecognized option " + arguments.remove(0));
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Throwable {
+ ArrayList arguments = new ArrayList();
+ arguments.addAll(Arrays.asList(args));
+ Arguments clArguments = new Arguments();
+ clArguments.process(arguments);
+ main(clArguments);
+ }
+}
diff --git a/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/ShellTest.java b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/ShellTest.java
new file mode 100644
index 0000000..9acf64e
--- /dev/null
+++ b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/ShellTest.java
@@ -0,0 +1,346 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Java port of jsDriver.pl.
+ *
+ * The Initial Developer of the Original Code is
+ * David P. Caldwell.
+ * Portions created by David P. Caldwell are Copyright (C)
+ * 2007 David P. Caldwell. All Rights Reserved.
+ *
+ *
+ * Contributor(s):
+ * David P. Caldwell <inonit@inonit.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * the GNU General Public License Version 2 or later (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of those above. If
+ * you wish to allow use of your version of this file only under the terms of
+ * the GPL and not to allow others to use your version of this file under the
+ * MPL, indicate your decision by deleting the provisions above and replacing
+ * them with the notice and other provisions required by the GPL. If you do
+ * not delete the provisions above, a recipient may use your version of this
+ * file under either the MPL or the GPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+package org.mozilla.javascript.drivers;
+
+import org.mozilla.javascript.*;
+import java.io.*;
+import java.util.*;
+
+import org.mozilla.javascript.tools.shell.*;
+
+/**
+ * @version $Id: ShellTest.java,v 1.5 2007/10/11 19:44:10 szegedia%freemail.hu Exp $
+ */
+class ShellTest {
+ static final FileFilter DIRECTORY_FILTER = new FileFilter() {
+ public boolean accept(File pathname)
+ {
+ return pathname.isDirectory() && !pathname.getName().equals("CVS");
+ }
+ };
+
+ static final FileFilter TEST_FILTER = new FileFilter() {
+ public boolean accept(File pathname)
+ {
+ return pathname.getName().endsWith(".js") && !pathname.getName().equals("shell.js") && !pathname.getName().equals("browser.js") && !pathname.getName().equals("template.js");
+ }
+ };
+
+ static String getStackTrace(Throwable t) {
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ t.printStackTrace(new PrintStream(bytes));
+ return new String(bytes.toByteArray());
+ }
+
+ private static void runFileIfExists(Context cx, Scriptable global, File f)
+ {
+ if(f.isFile())
+ {
+ Main.processFile(cx, global, f.getPath());
+ }
+ }
+
+ private static class TestState
+ {
+ boolean finished;
+ ErrorReporterWrapper errors;
+ int exitCode = 0;
+ }
+
+ static abstract class Status {
+ private boolean negative;
+
+ final void setNegative() {
+ this.negative = true;
+ }
+
+ final boolean isNegative() {
+ return this.negative;
+ }
+
+ final void hadErrors(JsError[] errors) {
+ if (!negative && errors.length > 0) {
+ failed("JavaScript errors:\n" + JsError.toString(errors));
+ } else if (negative && errors.length == 0) {
+ failed("Should have produced runtime error.");
+ }
+ }
+
+ abstract void running(File jsFile);
+
+ abstract void failed(String s);
+ abstract void threw(Throwable t);
+ abstract void timedOut();
+ abstract void exitCodesWere(int expected, int actual);
+ abstract void outputWas(String s);
+
+ static Status compose(final Status[] array) {
+ return new Status() {
+ void running(File file) {
+ for (int i=0; i<array.length; i++) {
+ array[i].running(file);
+ }
+ }
+ void threw(Throwable t) {
+ for (int i=0; i<array.length; i++) {
+ array[i].threw(t);
+ }
+ }
+ void failed(String s) {
+ for (int i=0; i<array.length; i++) {
+ array[i].failed(s);
+ }
+ }
+ void exitCodesWere(int expected, int actual) {
+ for (int i=0; i<array.length; i++) {
+ array[i].exitCodesWere(expected, actual);
+ }
+ }
+ void outputWas(String s) {
+ for (int i=0; i<array.length; i++) {
+ array[i].outputWas(s);
+ }
+ }
+ void timedOut() {
+ for (int i=0; i<array.length; i++) {
+ array[i].timedOut();
+ }
+ }
+ };
+ }
+
+ static class JsError {
+ static String toString(JsError[] e) {
+ String rv = "";
+ for (int i=0; i<e.length; i++) {
+ rv += e[i].toString();
+ if (i+1 != e.length) {
+ rv += "\n";
+ }
+ }
+ return rv;
+ }
+
+ private String message;
+ private String sourceName;
+ private int line;
+ private String lineSource;
+ private int lineOffset;
+
+ JsError(String message, String sourceName, int line, String lineSource, int lineOffset) {
+ this.message = message;
+ this.sourceName = sourceName;
+ this.line = line;
+ this.lineSource = lineSource;
+ this.lineOffset = lineOffset;
+ }
+
+ public String toString() {
+ String locationLine = sourceName + ":" + line + ": " + message;
+ String sourceLine = this.lineSource;
+ String errCaret = null;
+ if (lineSource != null) {
+ errCaret = "";
+ for (int i=0; i<lineSource.length(); i++) {
+ char c = lineSource.charAt(i);
+ if (i < lineOffset-1) {
+ if (c == '\t') {
+ errCaret += "\t";
+ } else {
+ errCaret += " ";
+ }
+ } else if (i == lineOffset-1) {
+ errCaret += "^";
+ }
+ }
+ }
+ String rv = locationLine;
+ if (sourceLine != null) {
+ rv += "\n" + sourceLine;
+ }
+ if (errCaret != null) {
+ rv += "\n" + errCaret;
+ }
+ return rv;
+ }
+
+ String getMessage() {
+ return message;
+ }
+
+ String getSourceName() {
+ return sourceName;
+ }
+
+ int getLine() {
+ return line;
+ }
+
+ String getLineSource() {
+ return lineSource;
+ }
+
+ int getLineOffset() {
+ return lineOffset;
+ }
+ }
+ }
+
+ private static class ErrorReporterWrapper implements ErrorReporter {
+ private ErrorReporter original;
+ private ArrayList errors = new ArrayList();
+
+ ErrorReporterWrapper(ErrorReporter original) {
+ this.original = original;
+ }
+
+ private void addError(String string, String string0, int i, String string1, int i0) {
+ errors.add( new Status.JsError(string, string0, i, string1, i0) );
+ }
+
+ public void warning(String string, String string0, int i, String string1, int i0) {
+ original.warning(string, string0, i, string1, i0);
+ }
+
+ public EvaluatorException runtimeError(String string, String string0, int i, String string1, int i0) {
+ return original.runtimeError(string, string0, i, string1, i0);
+ }
+
+ public void error(String string, String string0, int i, String string1, int i0) {
+ addError(string, string0, i, string1, i0);
+ }
+ }
+
+ static abstract class Parameters {
+ abstract int getTimeoutMilliseconds();
+ }
+
+ static void run(final ShellContextFactory shellContextFactory, final File jsFile, final Parameters parameters, final Status status) throws Exception {
+ final Global global = new Global();
+ final ByteArrayOutputStream out = new ByteArrayOutputStream();
+ final PrintStream p = new PrintStream(out);
+ global.setOut(p);
+ global.setErr(p);
+ final TestState testState = new TestState();
+ if (jsFile.getName().endsWith("-n.js")) {
+ status.setNegative();
+ }
+ Thread t = new Thread(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ shellContextFactory.call(new ContextAction()
+ {
+ public Object run(Context cx)
+ {
+ System.out.println("Running " + jsFile);
+ status.running(jsFile);
+ testState.errors = new ErrorReporterWrapper(cx.getErrorReporter());
+ cx.setErrorReporter( testState.errors );
+ global.init(cx);
+ try {
+ runFileIfExists(cx, global, new File(jsFile.getParentFile().getParentFile().getParentFile(), "shell.js"));
+ runFileIfExists(cx, global, new File(jsFile.getParentFile().getParentFile(), "shell.js"));
+ runFileIfExists(cx, global, new File(jsFile.getParentFile(), "shell.js"));
+ runFileIfExists(cx, global, jsFile);
+ // Emulate SpiderMonkey enum value from mozilla/js/src/js.c
+ for (int i=0; i<testState.errors.errors.size(); i++) {
+ Status.JsError thisOne = (Status.JsError)testState.errors.errors.get(i);
+ if (thisOne.getMessage().indexOf("java.lang.OutOfMemoryError") != -1) {
+ testState.exitCode = 5;
+ testState.errors.errors.remove(thisOne);
+ }
+ }
+ status.hadErrors( (Status.JsError[])testState.errors.errors.toArray(new Status.JsError[0]) );
+ } catch (ThreadDeath e) {
+ } catch (Throwable t) {
+ status.threw(t);
+ }
+ return null;
+ }
+ });
+ } finally {
+ synchronized(testState)
+ {
+ testState.finished = true;
+ }
+ }
+ }
+ }, jsFile.getPath());
+ t.setDaemon(true);
+ t.start();
+ t.join(parameters.getTimeoutMilliseconds());
+ synchronized(testState)
+ {
+ if(!testState.finished)
+ {
+ t.stop();
+ status.timedOut();
+ }
+ }
+ int expectedExitCode = 0;
+ p.flush();
+ status.outputWas(new String(out.toByteArray()));
+ BufferedReader r = new BufferedReader(new InputStreamReader(
+ new ByteArrayInputStream(out.toByteArray())));
+ String failures = "";
+ for(;;)
+ {
+ String s = r.readLine();
+ if(s == null)
+ {
+ break;
+ }
+ if(s.indexOf("FAILED!") != -1)
+ {
+ failures += s + '\n';
+ }
+ int expex = s.indexOf("EXPECT EXIT CODE ");
+ if(expex != -1)
+ {
+ expectedExitCode = s.charAt(expex + "EXPECT EXIT CODE ".length()) - '0';
+ }
+ }
+ status.exitCodesWere(expectedExitCode, testState.exitCode);
+ if(failures != "")
+ {
+ status.failed(failures);
+ }
+ }
+}
diff --git a/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/StandardTests.java b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/StandardTests.java
new file mode 100644
index 0000000..9c05df6
--- /dev/null
+++ b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/StandardTests.java
@@ -0,0 +1,212 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Rhino code, released May 6, 1999.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1997-1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Attila Szegedi
+ * David P. Caldwell <inonit@inonit.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * the GNU General Public License Version 2 or later (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of those above. If
+ * you wish to allow use of your version of this file only under the terms of
+ * the GPL and not to allow others to use your version of this file under the
+ * MPL, indicate your decision by deleting the provisions above and replacing
+ * them with the notice and other provisions required by the GPL. If you do
+ * not delete the provisions above, a recipient may use your version of this
+ * file under either the MPL or the GPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+package org.mozilla.javascript.drivers;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Properties;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.mozilla.javascript.tools.shell.ShellContextFactory;
+
+/**
+ * Executes the tests in the js/tests directory, much like jsDriver.pl does.
+ * Excludes tests found in the js/tests/rhino-n.tests file.
+ * @author Attila Szegedi
+ * @version $Id: StandardTests.java,v 1.6.2.2 2008/02/11 16:57:16 nboyd%atg.com Exp $
+ */
+public class StandardTests extends TestSuite
+{
+ public static TestSuite suite() throws Exception
+ {
+ TestSuite suite = new TestSuite("Standard JavaScript tests");
+
+ File testDir = null;
+ if (System.getProperty("mozilla.js.tests") != null) {
+ testDir = new File(System.getProperty("mozilla.js.tests"));
+ } else {
+ URL url = StandardTests.class.getResource(".");
+ String path = url.getFile();
+ int jsIndex = path.lastIndexOf("/js");
+ if(jsIndex == -1)
+ {
+ throw new IllegalStateException("You aren't running the tests from within the standard mozilla/js directory structure");
+ }
+ path = path.substring(0, jsIndex + 3).replace('/', File.separatorChar);
+ testDir = new File(path, "tests");
+ }
+ if(!testDir.isDirectory())
+ {
+ throw new FileNotFoundException(testDir + " is not a directory");
+ }
+ Properties excludes = new Properties();
+ loadExcludes(excludes, "/base.skip");
+ Properties opt1Excludes = new Properties();
+ loadExcludes(opt1Excludes, "/opt1.skip");
+ opt1Excludes.putAll(excludes);
+ for(int i = -1; i < 2; ++i)
+ {
+ TestSuite optimizationLevelSuite = new TestSuite("Optimization level " + i);
+ addSuites(optimizationLevelSuite, testDir, i == -1 ? excludes : opt1Excludes, i);
+ suite.addTest(optimizationLevelSuite);
+ }
+ return suite;
+ }
+
+ private static void loadExcludes(Properties excludes, String excludeFileName) throws IOException
+ {
+ InputStream in = StandardTests.class.getResourceAsStream(excludeFileName);
+ try
+ {
+ excludes.load(in);
+ }
+ finally
+ {
+ in.close();
+ }
+ }
+
+ private static void addSuites(TestSuite topLevel, File testDir, Properties excludes, int optimizationLevel)
+ {
+ File[] subdirs = testDir.listFiles(ShellTest.DIRECTORY_FILTER);
+ Arrays.sort(subdirs);
+ for (int i = 0; i < subdirs.length; i++)
+ {
+ File subdir = subdirs[i];
+ String name = subdir.getName();
+ TestSuite testSuite = new TestSuite(name);
+ addCategories(testSuite, subdir, name + "/", excludes, optimizationLevel);
+ topLevel.addTest(testSuite);
+ }
+ }
+
+ private static void addCategories(TestSuite suite, File suiteDir, String prefix, Properties excludes, int optimizationLevel)
+ {
+ File[] subdirs = suiteDir.listFiles(ShellTest.DIRECTORY_FILTER);
+ Arrays.sort(subdirs);
+ for (int i = 0; i < subdirs.length; i++)
+ {
+ File subdir = subdirs[i];
+ String name = subdir.getName();
+ TestSuite testCategory = new TestSuite(name);
+ addTests(testCategory, subdir, prefix + name + "/", excludes, optimizationLevel);
+ suite.addTest(testCategory);
+ }
+ }
+
+ private static void addTests(TestSuite suite, File suiteDir, String prefix, Properties excludes, int optimizationLevel)
+ {
+ File[] jsFiles = suiteDir.listFiles(ShellTest.TEST_FILTER);
+ Arrays.sort(jsFiles);
+ for (int i = 0; i < jsFiles.length; i++)
+ {
+ File jsFile = jsFiles[i];
+ String name = jsFile.getName();
+ if(!excludes.containsKey(prefix + name))
+ {
+ suite.addTest(new JsTestCase(jsFile, optimizationLevel));
+ }
+ }
+ }
+
+ private static class JunitStatus extends ShellTest.Status {
+ final void running(File jsFile) {
+ // do nothing
+ }
+
+ final void failed(String s) {
+ Assert.fail(s);
+ }
+
+ final void exitCodesWere(int expected, int actual) {
+ Assert.assertEquals("Unexpected exit code", expected, actual);
+ }
+
+ final void outputWas(String s) {
+ System.out.print(s);
+ }
+
+ final void threw(Throwable t) {
+ Assert.fail(ShellTest.getStackTrace(t));
+ }
+
+ final void timedOut() {
+ failed("Timed out.");
+ }
+ }
+
+ private static final class JsTestCase extends TestCase
+ {
+ private final File jsFile;
+ private final int optimizationLevel;
+
+ JsTestCase(File jsFile, int optimizationLevel)
+ {
+ super(jsFile.getName() + (optimizationLevel == 1 ? "-compiled" : "-interpreted"));
+ this.jsFile = jsFile;
+ this.optimizationLevel = optimizationLevel;
+ }
+
+ public int countTestCases()
+ {
+ return 1;
+ }
+
+ private static class ShellTestParameters extends ShellTest.Parameters {
+ int getTimeoutMilliseconds() {
+ if (System.getProperty("mozilla.js.tests.timeout") != null) {
+ return Integer.parseInt(System.getProperty("mozilla.js.tests.timeout"));
+ }
+ return 60000;
+ }
+ }
+
+ public void runBare() throws Exception
+ {
+ final ShellContextFactory shellContextFactory = new ShellContextFactory();
+ shellContextFactory.setOptimizationLevel(optimizationLevel);
+ ShellTest.run(shellContextFactory, jsFile, new ShellTestParameters(), new JunitStatus());
+ }
+ }
+}
diff --git a/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/results.html b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/results.html
new file mode 100644
index 0000000..36bd729
--- /dev/null
+++ b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/drivers/results.html
@@ -0,0 +1,105 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Rhino: Test Results</title>
+</head>
+<body>
+ <a name="top"><span /></a>
+ <h1>Results of JavaScript Test Library for Rhino</h1>
+ <div id="summary">
+ <h2>Summary</h2>
+ <p>
+ <table>
+ <tr>
+ <td>
+ Test List
+ </td>
+ <td>
+ <span id="results.testlist">
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Skip List
+ </td>
+ <td>
+ <span id="results.skiplist">
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Results
+ </td>
+ <td>
+ <span id="results.results">
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Platform, JRE
+ </td>
+ <td>
+ <!--
+ Should include os.name, java.home, java.version, java.class.path
+ -->
+ <span id="results.platform"></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Classpath
+ </td>
+ <td>
+ <span id="results.classpath"></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Time
+ </td>
+ <td>
+ Execution took <span id="results.elapsed"></span>, ending at <span id="results.time"></span>
+ </td>
+ </tr>
+ </table>
+ </p>
+ <p>
+ <a href="#failureDetails">Failure Details</a>
+ <a href="#retestList">Retest List</a>
+ </p>
+ </div>
+ <div id="failureDetails">
+ <a name="failureDetails"><span /></a>
+ <h2>Failure Details</h2>
+ <div id="failureDetails.prototype">
+ <h3>
+ Testcase <a id="failureDetails.lxr" href=""><span id="failureDetails.lxr.text">path</span></a> failed
+ <a id="failureDetails.bug.href" href="">Bug Number <span id="failureDetails.bug.number">XXX</span></a>
+ </h3>
+ <div>
+ <pre id="failureDetails.status">
+ </pre>
+ <pre id="failureDetails.reason">
+ </pre>
+ <pre id="failureDetails.output">
+ </pre>
+ </div>
+ <div>
+ <a href="#top">Top of Page</a>
+ </div>
+ </div>
+ </div>
+ <div>
+ <a href="#failureDetails">Top of Failures</a>
+ </div>
+ <div>
+ <a name="retestList"><span /></a>
+ <h2>Retest List</h2>
+ <pre id="retestList.text"></pre>
+ <a href="#top">Top of Page</a>
+ <a href="#retestList">Top of Retest List</a>
+ </div>
+</body>
+</html>
diff --git a/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/tests/Bug409702Test.java b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/tests/Bug409702Test.java
new file mode 100644
index 0000000..e9793cb
--- /dev/null
+++ b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/tests/Bug409702Test.java
@@ -0,0 +1,49 @@
+/**
+ *
+ */
+package org.mozilla.javascript.tests;
+
+import junit.framework.TestCase;
+
+import org.mozilla.javascript.*;
+
+/**
+ * See https://bugzilla.mozilla.org/show_bug.cgi?id=409702
+ * @author Norris Boyd
+ */
+public class Bug409702Test extends TestCase {
+
+ public static abstract class Test {
+ public Test() {
+ }
+
+ public abstract void a();
+
+ public abstract int b();
+
+ public static abstract class Subclass extends Test {
+
+ @Override
+ public final void a() {
+ }
+ }
+ }
+
+ public void testAdapter() {
+ final int value = 12;
+ String source =
+ "var instance = " +
+ " new JavaAdapter(" + getClass().getName() + ".Test.Subclass," +
+ "{ b: function () { return " + value + "; } });" +
+ "instance.b();";
+
+ Context cx = ContextFactory.getGlobal().enterContext();
+ try {
+ Scriptable scope = cx.initStandardObjects();
+ Object result = cx.evaluateString(scope, source, "source", 1, null);
+ assertEquals(new Integer(value), result);
+ } finally {
+ Context.exit();
+ }
+ }
+}
diff --git a/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/tests/JavaAcessibilityTest.java b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/tests/JavaAcessibilityTest.java
new file mode 100644
index 0000000..b6cf3ca
--- /dev/null
+++ b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/tests/JavaAcessibilityTest.java
@@ -0,0 +1,99 @@
+/**
+ *
+ */
+package org.mozilla.javascript.tests;
+
+import junit.framework.TestCase;
+
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.ContextAction;
+import org.mozilla.javascript.ContextFactory;
+import org.mozilla.javascript.NativeJavaObject;
+import org.mozilla.javascript.Script;
+import org.mozilla.javascript.tools.shell.Global;
+import org.mozilla.javascript.tools.shell.ShellContextFactory;
+
+/**
+ * @author donnamalayeri
+ */
+public class JavaAcessibilityTest extends TestCase {
+
+ protected final Global global = new Global();
+ String importClass = "importClass(Packages.org.mozilla.javascript.tests.PrivateAccessClass)\n";
+
+ public JavaAcessibilityTest() {
+ global.init(contextFactory);
+ }
+
+ private ContextFactory contextFactory = new ShellContextFactory() {
+ protected boolean hasFeature(Context cx, int featureIndex) {
+ if (featureIndex == Context.FEATURE_ENHANCED_JAVA_ACCESS)
+ return true;
+ return super.hasFeature(cx, featureIndex);
+ }
+ };
+
+ public void testAccessingFields() {
+ Object result = runScript(importClass + "PrivateAccessClass.staticPackagePrivateInt");
+ assertEquals(new Integer(0), result);
+
+ result = runScript(importClass + "PrivateAccessClass.staticPrivateInt");
+ assertEquals(new Integer(1), result);
+
+ result = runScript(importClass + "PrivateAccessClass.staticProtectedInt");
+ assertEquals(new Integer(2), result);
+
+ result = runScript(importClass + "new PrivateAccessClass().packagePrivateString");
+ assertEquals("package private", ((NativeJavaObject) result).unwrap());
+
+ result = runScript(importClass + "new PrivateAccessClass().privateString");
+ assertEquals("private", ((NativeJavaObject) result).unwrap());
+
+ result = runScript(importClass + "new PrivateAccessClass().protectedString");
+ assertEquals("protected", ((NativeJavaObject) result).unwrap());
+
+ result = runScript(importClass + "new PrivateAccessClass.PrivateNestedClass().packagePrivateInt");
+ assertEquals(new Integer(0), result);
+
+ result = runScript(importClass + "new PrivateAccessClass.PrivateNestedClass().privateInt");
+ assertEquals(new Integer(1), result);
+
+ result = runScript(importClass + "new PrivateAccessClass.PrivateNestedClass().protectedInt");
+ assertEquals(new Integer(2), result);
+ }
+
+ public void testAccessingMethods() {
+ Object result = runScript(importClass + "PrivateAccessClass.staticPackagePrivateMethod()");
+ assertEquals(new Integer(0), result);
+
+ result = runScript(importClass + "PrivateAccessClass.staticPrivateMethod()");
+ assertEquals(new Integer(1), result);
+
+ result = runScript(importClass + "PrivateAccessClass.staticProtectedMethod()");
+ assertEquals(new Integer(2), result);
+
+ result = runScript(importClass + "new PrivateAccessClass().packagePrivateMethod()");
+ assertEquals(new Integer(3), result);
+
+ result = runScript(importClass + "new PrivateAccessClass().privateMethod()");
+ assertEquals(new Integer(4), result);
+
+ result = runScript(importClass + "new PrivateAccessClass().protectedMethod()");
+ assertEquals(new Integer(5), result);
+ }
+
+ public void testAccessingConstructors() {
+ runScript(importClass + "new PrivateAccessClass(\"foo\")");
+ runScript(importClass + "new PrivateAccessClass(5)");
+ runScript(importClass + "new PrivateAccessClass(5, \"foo\")");
+ }
+
+ private Object runScript(final String scriptSourceText) {
+ return this.contextFactory.call(new ContextAction() {
+ public Object run(Context context) {
+ Script script = context.compileString(scriptSourceText, "", 1, null);
+ return script.exec(context, global);
+ }
+ });
+ }
+}
diff --git a/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/tests/PrivateAccessClass.java b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/tests/PrivateAccessClass.java
new file mode 100644
index 0000000..08f95a3
--- /dev/null
+++ b/trunk/infrastructure/rhino1_7R1/testsrc/org/mozilla/javascript/tests/PrivateAccessClass.java
@@ -0,0 +1,89 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Rhino code, released May 6, 1999.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1997-1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Attila Szegedi
+ * David P. Caldwell <inonit@inonit.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * the GNU General Public License Version 2 or later (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of those above. If
+ * you wish to allow use of your version of this file only under the terms of
+ * the GPL and not to allow others to use your version of this file under the
+ * MPL, indicate your decision by deleting the provisions above and replacing
+ * them with the notice and other provisions required by the GPL. If you do
+ * not delete the provisions above, a recipient may use your version of this
+ * file under either the MPL or the GPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+package org.mozilla.javascript.tests;
+
+/**
+ * A class with private/protected/package private members, to test the Rhino
+ * feature Context.FEATURE_ENHANCED_JAVA_ACCESS, that allows bypassing Java
+ * member access restrictions.
+ * @author Donna Malayeri
+ */
+
+public class PrivateAccessClass
+{
+ private PrivateAccessClass() { }
+ PrivateAccessClass(String s) { }
+ private PrivateAccessClass(int x) { }
+ protected PrivateAccessClass(int x, String s) { }
+
+ private static class PrivateNestedClass
+ {
+ private PrivateNestedClass() { }
+
+ int packagePrivateInt = 0;
+ private int privateInt = 1;
+ protected int protectedInt = 2;
+ }
+
+ static int staticPackagePrivateInt = 0;
+ private static int staticPrivateInt = 1;
+ protected static int staticProtectedInt = 2;
+
+ String packagePrivateString = "package private";
+ private String privateString = "private";
+ protected String protectedString = "protected";
+
+ static int staticPackagePrivateMethod() { return 0; }
+ static private int staticPrivateMethod() { return 1; }
+ static protected int staticProtectedMethod() { return 2; }
+
+ int packagePrivateMethod() { return 3; }
+ private int privateMethod() { return 4; }
+ protected int protectedMethod() { return 5; }
+
+ /*
+ * Suppress warnings about unused private members.
+ */
+ public int referenceToPrivateMembers() {
+ PrivateAccessClass pac = new PrivateAccessClass();
+ PrivateAccessClass pac2 = new PrivateAccessClass(2);
+ PrivateNestedClass pnc = new PrivateNestedClass();
+ System.out.println(privateString);
+ return pnc.privateInt + staticPrivateInt + staticPrivateMethod() +
+ pac.privateMethod();
+ }
+}