diff --git a/tests/dummysmtpd.py b/tests/dummysmtpd.py --- a/tests/dummysmtpd.py +++ b/tests/dummysmtpd.py @@ -93,6 +93,7 @@ def main(): op.add_option('--pid-file', metavar='FILE') op.add_option('--tls', choices=['none', 'smtps'], default='none') op.add_option('--certificate', metavar='FILE') + op.add_option('--logfile', metavar='FILE') opts, args = op.parse_args() if opts.tls == 'smtps' and not opts.certificate: @@ -113,6 +114,7 @@ def main(): runfn=run, runargs=[pycompat.sysexecutable, pycompat.fsencode(__file__)] + pycompat.sysargv[1:], + logfile=opts.logfile, ) diff --git a/tests/test-patchbomb-tls.t b/tests/test-patchbomb-tls.t --- a/tests/test-patchbomb-tls.t +++ b/tests/test-patchbomb-tls.t @@ -5,7 +5,7 @@ Set up SMTP server: $ CERTSDIR="$TESTDIR/sslcerts" $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub.pem" >> server.pem - $ "$PYTHON" "$TESTDIR/dummysmtpd.py" -p $HGPORT --pid-file a.pid -d \ + $ "$PYTHON" "$TESTDIR/dummysmtpd.py" -p $HGPORT --pid-file a.pid --logfile log -d \ > --tls smtps --certificate `pwd`/server.pem listening at localhost:$HGPORT (?) $ cat a.pid >> $DAEMON_PIDS @@ -75,6 +75,10 @@ Without certificates: (see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error or set hostsecurity.localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e to trust this server) [150] + $ cat ../log + * ssl error (glob) + $ : > ../log + With global certificates: $ try --debug --config web.cacerts="$CERTSDIR/pub.pem" @@ -86,6 +90,10 @@ With global certificates: (verifying remote certificate) sending [PATCH] a ... + $ cat ../log + * from=quux to=foo, bar (glob) + $ : > ../log + With invalid certificates: $ try --config web.cacerts="$CERTSDIR/pub-other.pem" @@ -96,4 +104,8 @@ With invalid certificates: (?i)abort: .*?certificate.verify.failed.* (re) [255] + $ cat ../log + * ssl error (glob) + $ : > ../log + $ cd ..