| 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 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 class Test262TestCase(test.TestCase): | 37 class Test262TestCase(test.TestCase): |
| 38 | 38 |
| 39 def __init__(self, filename, path, context, root, mode, framework): | 39 def __init__(self, filename, path, context, root, mode, framework): |
| 40 super(Test262TestCase, self).__init__(context, path, mode) | 40 super(Test262TestCase, self).__init__(context, path, mode) |
| 41 self.filename = filename | 41 self.filename = filename |
| 42 self.framework = framework | 42 self.framework = framework |
| 43 self.root = root | 43 self.root = root |
| 44 | 44 |
| 45 def IsNegative(self): | 45 def IsNegative(self): |
| 46 return self.filename.endswith('-n.js') | 46 return '@negative' in self.GetSource() |
| 47 | 47 |
| 48 def GetLabel(self): | 48 def GetLabel(self): |
| 49 return "%s test262 %s %s" % (self.mode, self.GetGroup(), self.GetName()) | 49 return "%s test262 %s" % (self.mode, self.GetName()) |
| 50 | 50 |
| 51 def IsFailureOutput(self, output): | 51 def IsFailureOutput(self, output): |
| 52 if output.exit_code != 0: | 52 if output.exit_code != 0: |
| 53 return True | 53 return True |
| 54 return 'FAILED!' in output.stdout | 54 return 'FAILED!' in output.stdout |
| 55 | 55 |
| 56 def GetCommand(self): | 56 def GetCommand(self): |
| 57 result = self.context.GetVmCommand(self, self.mode) | 57 result = self.context.GetVmCommand(self, self.mode) |
| 58 result += ['-e', 'var window = this'] | 58 result += ['-e', 'var window = this'] |
| 59 result += self.framework | 59 result += self.framework |
| 60 result.append(self.filename) | 60 result.append(self.filename) |
| 61 return result | 61 return result |
| 62 | 62 |
| 63 def GetName(self): | 63 def GetName(self): |
| 64 return self.path[-1] | 64 return self.path[-1] |
| 65 | 65 |
| 66 def GetGroup(self): | |
| 67 return self.path[0] | |
| 68 | |
| 69 def GetSource(self): | 66 def GetSource(self): |
| 70 return open(self.filename).read() | 67 return open(self.filename).read() |
| 71 | 68 |
| 72 | 69 |
| 73 class Test262TestConfiguration(test.TestConfiguration): | 70 class Test262TestConfiguration(test.TestConfiguration): |
| 74 | 71 |
| 75 def __init__(self, context, root): | 72 def __init__(self, context, root): |
| 76 super(Test262TestConfiguration, self).__init__(context, root) | 73 super(Test262TestConfiguration, self).__init__(context, root) |
| 77 | 74 |
| 78 def AddIETestCenter(self, tests, current_path, path, mode): | 75 def ListTests(self, current_path, path, mode, variant_flags): |
| 79 current_root = join(self.root, 'data', 'test', 'suite', 'ietestcenter') | 76 testroot = join(self.root, 'data', 'test', 'suite') |
| 80 harness = [join(self.root, 'data', 'test', 'harness', f) | 77 harness = [join(self.root, 'data', 'test', 'harness', f) |
| 81 for f in TEST_262_HARNESS] | 78 for f in TEST_262_HARNESS] |
| 82 harness += [join(self.root, 'harness-adapt.js')] | 79 harness += [join(self.root, 'harness-adapt.js')] |
| 83 for root, dirs, files in os.walk(current_root): | 80 tests = [] |
| 84 for dotted in [x for x in dirs if x.startswith('.')]: | 81 for root, dirs, files in os.walk(testroot): |
| 82 for dotted in [x for x in dirs if x.startswith('.')]: |
| 85 dirs.remove(dotted) | 83 dirs.remove(dotted) |
| 86 dirs.sort() | 84 dirs.sort() |
| 87 root_path = root[len(self.root):].split(os.path.sep) | 85 root_path = root[len(self.root):].split(os.path.sep) |
| 88 root_path = current_path + [x for x in root_path if x] | 86 root_path = current_path + [x for x in root_path if x] |
| 89 files.sort() | 87 files.sort() |
| 90 for file in files: | 88 for file in files: |
| 91 if file.endswith('.js'): | 89 if file.endswith('.js'): |
| 92 if self.Contains(path, root_path): | 90 test_path = ['test262', file[:-3]] |
| 93 test_path = ['ietestcenter', file[:-3]] | 91 if self.Contains(path, test_path): |
| 94 test = Test262TestCase(join(root, file), test_path, self.context, | 92 test = Test262TestCase(join(root, file), test_path, self.context, |
| 95 self.root, mode, harness) | 93 self.root, mode, harness) |
| 96 tests.append(test) | 94 tests.append(test) |
| 97 | |
| 98 def AddSputnikConvertedTests(self, tests, current_path, path, mode): | |
| 99 # To be enabled | |
| 100 pass | |
| 101 | |
| 102 def AddSputnikTests(self, tests, current_path, path, mode): | |
| 103 # To be enabled | |
| 104 pass | |
| 105 | |
| 106 def ListTests(self, current_path, path, mode, variant_flags): | |
| 107 tests = [] | |
| 108 self.AddIETestCenter(tests, current_path, path, mode) | |
| 109 self.AddSputnikConvertedTests(tests, current_path, path, mode) | |
| 110 self.AddSputnikTests(tests, current_path, path, mode) | |
| 111 return tests | 95 return tests |
| 112 | 96 |
| 113 def GetBuildRequirements(self): | 97 def GetBuildRequirements(self): |
| 114 return ['d8'] | 98 return ['d8'] |
| 115 | 99 |
| 116 def GetTestStatus(self, sections, defs): | 100 def GetTestStatus(self, sections, defs): |
| 117 status_file = join(self.root, 'test262.status') | 101 status_file = join(self.root, 'test262.status') |
| 118 if exists(status_file): | 102 if exists(status_file): |
| 119 test.ReadConfigurationInto(status_file, sections, defs) | 103 test.ReadConfigurationInto(status_file, sections, defs) |
| 120 | 104 |
| 121 | 105 |
| 122 def GetConfiguration(context, root): | 106 def GetConfiguration(context, root): |
| 123 return Test262TestConfiguration(context, root) | 107 return Test262TestConfiguration(context, root) |
| OLD | NEW |