| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2008 the V8 project authors. All rights reserved. | 3 # Copyright 2008 the V8 project authors. All rights reserved. |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 self.exit_code = exit_code | 257 self.exit_code = exit_code |
| 258 self.stdout = stdout | 258 self.stdout = stdout |
| 259 self.stderr = stderr | 259 self.stderr = stderr |
| 260 | 260 |
| 261 | 261 |
| 262 class TestCase(object): | 262 class TestCase(object): |
| 263 | 263 |
| 264 def __init__(self, context, path): | 264 def __init__(self, context, path): |
| 265 self.path = path | 265 self.path = path |
| 266 self.context = context | 266 self.context = context |
| 267 self.failed = None |
| 267 | 268 |
| 268 def IsNegative(self): | 269 def IsNegative(self): |
| 269 return False | 270 return False |
| 270 | 271 |
| 272 def DidFail(self, output): |
| 273 if self.failed is None: |
| 274 self.failed = self.IsFailureOutput(output) |
| 275 return self.failed |
| 276 |
| 271 def IsFailureOutput(self, output): | 277 def IsFailureOutput(self, output): |
| 272 return output.exit_code != 0 | 278 return output.exit_code != 0 |
| 273 | 279 |
| 274 def GetSource(self): | 280 def GetSource(self): |
| 275 return "(no source available)" | 281 return "(no source available)" |
| 276 | 282 |
| 277 def Run(self): | 283 def Run(self): |
| 278 command = self.GetCommand() | 284 command = self.GetCommand() |
| 279 full_command = self.context.processor(command) | 285 full_command = self.context.processor(command) |
| 280 output = Execute(full_command, self.context, self.context.timeout) | 286 output = Execute(full_command, self.context, self.context.timeout) |
| 281 return TestOutput(self, full_command, output) | 287 return TestOutput(self, full_command, output) |
| 282 | 288 |
| 283 | 289 |
| 284 class TestOutput(object): | 290 class TestOutput(object): |
| 285 | 291 |
| 286 def __init__(self, test, command, output): | 292 def __init__(self, test, command, output): |
| 287 self.test = test | 293 self.test = test |
| 288 self.command = command | 294 self.command = command |
| 289 self.output = output | 295 self.output = output |
| 290 | 296 |
| 291 def UnexpectedOutput(self): | 297 def UnexpectedOutput(self): |
| 292 if self.HasFailed(): | 298 if self.HasFailed(): |
| 293 outcome = FAIL | 299 outcome = FAIL |
| 294 else: | 300 else: |
| 295 outcome = PASS | 301 outcome = PASS |
| 296 return not outcome in self.test.outcomes | 302 return not outcome in self.test.outcomes |
| 297 | 303 |
| 298 def HasFailed(self): | 304 def HasFailed(self): |
| 299 execution_failed = self.test.IsFailureOutput(self.output) | 305 execution_failed = self.test.DidFail(self.output) |
| 300 if self.test.IsNegative(): | 306 if self.test.IsNegative(): |
| 301 return not execution_failed | 307 return not execution_failed |
| 302 else: | 308 else: |
| 303 return execution_failed | 309 return execution_failed |
| 304 | 310 |
| 305 | 311 |
| 306 def KillProcessWithID(pid): | 312 def KillProcessWithID(pid): |
| 307 if platform.system() == 'Windows': | 313 if platform.system() == 'Windows': |
| 308 os.popen('taskkill /T /F /PID %d' % pid) | 314 os.popen('taskkill /T /F /PID %d' % pid) |
| 309 else: | 315 else: |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 return ExpandCommand | 1059 return ExpandCommand |
| 1054 else: | 1060 else: |
| 1055 pos = value.find('@') | 1061 pos = value.find('@') |
| 1056 prefix = value[:pos].split() | 1062 prefix = value[:pos].split() |
| 1057 suffix = value[pos+1:].split() | 1063 suffix = value[pos+1:].split() |
| 1058 def ExpandCommand(args): | 1064 def ExpandCommand(args): |
| 1059 return prefix + args + suffix | 1065 return prefix + args + suffix |
| 1060 return ExpandCommand | 1066 return ExpandCommand |
| 1061 | 1067 |
| 1062 | 1068 |
| 1063 BUILT_IN_TESTS = ['mjsunit', 'cctest'] | 1069 BUILT_IN_TESTS = ['mjsunit', 'cctest', 'message'] |
| 1064 | 1070 |
| 1065 | 1071 |
| 1066 def GetSuites(test_root): | 1072 def GetSuites(test_root): |
| 1067 def IsSuite(path): | 1073 def IsSuite(path): |
| 1068 return isdir(path) and exists(join(path, 'testcfg.py')) | 1074 return isdir(path) and exists(join(path, 'testcfg.py')) |
| 1069 return [ f for f in os.listdir(test_root) if IsSuite(join(test_root, f)) ] | 1075 return [ f for f in os.listdir(test_root) if IsSuite(join(test_root, f)) ] |
| 1070 | 1076 |
| 1071 | 1077 |
| 1072 def Main(): | 1078 def Main(): |
| 1073 parser = BuildOptions() | 1079 parser = BuildOptions() |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 return 0 | 1168 return 0 |
| 1163 else: | 1169 else: |
| 1164 return 1 | 1170 return 1 |
| 1165 except KeyboardInterrupt: | 1171 except KeyboardInterrupt: |
| 1166 print "Interrupted" | 1172 print "Interrupted" |
| 1167 return 1 | 1173 return 1 |
| 1168 | 1174 |
| 1169 | 1175 |
| 1170 if __name__ == '__main__': | 1176 if __name__ == '__main__': |
| 1171 sys.exit(Main()) | 1177 sys.exit(Main()) |
| OLD | NEW |