Ensure old tab state is cleared between iterations of run-benchmark
[WebKit-https.git] / Tools / Scripts / create-mozilla-js-test-list
1 #!/usr/bin/env ruby
2
3 # Copyright (C) 2013 Apple Inc. All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
7 # are met:
8 #
9 # 1.  Redistributions of source code must retain the above copyright
10 #     notice, this list of conditions and the following disclaimer. 
11 # 2.  Redistributions in binary form must reproduce the above copyright
12 #     notice, this list of conditions and the following disclaimer in the
13 #     documentation and/or other materials provided with the distribution. 
14 #
15 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
16 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
19 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26 require 'pathname'
27 require 'yaml'
28
29 def toSet(array)
30     hash = {}
31     array.each {
32         | value |
33         hash[value] = true
34     }
35     hash
36 end
37
38 # Negative mozilla tests that we pass just fine.
39 EXPECT_NO_FAIL =
40     toSet(["js1_2/function/function-001-n.js",
41            "js1_3/Script/function-001-n.js",
42            "js1_3/regress/function-001-n.js"])
43
44 EXPECT_FAIL =
45     toSet(["ecma_2/Exceptions/function-001.js",
46            "ecma_2/RegExp/regress-001.js",
47            "ecma_3/FunExpr/fe-001.js",
48            "ecma_3/Statements/regress-194364.js",
49            "ecma_3/Unicode/uc-001.js",
50            "js1_2/Objects/toString-001.js",
51            "js1_2/function/Function_object.js",
52            "js1_2/function/regexparg-1.js",
53            "js1_2/operator/equality.js",
54            "js1_2/regexp/RegExp_lastIndex.js",
55            "js1_2/regexp/regress-6359.js",
56            "js1_2/regexp/regress-9141.js",
57            "js1_2/regexp/simple_form.js",
58            "js1_2/regexp/string_split.js",
59            "js1_2/version120/boolean-001.js",
60            "js1_2/version120/regress-99663.js",
61            "js1_3/Script/script-001.js",
62            "js1_5/Exceptions/catchguard-001.js",
63            "js1_5/Exceptions/catchguard-002.js",
64            "js1_5/Exceptions/catchguard-003.js",
65            "js1_5/Exceptions/errstack-001.js",
66            "js1_5/Exceptions/regress-50447.js",
67            "js1_5/GetSet/getset-001.js",
68            "js1_5/GetSet/getset-002.js",
69            "js1_5/GetSet/getset-003.js",
70            "js1_5/Object/regress-90596-001.js",
71            "js1_5/Object/regress-90596-002.js",
72            "js1_5/Object/regress-96284-001.js",
73            "js1_5/Object/regress-96284-002.js",
74            "js1_5/Regress/regress-44009.js",
75            "js1_5/Regress/regress-103602.js",
76            "js1_5/Regress/regress-104077.js",
77            "js1_5/Regress/regress-127557.js",
78            "js1_5/Regress/regress-172699.js",
79            "js1_5/Regress/regress-179524.js",
80            "js1_5/Scope/regress-220584.js",
81            "js1_5/Scope/scope-001.js",
82            "js1_6/Regress/regress-301574.js",
83            "js1_6/Regress/regress-309242.js",
84            "js1_6/Regress/regress-314887.js",
85            "js1_6/String/regress-306591.js"])
86
87 SKIPPED =
88     toSet(["ecma/Date/15.9.2.1.js",
89            "ecma/Date/15.9.2.2-1.js",
90            "ecma/Date/15.9.2.2-2.js",
91            "ecma/Date/15.9.2.2-3.js",
92            "ecma/Date/15.9.2.2-4.js",
93            "ecma/Date/15.9.2.2-5.js",
94            "ecma/Date/15.9.2.2-6.js",
95            "ecma_3/Date/15.9.5.7.js",
96            "ecma/Date/15.9.5.14.js",
97            "ecma/Date/15.9.5.31-1.js",
98            "ecma/Date/15.9.5.34-1.js"])
99           
100 $me = Pathname.new(ARGV[0])
101 $list = []
102
103 def recurse(directory, shells, countdown)
104     toRecurse = []
105     toRun = []
106     directory.each_child {
107         | entry |
108         if entry.basename.to_s == "shell.js"
109             shells = shells + [entry]
110         elsif entry.directory?
111             toRecurse << entry
112         elsif entry.basename.to_s =~ /\.js$/ and countdown <= 0
113             toRun << entry
114         end
115     }
116     toRecurse.each {
117         | entry |
118         recurse(entry, shells, countdown - 1)
119     }
120     toRun.each {
121         | entry |
122         testPath = entry.relative_path_from($me).to_s
123         mode = :normal
124         if entry.basename.to_s =~ /-n\.js/
125             mode = :negative
126         end
127         if SKIPPED[testPath]
128             mode = :skip
129         end
130         if EXPECT_FAIL[testPath]
131             mode = :fail
132         end
133         if EXPECT_NO_FAIL[testPath]
134             mode = :normal
135         end
136         $list << {
137             "path" => testPath,
138             "cmd" => "defaultRunMozillaTest :#{mode}, " + shells.map {
139                 | shell |
140                 shell.relative_path_from(directory).to_s.inspect
141             }.join(", ")
142         }
143     }
144 end
145
146 recurse($me, [], 2)
147
148 puts $list.to_yaml
149