test-worker: capture tracebacks more reliably
The traceback test may have traceback caused by SIGTERM. Instead of grepping
"Traceback", explicitly grep the exception we care about.
This makes the test less flaky.
--- a/tests/test-worker.t Sat Apr 22 16:50:08 2017 -0700
+++ b/tests/test-worker.t Sat Apr 22 17:00:50 2017 -0700
@@ -81,15 +81,15 @@
[255]
$ hg --config "extensions.t=$abspath" --config 'worker.numcpus=2' \
- > test 100000.0 abort --traceback 2>&1 | grep '^Traceback'
- Traceback (most recent call last):
- Traceback (most recent call last):
+ > test 100000.0 abort --traceback 2>&1 | egrep '^(SystemExit|Abort)'
+ Abort: known exception
+ SystemExit: 255
Traceback must be printed for unknown exceptions
$ hg --config "extensions.t=$abspath" --config 'worker.numcpus=2' \
- > test 100000.0 exc 2>&1 | grep '^Traceback'
- Traceback (most recent call last):
+ > test 100000.0 exc 2>&1 | grep '^Exception'
+ Exception: unknown exception
Workers should not do cleanups in all cases