[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6173] info tests alternative to opening fifo rw
From: |
Gavin D. Smith |
Subject: |
[6173] info tests alternative to opening fifo rw |
Date: |
Tue, 03 Mar 2015 15:39:50 +0000 |
Revision: 6173
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6173
Author: gavin
Date: 2015-03-03 15:39:48 +0000 (Tue, 03 Mar 2015)
Log Message:
-----------
info tests alternative to opening fifo rw
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/pseudotty.c
trunk/info/t/Init-inter.inc
trunk/info/t/Init-test.inc
trunk/info/t/index-apropos.sh
trunk/info/t/last-no-history.sh
trunk/info/t/next-quoted.sh
trunk/info/t/quoted-label-and-target.sh
trunk/info/t/quoted-label-as-target.sh
trunk/info/t/quoted-target.sh
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-03-03 11:26:34 UTC (rev 6172)
+++ trunk/ChangeLog 2015-03-03 15:39:48 UTC (rev 6173)
@@ -1,12 +1,29 @@
2015-03-03 Gavin Smith <address@hidden>
+ * info/t/Init-inter.inc: Create a background process to hold a
+ FIFO open for writing, instead of opening it read-write for
+ pseudotty.
+ Eliminate extra invocation of mknod. Remove extra shell
+ variable with same value as another.
+ * info/t/Init-test.inc (cleanup): Kill this background subshell.
+
+ * info/pseudotty.c: Exit for end-of-file on either of the file
+ descriptors being used.
+
+ * info/t/index-apropos.sh, info/t/last-no-history.sh,
+ info/t/next-quoted.sh, info/t/quoted-label-and-target.sh,
+ info/t/quoted-label-as-target.sh, info/t/quoted-target.sh: Run
+ ginfo with "run_ginfo" and source t/Timeout-test.inc.
+
+2015-03-03 Gavin Smith <address@hidden>
+
* doc/texinfo.texi (Invoking texi2any): Change a cross-reference
to explain customization variables.
2015-03-01 Gavin Smith <address@hidden>
* info/nodemenu.c (nodemenu_format_info): Add note for
- tranlators.
+ translators.
* doc/texinfo.texi (Writing a Node): Fix minor typo.
2015-02-27 Gavin Smith <address@hidden>
Modified: trunk/info/pseudotty.c
===================================================================
--- trunk/info/pseudotty.c 2015-03-03 11:26:34 UTC (rev 6172)
+++ trunk/info/pseudotty.c 2015-03-03 15:39:48 UTC (rev 6173)
@@ -2,7 +2,7 @@
standard output. Read and ignore any data sent to terminal. This
is so we can run tests interactively without messing up the screen.
- Copyright 2014 Free Software Foundation, Inc.
+ Copyright 2014, 2015 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
@@ -66,26 +66,37 @@
FD_SET (CONTROL, &read_set);
select (FD_SETSIZE, &read_set, 0, 0, 0);
+
if (FD_ISSET (CONTROL, &read_set))
{
int c, success;
errno = 0;
do
{
+ error (0, 0, "trying to read");
success = read (CONTROL, &c, 1);
+ if (success < 0)
+ {
+ if (errno != EINTR)
+ {
+ error (0, errno, "read error on control channel");
+ sleep (1);
+ }
+ }
+ else if (success == 0)
+ {
+ error (0, 0, "end of file on control channel");
+ exit (1);
+ }
+ else if (success == 1)
+ break;
}
- while (success != 1 && errno == EINTR);
- if (!success)
- {
- error (0, 0, "read error on control channel");
- sleep (1);
- }
- else
- {
- /* Feed any read bytes to the program being controlled. */
- write (master, &c, 1);
- }
+ while (1);
+
+ /* Feed any read bytes to the program being controlled. */
+ write (master, &c, 1);
}
+
if (FD_ISSET (master, &read_set))
{
int c, success;
@@ -98,7 +109,7 @@
if (!success)
{
error (0, 0, "read error on master fd");
- sleep (1); /* Don't flood stderr with error messages. */
+ exit (1);
}
}
}
Modified: trunk/info/t/Init-inter.inc
===================================================================
--- trunk/info/t/Init-inter.inc 2015-03-03 11:26:34 UTC (rev 6172)
+++ trunk/info/t/Init-inter.inc 2015-03-03 15:39:48 UTC (rev 6173)
@@ -62,14 +62,12 @@
FINISHEDFIFO=t/`basename $0.finished`
# Create named pipes to communicate with pseudotty program, or quit.
-rm -f $PIPEIN $PIPEOUT # must already be defined
+rm -f $PIPEIN $PTY_TYPE # must already be defined
if findprog mknod; then # check for mknod to give a better error msg
mknod $PIPEIN p
- mknod $PIPEIN p
- mknod $PIPEOUT p
- PTY_TYPE=$PIPEOUT
+ mknod $PTY_TYPE p
#
- if test ! -r $PIPEIN || test ! -r $PIPEOUT; then
+ if test ! -r $PIPEIN || test ! -r $PTY_TYPE; then
echo "$0: could not mknod pipes" >&2
exit 77
fi
@@ -79,13 +77,31 @@
exit 77
fi
-# fixme: must check for <> support.
+# When pseudotty opens $PTY_TYPE for reading, this will freeze until the FIFO
+# is also opened for writing. The "select" call in pseudotty could also
+# return end-of-file if it is opened and then closed. We could avoid this
+# by opening it read-write (with "3<>$PTY_TYPE"). However, this might not
+# be portable to some systems, and POSIX doesn't guarantee that a FIFO can
+# be opened read-write. Thus, we keep the pipe open for writing using a
+# background process instead.
-# We can feed input bytes into $PTY_TYPE to be passed onto ginfo. pseudotty
-# only reads from fd 3, but opening the pipe read-write means: (i) there will
-# always be a process with it open for writing, so pseudotty will not hang when
-# opening it; and (ii) select() will never return for an end-of-file on fd 3.
-./pseudotty >$PIPEIN 3<>$PTY_TYPE &
+# Wedge open pipe
+sleep 10 3>$PTY_TYPE &
+WEDGE_PTY_PID=$!
+
+# If we wanted the process to be open indefinitely, we could use an
+# infinite loop in a subshell, like:
+#
+#( exec 3>$PTY_TYPE ; while true; do sleep 100000; done) &
+#
+# Howewever, then we would have the problem of how to kill the "sleep"
+# process in that subshell. Another idea is
+#
+# test -r t/wedge_cat.fifo || mkfifo t/wedge_cat.fifo
+# cat 3>$PTY_TYPE <wedge_cat.fifo &
+
+# We can feed input bytes into $PTY_TYPE to be passed onto ginfo
+./pseudotty >$PIPEIN 3<$PTY_TYPE &
PTY_PID=$!
# Get name of pseudo-terminal slave device
Modified: trunk/info/t/Init-test.inc
===================================================================
--- trunk/info/t/Init-test.inc 2015-03-03 11:26:34 UTC (rev 6172)
+++ trunk/info/t/Init-test.inc 2015-03-03 15:39:48 UTC (rev 6173)
@@ -37,7 +37,7 @@
# These are only used for interactive tests
PIPEIN=t/`basename $0.pipein`
-PIPEOUT=t/`basename $0.pipeout`
+PTY_TYPE=t/`basename $0.pipeout`
# Remove left over file from previous tests
rm -f $GINFO_OUTPUT
@@ -47,6 +47,7 @@
# Not an interactive test
PTY_PID=0
+WEDGE_PTY_PID=0
# Get error messages in English
LC_ALL=C; export LC_ALL
@@ -58,12 +59,22 @@
cleanup ()
{
# Delete created files and kill spawned processes if any.
- rm -f $GINFO_OUTPUT
- rm -f $PIPEIN $PIPEOUT
test $PTY_PID -ne 0 && kill $PTY_PID
+ test $WEDGE_PTY_PID -ne 0 && kill $WEDGE_PTY_PID
+
+ rm -f $GINFO_OUTPUT
+ rm -f $PIPEIN $PTY_TYPE
+
if test -n "$TIMED_OUT"; then
return 1
fi
+ #killall `basename $0`
exit $RETVAL
}
+
+# Uncomment this line and "killall" above if previous test runs were not
+# cleaned up properly, and rerun "make check".
+
+#cleanup
+
Modified: trunk/info/t/index-apropos.sh
===================================================================
--- trunk/info/t/index-apropos.sh 2015-03-03 11:26:34 UTC (rev 6172)
+++ trunk/info/t/index-apropos.sh 2015-03-03 15:39:48 UTC (rev 6173)
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2014 Free Software Foundation, Inc.
+# Copyright (C) 2014, 2015 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
@@ -18,12 +18,13 @@
. $srcdir/t/Init-test.inc
. $t/Init-inter.inc
+run_ginfo
+
# Type "M-x index-apropos", look for "link" in indices, select first
# result. Then type "i" followed by <TAB> to check the indices in the
# file are still there.
printf '\033xindex-apropos\rlink\r\t\ri\t\x07q' >$PTY_TYPE &
-$GINFO
-RETVAL=$?
+. $t/Timeout-test.inc
cleanup
Modified: trunk/info/t/last-no-history.sh
===================================================================
--- trunk/info/t/last-no-history.sh 2015-03-03 11:26:34 UTC (rev 6172)
+++ trunk/info/t/last-no-history.sh 2015-03-03 15:39:48 UTC (rev 6173)
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2014 Free Software Foundation, Inc.
+# Copyright (C) 2014, 2015 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
@@ -18,10 +18,11 @@
. $srcdir/t/Init-test.inc
. $t/Init-inter.inc
+run_ginfo -f intera
+
# Try to go back in history when there is no earlier node
-printf lq >$PTY_TYPE &
-$GINFO -f intera
-RETVAL=$?
+printf lq >$PTY_TYPE
+. $t/Timeout-test.inc
cleanup
Modified: trunk/info/t/next-quoted.sh
===================================================================
--- trunk/info/t/next-quoted.sh 2015-03-03 11:26:34 UTC (rev 6172)
+++ trunk/info/t/next-quoted.sh 2015-03-03 15:39:48 UTC (rev 6173)
@@ -18,9 +18,10 @@
. $srcdir/t/Init-test.inc
. $t/Init-inter.inc
+run_ginfo -f quoting
# Go to a node with colons and commas in its name with "n"
-printf 'n\t\rDq' >$PTY_TYPE &
-$GINFO -f quoting
+printf 'n\t\rDq' >$PTY_TYPE
+. $t/Timeout-test.inc
if test ! -f $GINFO_OUTPUT; then
RETVAL=1
Modified: trunk/info/t/quoted-label-and-target.sh
===================================================================
--- trunk/info/t/quoted-label-and-target.sh 2015-03-03 11:26:34 UTC (rev
6172)
+++ trunk/info/t/quoted-label-and-target.sh 2015-03-03 15:39:48 UTC (rev
6173)
@@ -18,9 +18,11 @@
. $srcdir/t/Init-test.inc
. $t/Init-inter.inc
+run_ginfo -f quoting
+
# Follow a cross-reference with both the label and destination quoted.
printf '\t\t\t\r\t\rDq' >$PTY_TYPE &
-$GINFO -f quoting
+. $t/Timeout-test.inc
if test ! -f $GINFO_OUTPUT; then
RETVAL=1
Modified: trunk/info/t/quoted-label-as-target.sh
===================================================================
--- trunk/info/t/quoted-label-as-target.sh 2015-03-03 11:26:34 UTC (rev
6172)
+++ trunk/info/t/quoted-label-as-target.sh 2015-03-03 15:39:48 UTC (rev
6173)
@@ -18,9 +18,10 @@
. $srcdir/t/Init-test.inc
. $t/Init-inter.inc
+run_ginfo -f quoting
# Follow a cross-reference to a node with colons and commas in its name
-printf '\t\r\t\rDq' >$PTY_TYPE &
-$GINFO -f quoting
+printf '\t\r\t\rDq' >$PTY_TYPE
+. $t/Timeout-test.inc
if test ! -f $GINFO_OUTPUT; then
RETVAL=1
Modified: trunk/info/t/quoted-target.sh
===================================================================
--- trunk/info/t/quoted-target.sh 2015-03-03 11:26:34 UTC (rev 6172)
+++ trunk/info/t/quoted-target.sh 2015-03-03 15:39:48 UTC (rev 6173)
@@ -18,9 +18,10 @@
. $srcdir/t/Init-test.inc
. $t/Init-inter.inc
+run_ginfo -f quoting
# Follow a cross-reference to a node with colons and commas in its name
-printf '\t\t\r\t\r\Dq' >$PTY_TYPE &
-$GINFO -f quoting --restore $t/quoted-target.drib
+printf '\t\t\r\t\r\Dq' >$PTY_TYPE
+. $t/Timeout-test.inc
if test ! -f $GINFO_OUTPUT; then
RETVAL=1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6173] info tests alternative to opening fifo rw,
Gavin D. Smith <=