OLD | NEW |
1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
4 # | 4 # |
5 """Classes and methods for executing tasks for the test.py framework. | 5 """Classes and methods for executing tasks for the test.py framework. |
6 | 6 |
7 This module includes: | 7 This module includes: |
8 - Managing parallel execution of tests using threads | 8 - Managing parallel execution of tests using threads |
9 - Windows and Unix specific code for spawning tasks and retrieving results | 9 - Windows and Unix specific code for spawning tasks and retrieving results |
10 - Evaluating the output of each test as pass/fail/crash/timeout | 10 - Evaluating the output of each test as pass/fail/crash/timeout |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 self.test = test | 55 self.test = test |
56 self.command = command | 56 self.command = command |
57 self.output = output | 57 self.output = output |
58 | 58 |
59 def UnexpectedOutput(self): | 59 def UnexpectedOutput(self): |
60 """Compare the result of running the expected from the TestConfiguration. | 60 """Compare the result of running the expected from the TestConfiguration. |
61 | 61 |
62 Returns: | 62 Returns: |
63 True if the test had an unexpected output. | 63 True if the test had an unexpected output. |
64 """ | 64 """ |
| 65 return not self.GetOutcome() in self.test.outcomes |
| 66 |
| 67 def GetOutcome(self): |
| 68 """Returns one of testing.CRASH, testing.TIMEOUT, testing.FAIL, or |
| 69 testing.PASS.""" |
65 if self.HasCrashed(): | 70 if self.HasCrashed(): |
66 outcome = testing.CRASH | 71 return testing.CRASH |
67 elif self.HasTimedOut(): | 72 if self.HasTimedOut(): |
68 outcome = testing.TIMEOUT | 73 return testing.TIMEOUT |
69 elif self.HasFailed(): | 74 if self.HasFailed(): |
70 outcome = testing.FAIL | 75 return testing.FAIL |
71 else: | 76 return testing.PASS |
72 outcome = testing.PASS | |
73 return not outcome in self.test.outcomes | |
74 | 77 |
75 def HasCrashed(self): | 78 def HasCrashed(self): |
76 """Returns True if the test should be considered testing.CRASH.""" | 79 """Returns True if the test should be considered testing.CRASH.""" |
77 if utils.IsWindows(): | 80 if utils.IsWindows(): |
78 if self.output.exit_code == 3: | 81 if self.output.exit_code == 3: |
79 # The VM uses std::abort to terminate on asserts. | 82 # The VM uses std::abort to terminate on asserts. |
80 # std::abort terminates with exit code 3 on Windows. | 83 # std::abort terminates with exit code 3 on Windows. |
81 return True | 84 return True |
82 return (0x80000000 & self.output.exit_code | 85 return (0x80000000 & self.output.exit_code |
83 and not 0x3FFFFF00 & self.output.exit_code) | 86 and not 0x3FFFFF00 & self.output.exit_code) |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 def Shutdown(self): | 421 def Shutdown(self): |
419 """Kill all active runners.""" | 422 """Kill all active runners.""" |
420 print 'Shutting down remaining runners.' | 423 print 'Shutting down remaining runners.' |
421 self.terminate = True | 424 self.terminate = True |
422 for runner in self.runners.values(): | 425 for runner in self.runners.values(): |
423 runner.kill() | 426 runner.kill() |
424 # Give threads a chance to exit gracefully | 427 # Give threads a chance to exit gracefully |
425 time.sleep(2) | 428 time.sleep(2) |
426 for runner in self.runners.values(): | 429 for runner in self.runners.values(): |
427 self.EndRunner(runner) | 430 self.EndRunner(runner) |
OLD | NEW |