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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 full_command, | 364 full_command, |
365 output, | 365 output, |
366 self.context.store_unexpected_output) | 366 self.context.store_unexpected_output) |
367 | 367 |
368 def BeforeRun(self): | 368 def BeforeRun(self): |
369 pass | 369 pass |
370 | 370 |
371 def AfterRun(self, result): | 371 def AfterRun(self, result): |
372 pass | 372 pass |
373 | 373 |
| 374 def GetCustomFlags(self, mode): |
| 375 return None |
| 376 |
374 def Run(self): | 377 def Run(self): |
375 self.BeforeRun() | 378 self.BeforeRun() |
376 try: | 379 try: |
377 result = self.RunCommand(self.GetCommand()) | 380 result = self.RunCommand(self.GetCommand()) |
378 finally: | 381 finally: |
379 self.AfterRun(result) | 382 self.AfterRun(result) |
380 return result | 383 return result |
381 | 384 |
382 def Cleanup(self): | 385 def Cleanup(self): |
383 return | 386 return |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 def GetVm(self, mode): | 667 def GetVm(self, mode): |
665 name = self.vm_root + SUFFIX[mode] | 668 name = self.vm_root + SUFFIX[mode] |
666 if utils.IsWindows() and not name.endswith('.exe'): | 669 if utils.IsWindows() and not name.endswith('.exe'): |
667 name = name + '.exe' | 670 name = name + '.exe' |
668 return name | 671 return name |
669 | 672 |
670 def GetVmCommand(self, testcase, mode): | 673 def GetVmCommand(self, testcase, mode): |
671 return [self.GetVm(mode)] + self.GetVmFlags(testcase, mode) | 674 return [self.GetVm(mode)] + self.GetVmFlags(testcase, mode) |
672 | 675 |
673 def GetVmFlags(self, testcase, mode): | 676 def GetVmFlags(self, testcase, mode): |
674 return testcase.variant_flags + FLAGS[mode] | 677 flags = testcase.GetCustomFlags(mode) |
| 678 if flags is None: |
| 679 flags = FLAGS[mode] |
| 680 return testcase.variant_flags + flags |
675 | 681 |
676 def GetTimeout(self, testcase, mode): | 682 def GetTimeout(self, testcase, mode): |
677 result = self.timeout * TIMEOUT_SCALEFACTOR[mode] | 683 result = self.timeout * TIMEOUT_SCALEFACTOR[mode] |
678 if '--stress-opt' in self.GetVmFlags(testcase, mode): | 684 if '--stress-opt' in self.GetVmFlags(testcase, mode): |
679 return result * 2 | 685 return result * 2 |
680 else: | 686 else: |
681 return result | 687 return result |
682 | 688 |
683 def RunTestCases(cases_to_run, progress, tasks): | 689 def RunTestCases(cases_to_run, progress, tasks): |
684 progress = PROGRESS_INDICATORS[progress](cases_to_run) | 690 progress = PROGRESS_INDICATORS[progress](cases_to_run) |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 else: | 1294 else: |
1289 pos = value.find('@') | 1295 pos = value.find('@') |
1290 import urllib | 1296 import urllib |
1291 prefix = urllib.unquote(value[:pos]).split() | 1297 prefix = urllib.unquote(value[:pos]).split() |
1292 suffix = urllib.unquote(value[pos+1:]).split() | 1298 suffix = urllib.unquote(value[pos+1:]).split() |
1293 def ExpandCommand(args): | 1299 def ExpandCommand(args): |
1294 return prefix + args + suffix | 1300 return prefix + args + suffix |
1295 return ExpandCommand | 1301 return ExpandCommand |
1296 | 1302 |
1297 | 1303 |
1298 BUILT_IN_TESTS = ['mjsunit', 'cctest', 'message'] | 1304 BUILT_IN_TESTS = ['benchmarks', 'mjsunit', 'cctest', 'message'] |
1299 | 1305 |
1300 | 1306 |
1301 def GetSuites(test_root): | 1307 def GetSuites(test_root): |
1302 def IsSuite(path): | 1308 def IsSuite(path): |
1303 return isdir(path) and exists(join(path, 'testcfg.py')) | 1309 return isdir(path) and exists(join(path, 'testcfg.py')) |
1304 return [ f for f in os.listdir(test_root) if IsSuite(join(test_root, f)) ] | 1310 return [ f for f in os.listdir(test_root) if IsSuite(join(test_root, f)) ] |
1305 | 1311 |
1306 | 1312 |
1307 def FormatTime(d): | 1313 def FormatTime(d): |
1308 millis = round(d * 1000) % 1000 | 1314 millis = round(d * 1000) % 1000 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 for entry in timed_tests[:20]: | 1464 for entry in timed_tests[:20]: |
1459 t = FormatTime(entry.duration) | 1465 t = FormatTime(entry.duration) |
1460 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) | 1466 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) |
1461 index += 1 | 1467 index += 1 |
1462 | 1468 |
1463 return result | 1469 return result |
1464 | 1470 |
1465 | 1471 |
1466 if __name__ == '__main__': | 1472 if __name__ == '__main__': |
1467 sys.exit(Main()) | 1473 sys.exit(Main()) |
OLD | NEW |