Patchwork [3,of,4] test-worker: capture tracebacks more reliably

login
register
mail settings
Submitter Jun Wu
Date May 3, 2017, 12:09 a.m.
Message ID <32b59b65cc97898ceee0.1493770177@x1c>
Download mbox | patch
Permalink /patch/20372/
State Accepted
Headers show

Comments

Jun Wu - May 3, 2017, 12:09 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1492905650 25200
#      Sat Apr 22 17:00:50 2017 -0700
# Node ID 32b59b65cc97898ceee090e695904e2c1e431d41
# Parent  44a3524b51508ebc0175f7e89196341f6cf61d64
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 32b59b65cc97
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.

Patch

diff --git a/tests/test-worker.t b/tests/test-worker.t
--- a/tests/test-worker.t
+++ b/tests/test-worker.t
@@ -82,13 +82,13 @@  Known exception should be caught, but pr
 
   $ 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