| OLD | NEW |
| 1 # Copyright 2008 the V8 project authors. All rights reserved. | 1 # Copyright 2008 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, basename | 30 from os.path import join, dirname, exists, basename, isdir |
| 31 import re | 31 import re |
| 32 | 32 |
| 33 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") | 33 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") |
| 34 | 34 |
| 35 class MessageTestCase(test.TestCase): | 35 class MessageTestCase(test.TestCase): |
| 36 | 36 |
| 37 def __init__(self, path, file, expected, mode, context, config): | 37 def __init__(self, path, file, expected, mode, context, config): |
| 38 super(MessageTestCase, self).__init__(context, path) | 38 super(MessageTestCase, self).__init__(context, path) |
| 39 self.file = file | 39 self.file = file |
| 40 self.expected = expected | 40 self.expected = expected |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 + "\n--- expected output ---\n" | 86 + "\n--- expected output ---\n" |
| 87 + open(self.expected).read()) | 87 + open(self.expected).read()) |
| 88 | 88 |
| 89 | 89 |
| 90 class MessageTestConfiguration(test.TestConfiguration): | 90 class MessageTestConfiguration(test.TestConfiguration): |
| 91 | 91 |
| 92 def __init__(self, context, root): | 92 def __init__(self, context, root): |
| 93 super(MessageTestConfiguration, self).__init__(context, root) | 93 super(MessageTestConfiguration, self).__init__(context, root) |
| 94 | 94 |
| 95 def Ls(self, path): | 95 def Ls(self, path): |
| 96 return [f[:-3] for f in os.listdir(path) if f.endswith('.js')] | 96 if isdir(path): |
| 97 return [f[:-3] for f in os.listdir(path) if f.endswith('.js')] |
| 98 else: |
| 99 return [] |
| 97 | 100 |
| 98 def ListTests(self, current_path, path, mode): | 101 def ListTests(self, current_path, path, mode): |
| 99 mjsunit = [current_path + [t] for t in self.Ls(self.root)] | 102 mjsunit = [current_path + [t] for t in self.Ls(self.root)] |
| 100 regress = [current_path + ['regress', t] for t in self.Ls(join(self.root, 'r
egress'))] | 103 regress = [current_path + ['regress', t] for t in self.Ls(join(self.root, 'r
egress'))] |
| 101 bugs = [current_path + ['bugs', t] for t in self.Ls(join(self.root, 'bugs'))
] | 104 bugs = [current_path + ['bugs', t] for t in self.Ls(join(self.root, 'bugs'))
] |
| 102 all_tests = mjsunit + regress + bugs | 105 all_tests = mjsunit + regress + bugs |
| 103 result = [] | 106 result = [] |
| 104 for test in all_tests: | 107 for test in all_tests: |
| 105 if self.Contains(path, test): | 108 if self.Contains(path, test): |
| 106 file_prefix = join(self.root, reduce(join, test[1:], "")) | 109 file_prefix = join(self.root, reduce(join, test[1:], "")) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 117 return ['sample', 'sample=shell'] | 120 return ['sample', 'sample=shell'] |
| 118 | 121 |
| 119 def GetTestStatus(self, sections, defs): | 122 def GetTestStatus(self, sections, defs): |
| 120 status_file = join(self.root, 'message.status') | 123 status_file = join(self.root, 'message.status') |
| 121 if exists(status_file): | 124 if exists(status_file): |
| 122 test.ReadConfigurationInto(status_file, sections, defs) | 125 test.ReadConfigurationInto(status_file, sections, defs) |
| 123 | 126 |
| 124 | 127 |
| 125 def GetConfiguration(context, root): | 128 def GetConfiguration(context, root): |
| 126 return MessageTestConfiguration(context, root) | 129 return MessageTestConfiguration(context, root) |
| OLD | NEW |