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

Jun Wu quark at fb.com
Tue May 2 20:09:37 EDT 2017


# HG changeset patch
# User Jun Wu <quark at 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.

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


More information about the Mercurial-devel mailing list