tests/test-nointerrupt.t
branchstable
changeset 49446 8c75ae3f0eea
parent 48255 8c34edb1ad10
--- a/tests/test-nointerrupt.t	Tue Jul 19 18:32:40 2022 -0700
+++ b/tests/test-nointerrupt.t	Fri Aug 26 11:36:20 2022 +0100
@@ -27,8 +27,6 @@
   >     with ui.uninterruptible():
   >         testing.write_file(sync_file, b'%d' % os.getpid())
   >         testing.wait_file(done_file)
-  >         # make sure we get rescheduled and the signal get a chance to be handled
-  >         time.sleep(0.1)
   >         ui.warn(b"end of unsafe operation\n")
   >     ui.warn(b"%d second(s) passed\n" % int(time.time() - start))
   > EOF
@@ -42,14 +40,26 @@
   > fi
   > "$RUNTESTDIR/testlib/wait-on-file" 10 "$SYNC_FILE" || exit 2
   > kill -s \$SIG \`cat "$SYNC_FILE"\`
-  > sleep 1
-  > touch "$DONE_FILE"
   > EOF
 
 #if no-windows
   $ chmod +x send-signal.sh
 #endif
 
+  $ cat > wait-signal.sh << 'EOF'
+  > #!/bin/sh
+  > (hg wait-signal 2>&1; echo [$?]) | {
+  >     read line
+  >     touch "$DONE_FILE"
+  >     echo "$line"
+  >     cat
+  > }
+  > EOF
+
+#if no-windows
+  $ chmod +x wait-signal.sh
+#endif
+
 Kludge to emulate timeout(1) which is not generally available.
 
 Set up repository
@@ -60,11 +70,10 @@
   > wait_ext = $TESTTMP/wait_ext.py
   > EOF
 
-
 Test ctrl-c
   $ rm -f $SYNC_FILE $DONE_FILE
   $ sh -c "../send-signal.sh INT" &
-  $ hg wait-signal
+  $ ../wait-signal.sh
   interrupted!
   [255]
 
@@ -75,7 +84,7 @@
 
   $ rm -f $SYNC_FILE $DONE_FILE
   $ sh -c "../send-signal.sh INT" &
-  $ hg wait-signal
+  $ ../wait-signal.sh
   interrupted!
   [255]
 
@@ -86,7 +95,7 @@
 
   $ rm -f $SYNC_FILE $DONE_FILE
   $ sh -c "../send-signal.sh INT" &
-  $ hg wait-signal
+  $ ../wait-signal.sh
   shutting down cleanly
   press ^C again to terminate immediately (dangerous)
   end of unsafe operation