texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6309] make info test suite timing out work again


From: Gavin D. Smith
Subject: [6309] make info test suite timing out work again
Date: Thu, 04 Jun 2015 11:47:46 +0000

Revision: 6309
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6309
Author:   gavin
Date:     2015-06-04 11:47:45 +0000 (Thu, 04 Jun 2015)
Log Message:
-----------
make info test suite timing out work again

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/pseudotty.c
    trunk/info/t/Init-inter.inc
    trunk/info/t/README
    trunk/info/t/Timeout-test.inc

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-06-04 00:08:06 UTC (rev 6308)
+++ trunk/ChangeLog     2015-06-04 11:47:45 UTC (rev 6309)
@@ -1,5 +1,16 @@
 2015-06-04  Gavin Smith  <address@hidden>
 
+       * info/pseudotty.c: Check for failure from "write" call.  Don't 
+       exit for an error communicating with controlled process; do exit 
+       for error on control channel.
+       * info/t/Init-inter.inc: Open FIFO for commmunicating that ginfo 
+       has finished on both ends, to allow timeout to work.  Start 
+       pseudotty with "exec" in case there is an intermediate shell, to 
+       get its PID correctly.
+       * info/t/README: Update.
+
+2015-06-04  Gavin Smith  <address@hidden>
+
        * info/t/Infokey-config: Set key-time=0 to try to increase 
        predictability of interactive tests.
 

Modified: trunk/info/pseudotty.c
===================================================================
--- trunk/info/pseudotty.c      2015-06-04 00:08:06 UTC (rev 6308)
+++ trunk/info/pseudotty.c      2015-06-04 11:47:45 UTC (rev 6309)
@@ -90,10 +90,7 @@
               if (success < 0)
                 {
                   if (errno != EINTR)
-                    {
-                      error (0, errno, "read error on control channel");
-                      sleep (1);
-                    }
+                    error (1, errno, "read error on control channel");
                 }
               else if (success == 0)
                 {
@@ -107,7 +104,24 @@
             }
 
           /* Feed any read bytes to the program being controlled. */
-          write (master, &c, 1);
+          do
+            {
+              success = write (master, &c, 1);
+              if (success == 0)
+                {
+                  error (0, 0, "couldn't send byte!");
+                  sleep (1);
+                  continue;
+                }
+            }
+          while (success == -1 && errno == EINTR);
+
+          if (success != 1)
+            {
+              /* The controlled process has probably exited, or been killed. */
+              error (0, 0, "couldn't send byte (giving up)");
+              sleep (1);
+            }
         }
 
       if (FD_ISSET (master, &read_set))
@@ -119,11 +133,13 @@
             {
               success = read (master, &c, 1);
             }
-          while (success != 1 && errno == EINTR);
-          if (!success)
+          while (success == -1 && errno == EINTR);
+
+          if (success == -1)
             {
+              /* The controlled process has probably exited, or been killed. */
               error (0, 0, "read error on master fd");
-              exit (1);
+              sleep (1);
             }
         }
     }

Modified: trunk/info/t/Init-inter.inc
===================================================================
--- trunk/info/t/Init-inter.inc 2015-06-04 00:08:06 UTC (rev 6308)
+++ trunk/info/t/Init-inter.inc 2015-06-04 11:47:45 UTC (rev 6309)
@@ -81,7 +81,7 @@
 # if they were typed by a user in an interactive session.
 # We redirect to the FIFO within a subshell, because under NetBSD 6.1.4
 # it hangs otherwise.
-(./pseudotty "$PTY_TYPE" >$PIPEIN) &
+(exec ./pseudotty "$PTY_TYPE" >$PIPEIN) &
 PTY_PID=$!
 # Get name of pseudo-terminal slave device
 read PTS_DEVICE <$PIPEIN
@@ -104,11 +104,19 @@
     # for an EOF.  This prevents lingering processes if a test is 
     # interrupted.
     exec 7>&- ;
+    exec 8>$FINISHEDFIFO ;
     $GINFO $GINFO_OPTIONS "$@" ;
     test $? -eq 0 || echo failure >$FINISHEDFIFO ;
     echo finished >$FINISHEDFIFO ; } 0<>$PTS_DEVICE 1<&0 &
   SUBSHELL=$!
+  exec 8<$FINISHEDFIFO
 
+  # Although we don't write to the FIFO in this process, we still need
+  # to open it for writing, because if the above subshell exits before
+  # we read from it, we won't be able to open it - even though 
+  # "finished" is buffered.
+  exec 9>$FINISHEDFIFO
+
   # Check for pgrep
   if findprog pgrep; then
     # Get the PID of the running ginfo process.  Look for a process called

Modified: trunk/info/t/README
===================================================================
--- trunk/info/t/README 2015-06-04 00:08:06 UTC (rev 6308)
+++ trunk/info/t/README 2015-06-04 11:47:45 UTC (rev 6309)
@@ -40,9 +40,22 @@
 This allows the program to happily enter interactive operation (its standard
 file descriptors pass the isatty library function) and avoids affecting
 the output of the terminal the test was invoked from.  pseudotty reads and
-discards all input on its stdin, and passes through any bytes read on file
-descriptor 3 into the pseudo-terminal.
+discards all input on its stdin, and passes through any bytes read on 
+its control channel into the pseudo-terminal.  It prints the name of the 
+pseudoterminal slave device on standard output.
 
+(test script)
+ ^  |
+ |  `-control----> pseudotty (master) <---> (slave) stdin/stdout ginfo
+ `-name of slave-----'
+
+pseudotty will stop running either when killed, or when it exits after 
+its control channel is closed.
+
+Since ginfo is reading to and writing from the pseudoterminal slave 
+device, if pseudotty exits before ginfo does, ginfo will exit with an 
+I/O error.
+
 Many of the tests of interactive operation try to position the cursor 
 on a cross-reference by various means, follow the reference, and dump the node
 reached to a file.  (It can be compared with a target file in

Modified: trunk/info/t/Timeout-test.inc
===================================================================
--- trunk/info/t/Timeout-test.inc       2015-06-04 00:08:06 UTC (rev 6308)
+++ trunk/info/t/Timeout-test.inc       2015-06-04 11:47:45 UTC (rev 6309)
@@ -22,6 +22,7 @@
 # should exit the subshell with an error exit status.
 (read -t 0; exit 0)
 if test $? != 0; then
+  # skip test below
   status=2
 else
   read -t 3 FINISHED <$FINISHEDFIFO




reply via email to

[Prev in Thread] Current Thread [Next in Thread]