| OLD | NEW |
| 1 # Copyright 2011 the V8 project authors. All rights reserved. | 1 # Copyright 2011 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| 11 # with the distribution. | 11 # with the distribution. |
| 12 # * Neither the name of Google Inc. nor the names of its | 12 # * Neither the name of Google Inc. nor the names of its |
| 13 # contributors may be used to endorse or promote products derived | 13 # contributors may be used to endorse or promote products derived |
| 14 # from this software without specific prior written permission. | 14 # from this software without specific prior written permission. |
| 15 # | 15 # |
| 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 import test | 28 import test |
| 29 import os | 29 import os |
| 30 from os.path import join, dirname, exists | 30 from os.path import join, dirname, exists, isfile |
| 31 import platform | 31 import platform |
| 32 import utils | 32 import utils |
| 33 import re | 33 import re |
| 34 | 34 |
| 35 class PreparserTestCase(test.TestCase): | 35 class PreparserTestCase(test.TestCase): |
| 36 | 36 |
| 37 def __init__(self, root, path, executable, mode, throws, context, source): | 37 def __init__(self, root, path, executable, mode, throws, context, source): |
| 38 super(PreparserTestCase, self).__init__(context, path, mode) | 38 super(PreparserTestCase, self).__init__(context, path, mode) |
| 39 self.executable = executable | 39 self.executable = executable |
| 40 self.root = root | 40 self.root = root |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 testsource = source | 115 testsource = source |
| 116 for key in replacement.keys(): | 116 for key in replacement.keys(): |
| 117 testname = testname.replace("$"+key, replacement[key]); | 117 testname = testname.replace("$"+key, replacement[key]); |
| 118 testsource = testsource.replace("$"+key, replacement[key]); | 118 testsource = testsource.replace("$"+key, replacement[key]); |
| 119 Test(testname, testsource, expectation) | 119 Test(testname, testsource, expectation) |
| 120 return MkTest | 120 return MkTest |
| 121 eval(compile(source, pathname, "exec"), | 121 eval(compile(source, pathname, "exec"), |
| 122 {"Test": Test, "Template": Template}, {}) | 122 {"Test": Test, "Template": Template}, {}) |
| 123 | 123 |
| 124 def ListTests(self, current_path, path, mode, variant_flags): | 124 def ListTests(self, current_path, path, mode, variant_flags): |
| 125 executable = join('obj', 'preparser', mode, 'preparser') | 125 executable = 'preparser' |
| 126 if utils.IsWindows(): | 126 if utils.IsWindows(): |
| 127 executable += '.exe' | 127 executable += '.exe' |
| 128 executable = join(self.context.buildspace, executable) | 128 executable = join(self.context.buildspace, executable) |
| 129 if not isfile(executable): |
| 130 executable = join('obj', 'preparser', mode, 'preparser') |
| 131 if utils.IsWindows(): |
| 132 executable += '.exe' |
| 133 executable = join(self.context.buildspace, executable) |
| 129 expectations = self.GetExpectations() | 134 expectations = self.GetExpectations() |
| 130 result = [] | 135 result = [] |
| 131 # Find all .js files in tests/preparser directory. | 136 # Find all .js files in tests/preparser directory. |
| 132 filenames = [f[:-3] for f in os.listdir(self.root) if f.endswith(".js")] | 137 filenames = [f[:-3] for f in os.listdir(self.root) if f.endswith(".js")] |
| 133 filenames.sort() | 138 filenames.sort() |
| 134 for file in filenames: | 139 for file in filenames: |
| 135 throws = None; | 140 throws = None; |
| 136 if (file in expectations): | 141 if (file in expectations): |
| 137 throws = expectations[file] | 142 throws = expectations[file] |
| 138 result.append(PreparserTestCase(self.root, | 143 result.append(PreparserTestCase(self.root, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 152 status_file = join(self.root, 'preparser.status') | 157 status_file = join(self.root, 'preparser.status') |
| 153 if exists(status_file): | 158 if exists(status_file): |
| 154 test.ReadConfigurationInto(status_file, sections, defs) | 159 test.ReadConfigurationInto(status_file, sections, defs) |
| 155 | 160 |
| 156 def VariantFlags(self): | 161 def VariantFlags(self): |
| 157 return [[]]; | 162 return [[]]; |
| 158 | 163 |
| 159 | 164 |
| 160 def GetConfiguration(context, root): | 165 def GetConfiguration(context, root): |
| 161 return PreparserTestConfiguration(context, root) | 166 return PreparserTestConfiguration(context, root) |
| OLD | NEW |