texinfo-commits
[Top][All Lists]
Advanced

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

[5712] save PID of ginfo process


From: Gavin D. Smith
Subject: [5712] save PID of ginfo process
Date: Fri, 18 Jul 2014 22:40:59 +0000

Revision: 5712
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5712
Author:   gavin
Date:     2014-07-18 22:40:50 +0000 (Fri, 18 Jul 2014)
Log Message:
-----------
save PID of ginfo process

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/Makefile.am
    trunk/info/t/Infokey-config
    trunk/info/t/Init-inter.inc
    trunk/info/t/Timeout-test.inc

Added Paths:
-----------
    trunk/info/t/resize-in-completions.sh

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-07-15 14:45:36 UTC (rev 5711)
+++ trunk/ChangeLog     2014-07-18 22:40:50 UTC (rev 5712)
@@ -1,3 +1,12 @@
+2014-07-18  Gavin Smith  <address@hidden>
+
+       * info/t/Init-inter.inc (run_ginfo): Try to get process ID of ginfo
+       process.
+       * info/t/Timout-test.inc: Kill ginfo if we have its PID.
+
+       * info/t/resize-in-completions.sh: New test.
+       * info/t/Infokey-config: Set automatic-footnotes=On.
+
 2014-07-15  Gavin Smith  <address@hidden>
 
        * info/nodes.c (info_find_file): Call xstrdup on a string so we can

Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am      2014-07-15 14:45:36 UTC (rev 5711)
+++ trunk/info/Makefile.am      2014-07-18 22:40:50 UTC (rev 5712)
@@ -117,6 +117,7 @@
        t/index-long-nodeline.sh \
        t/menu-sequence.sh \
        t/relative-reference.sh \
+       t/resize-in-completions.sh \
        t/quoted-label-as-target.sh \
        t/quoted-target.sh \
        t/quoted-label-and-target.sh \

Modified: trunk/info/t/Infokey-config
===================================================================
--- trunk/info/t/Infokey-config 2014-07-15 14:45:36 UTC (rev 5711)
+++ trunk/info/t/Infokey-config 2014-07-18 22:40:50 UTC (rev 5712)
@@ -3,3 +3,4 @@
 #echo-area
 #var
 infopath-no-defaults=On
+automatic-footnotes=On

Modified: trunk/info/t/Init-inter.inc
===================================================================
--- trunk/info/t/Init-inter.inc 2014-07-15 14:45:36 UTC (rev 5711)
+++ trunk/info/t/Init-inter.inc 2014-07-18 22:40:50 UTC (rev 5712)
@@ -35,10 +35,6 @@
 # Get name of pseudo-terminal slave device
 read PTS_DEVICE <$0.pipein
 
-# Must redirect fd 0 read-write if we want to duplicate it for reading on fd 1
-echo "Redirecting stdin and stdout to $PTS_DEVICE."
-exec 0<>$PTS_DEVICE 1<&0
-
 # glibc can kill a running process if it detects a condition like a
 # double free.  This specifies that the message it prints when it does
 # this should be sent to stderr so it can be recorded in the test *.log
@@ -51,6 +47,38 @@
   mkfifo $0.finished
   { $GINFO "$@" ; test $? -eq 0 || echo failure >$0.finished ;
     echo finished >$0.finished ; } 0<>$PTS_DEVICE 1<&0 &
+  SUBSHELL=$!
+
+  # Get the PID of the running ginfo process.  Look for a process called
+  # "ginfo" whose parent process is the subshell executed by the previous
+  # command.
+  echo 'Fetching PID of ginfo process under test...' >&2
+  GINFO_PID=
+  while :
+  do
+    GINFO_PID=$( pgrep -P $SUBSHELL ginfo ; \
+       test $? -eq 0 -o $? -eq 1 || exit 99 )
+
+    # This use of pgrep is likely not portable (works on procps).  Check if it
+    # is likely to have worked.
+
+    # Exit status was anything other than 0 or 1
+    test $? -eq 99 && { GINFO_PID=unknown; break; }
+
+    # More than one line in output
+    echo $GINFO_PID | wc -l | grep '^0$\|^1$' >/dev/null \
+      || { GINFO_PID=unknown; break; }
+
+    # Non-numeral characters present
+    echo $GINFO_PID | grep -v '^[0-9]*$' >/dev/null
+    test $? -eq 0 && { GINFO_PID=unknown; break; }
+
+    GINFO_PID=$(echo $GINFO_PID | tr -d '\n')
+
+    test "$GINFO_PID" = "" || break
+    sleep 1 # Give subshell time to spawn ginfo process
+  done
+  echo ...$GINFO_PID >&2
 }
 
 

Modified: trunk/info/t/Timeout-test.inc
===================================================================
--- trunk/info/t/Timeout-test.inc       2014-07-15 14:45:36 UTC (rev 5711)
+++ trunk/info/t/Timeout-test.inc       2014-07-18 22:40:50 UTC (rev 5712)
@@ -24,9 +24,11 @@
   RETVAL=1
 elif ! test "$FINISHED" = finished
 then
+  # Kill ginfo if we have its PID.  Failing this, it will probably exit
+  # with an I/O error when pseudotty is killed in Cleanup.inc.
+  test "$GINFO_PID" != unknown && kill $GINFO_PID
+
   echo 'Program timed out after 3 seconds' >&2
   TIMED_OUT=1
 
-  # We could kill ginfo here if we had its PID.  However, it will probably exit
-  # with an I/O error when pseudotty is killed in Cleanup.inc.
 fi

Added: trunk/info/t/resize-in-completions.sh
===================================================================
--- trunk/info/t/resize-in-completions.sh                               (rev 0)
+++ trunk/info/t/resize-in-completions.sh       2014-07-18 22:40:50 UTC (rev 
5712)
@@ -0,0 +1,39 @@
+#!/bin/sh
+# Copyright (C) 2014 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+srcdir=${srcdir:-.}
+. $srcdir/t/Init-test.inc
+. $t/Init-inter.inc
+
+# Indicate a window resize while showing a completions window
+
+run_ginfo -f file-menu
+if test $GINFO_PID = unknown
+then
+       printf 'q' >$PTY_TYPE
+       RETVAL=77 # automake code for skipped test
+else
+       printf 'g\t' >$PTY_TYPE
+       sleep 1 # Give ginfo time to process above keystrokes
+       kill -s WINCH $GINFO_PID
+       sleep 1 # Give ginfo time to process signal
+       # C-g to exit completions, q to quit
+       printf '\007q' >$PTY_TYPE
+fi
+
+. $t/Timeout-test.inc
+. $t/Cleanup.inc
+


Property changes on: trunk/info/t/resize-in-completions.sh
___________________________________________________________________
Added: svn:executable
   + *




reply via email to

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