Andreas Raab uploaded a new version of SUnit to project The Trunk:
http://source.squeak.org/trunk/SUnit-ar.78.mcz==================== Summary ====================
Name: SUnit-ar.78
Author: ar
Time: 12 May 2010, 7:35:17.433 pm
UUID: d900ec00-791b-d041-bc1e-3de58020fc4a
Ancestors: SUnit-ar.77
Just like with test failures, errors in tests need to suppress an eventual test timeout.
=============== Diff against SUnit-ar.77 ===============
Item was changed:
----- Method: TestCase>>timeout:after: (in category 'running') -----
timeout: aBlock after: seconds
"Evaluate the argument block. Time out if the evaluation is not
complete after the given number of seconds. Handle the situation
that a timeout may occur after a failure (during debug)"
| theProcess delay watchdog |
"the block will be executed in the current process"
theProcess := Processor activeProcess.
delay := Delay forSeconds: seconds.
"make a watchdog process"
watchdog := [
delay wait. "wait for timeout or completion"
theProcess ifNotNil:[ theProcess signalException:
(TestFailure new messageText: 'Test timed out') ]
] newProcess.
"Watchdog needs to run at high priority to do its job (but not at timing priority)"
watchdog priority: Processor timingPriority-1.
"catch the timeout signal"
watchdog resume. "start up the watchdog"
+ ^[aBlock on: TestFailure, Error do:[:ex|
- ^[aBlock on: TestFailure do:[:ex|
theProcess := nil.
ex pass.
]] ensure:[ "evaluate the receiver"
theProcess := nil. "it has completed, so ..."
delay delaySemaphore signal. "arrange for the watchdog to exit"
]!