server/tests.at (server retry): Use the new `WITH_STRACE' macro.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 19 Feb 2016 21:49:33 +0000 (21:49 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 30 Apr 2016 17:10:14 +0000 (18:10 +0100)
Now we don't necessarily need strace(1) installed at build time.

It's now the responsibility of `WITH_STRACE' to clear away the strace(1)
process if there is one.  There's now too much process hierarchy in
between the wait and the child for us to wait on the proxy process
itself.  It doesn't really matter much, fortunately.

server/tests.at

index 8e155b6..303c346 100644 (file)
@@ -472,12 +472,16 @@ WITH_2TRIPES([alice], [bob], [-nslip], [-talice], [-tbob], [
 
   ## Set up the evil proxy.
   alicemitm=24516 bobmitm=14016
-  MITM -kalice/keyring.pub >mitm.out 2>mitm.err \
-    peer:alice:$alicemitm:127.0.0.1:$(cat alice/port) \
-    peer:bob:$bobmitm:127.0.0.1:$(cat bob/port) \
-    filt:drop:5 filt:send& mitmpid=$!
-  strace -omitm.trace -p$mitmpid& mitmtrace=$!
-  trap 'kill $mitmpid $mitmtrace; exit 127' EXIT INT QUIT TERM HUP
+  mknod pipe-mitmpid p
+  WITH_STRACE([mitm],
+             [sh -c 'echo $$ >pipe-mitmpid; exec "$@"' - \
+              MITM -kalice/keyring.pub >mitm.out 2>mitm.err \
+                peer:alice:$alicemitm:127.0.0.1:$(cat alice/port) \
+                peer:bob:$bobmitm:127.0.0.1:$(cat bob/port) \
+                filt:drop:5 filt:send])&
+  read mitmpid <pipe-mitmpid
+  trap 'kill $mitmpid; exit 127' EXIT INT QUIT TERM HUP
+  exec 3>&-
 
   ## Try to establish keys anyway.
   AWAIT_KXDONE([alice], [alice], [bob], [bob], [
@@ -491,8 +495,6 @@ WITH_2TRIPES([alice], [bob], [-nslip], [-talice], [-tbob], [
 
   ## Tear down the MITM proxy.
   kill $mitmpid
-  wait $mitmpid
-  wait $mitmtrace
 ])
 
 AT_CLEANUP