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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 352 |
353 def GetSource(self): | 353 def GetSource(self): |
354 return "(no source available)" | 354 return "(no source available)" |
355 | 355 |
356 def RunCommand(self, command): | 356 def RunCommand(self, command): |
357 full_command = self.context.processor(command) | 357 full_command = self.context.processor(command) |
358 output = Execute(full_command, self.context, self.context.timeout) | 358 output = Execute(full_command, self.context, self.context.timeout) |
359 self.Cleanup() | 359 self.Cleanup() |
360 return TestOutput(self, full_command, output) | 360 return TestOutput(self, full_command, output) |
361 | 361 |
| 362 def BeforeRun(self): |
| 363 pass |
| 364 |
| 365 def AfterRun(self): |
| 366 pass |
| 367 |
362 def Run(self): | 368 def Run(self): |
363 return self.RunCommand(self.GetCommand()) | 369 self.BeforeRun() |
| 370 try: |
| 371 result = self.RunCommand(self.GetCommand()) |
| 372 finally: |
| 373 self.AfterRun() |
| 374 return result |
364 | 375 |
365 def Cleanup(self): | 376 def Cleanup(self): |
366 return | 377 return |
367 | 378 |
368 | 379 |
369 class TestOutput(object): | 380 class TestOutput(object): |
370 | 381 |
371 def __init__(self, test, command, output): | 382 def __init__(self, test, command, output): |
372 self.test = test | 383 self.test = test |
373 self.command = command | 384 self.command = command |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 for entry in timed_tests[:20]: | 1361 for entry in timed_tests[:20]: |
1351 t = FormatTime(entry.duration) | 1362 t = FormatTime(entry.duration) |
1352 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) | 1363 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) |
1353 index += 1 | 1364 index += 1 |
1354 | 1365 |
1355 return result | 1366 return result |
1356 | 1367 |
1357 | 1368 |
1358 if __name__ == '__main__': | 1369 if __name__ == '__main__': |
1359 sys.exit(Main()) | 1370 sys.exit(Main()) |
OLD | NEW |