testing: log mozreview output when a test is skipped (bug 1258957) r?gps draft
authorbyron jones <glob@mozilla.com>
Wed, 23 Mar 2016 14:34:09 +0800
changeset 7541 9e512115ecd030f3b05f769bf85cfe78d9a9027d
parent 7540 0b60c968cf226def9a11f7c4727b037f2d2b364e
push id710
push userbjones@mozilla.com
push dateWed, 23 Mar 2016 06:34:28 +0000
reviewersgps
bugs1258957
testing: log mozreview output when a test is skipped (bug 1258957) r?gps /dev/null is hard to inspect in order to determine why a test is skipped. Log to the test's .err file instead. MozReview-Commit-ID: KY5SeiWwuSP
hgext/reviewboard/tests/helpers.sh
pylib/mercurial-support/run-tests.py
--- a/hgext/reviewboard/tests/helpers.sh
+++ b/hgext/reviewboard/tests/helpers.sh
@@ -47,30 +47,33 @@ alias bugzilla='$TESTDIR/bugzilla'
 alias pulse='$TESTDIR/pulse'
 alias mozreview='$TESTDIR/mozreview'
 alias ottoland='$TESTDIR/ottoland'
 alias treestatus='$TESTDIR/treestatus'
 alias rbmanage='$TESTDIR/reviewboard'
 alias http='$TESTDIR/testing/http-request.py'
 
 commonenv() {
-  mozreview start `pwd` \
+  mr_output=$( \
+    mozreview start `pwd` \
     --mercurial-port $HGPORT \
     --reviewboard-port $HGPORT1 \
     --bugzilla-port $HGPORT2 \
     --pulse-port $HGPORT3 \
     --autoland-port $HGPORT4 \
     --ldap-port $HGPORT5 \
     --ssh-port $HGPORT6 \
     --hgweb-port $HGPORT7 \
     --treestatus-port $HGPORT8 \
-    > /dev/null
+    2>&1
+  )
 
   # MozReview randomly fails to start. Handle it elegantly.
   if [ $? -ne 0 ]; then
+    echo "$mr_output" >$ERR_FILE
     exit 80
   fi
 
   $(mozreview shellinit `pwd`)
 
   export HGSSHHGRCPATH=${MOZREVIEW_HOME}/hgrc
 
   apikey=`mozreview create-user default@example.com password 'Default User' \
--- a/pylib/mercurial-support/run-tests.py
+++ b/pylib/mercurial-support/run-tests.py
@@ -779,16 +779,17 @@ class Test(unittest.TestCase):
         env["HGRCPATH"] = os.path.join(self._threadtmp, b'.hgrc')
         env["DAEMON_PIDS"] = os.path.join(self._threadtmp, b'daemon.pids')
         env["HGEDITOR"] = ('"' + sys.executable + '"'
                            + ' -c "import sys; sys.exit(0)"')
         env["HGMERGE"] = "internal:merge"
         env["HGUSER"]   = "test"
         env["HGENCODING"] = "ascii"
         env["HGENCODINGMODE"] = "strict"
+        env["ERR_FILE"] = self.errpath
 
         # Reset some environment variables to well-known values so that
         # the tests produce repeatable output.
         env['LANG'] = env['LC_ALL'] = env['LANGUAGE'] = 'C'
         env['TZ'] = 'GMT'
         env["EMAIL"] = "Foo Bar <foo.bar@example.com>"
         env['COLUMNS'] = '80'
         env['TERM'] = 'xterm'