[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6304] info test suite changes for netbsd
From: |
Gavin D. Smith |
Subject: |
[6304] info test suite changes for netbsd |
Date: |
Wed, 03 Jun 2015 22:07:46 +0000 |
Revision: 6304
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6304
Author: gavin
Date: 2015-06-03 22:07:44 +0000 (Wed, 03 Jun 2015)
Log Message:
-----------
info test suite changes for netbsd
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/pseudotty.c
trunk/info/t/Init-inter.inc
trunk/info/t/Init-test.inc
trunk/info/t/Timeout-test.inc
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-06-03 18:57:30 UTC (rev 6303)
+++ trunk/ChangeLog 2015-06-03 22:07:44 UTC (rev 6304)
@@ -1,5 +1,20 @@
2015-06-03 Gavin Smith <address@hidden>
+ * info/pseudotty.c: Don't get control channel from an already
+ redirected file descriptor, get it from the filename of a FIFO
+ passed on the command line. #define _XOPEN_SOURCE as 500 to
+ expose prototype of "ptsname" under NetBSD 6.1.4.
+ * info/t/Init-inter.inc: Create control channel FIFO and pass
+ name of it to pseudotty. Don't use background processes to keep
+ the control FIFO open. Redirect FIFO for communicating name of
+ pty slave device within a subshell. Keep control FIFO open
+ using file descriptor redirection in main shell process.
+ * info/t/Init-test.inc: Remove unneeded cleanup code.
+ * info/t/Timeout-test.inc: Don't try to open FIFO for indicating
+ that ginfo has finished read-write.
+
+2015-06-03 Gavin Smith <address@hidden>
+
* README-hacking: mention OpenCSW build reports
2015-06-03 Karl Berry <address@hidden>
Modified: trunk/info/pseudotty.c
===================================================================
--- trunk/info/pseudotty.c 2015-06-03 18:57:30 UTC (rev 6303)
+++ trunk/info/pseudotty.c 2015-06-03 22:07:44 UTC (rev 6304)
@@ -19,7 +19,7 @@
Originally written by Gavin Smith. */
-#define _XOPEN_SOURCE
+#define _XOPEN_SOURCE 500
#include <config.h>
#include <errno.h>
@@ -33,15 +33,13 @@
#include <stdlib.h>
#include <string.h>
-#define CONTROL 3
-
/* Used by "error" function. */
const char *program_name = "pseudotty";
int
-main (void)
+main (int argc, char *argv[])
{
- int master;
+ int master, control;
char *name;
fd_set read_set;
@@ -62,21 +60,25 @@
printf ("%s\n", name);
if (fclose (stdout) != 0)
- {
- error (1, 0, "error closing stdout: aborting");
- }
+ error (1, 0, "error closing stdout: aborting");
+ error (0, 0, "opening control channel");
+ control = open (argv[1], O_RDONLY);
+ if (control == -1)
+ error (1, 0, "error opening control channel: aborting");
+
+
FD_ZERO (&read_set);
error (0, 0, "entering main loop");
while (1)
{
FD_SET (master, &read_set);
- FD_SET (CONTROL, &read_set);
+ FD_SET (control, &read_set);
select (FD_SETSIZE, &read_set, 0, 0, 0);
- if (FD_ISSET (CONTROL, &read_set))
+ if (FD_ISSET (control, &read_set))
{
char c;
int success;
@@ -84,7 +86,7 @@
while (1)
{
error (0, 0, "trying to read");
- success = read (CONTROL, &c, 1);
+ success = read (control, &c, 1);
if (success < 0)
{
if (errno != EINTR)
Modified: trunk/info/t/Init-inter.inc
===================================================================
--- trunk/info/t/Init-inter.inc 2015-06-03 18:57:30 UTC (rev 6303)
+++ trunk/info/t/Init-inter.inc 2015-06-03 22:07:44 UTC (rev 6304)
@@ -77,41 +77,19 @@
exit 77
fi
-# 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.
-
-# Wedge open pipe
-sleep 10 3>$PTY_TYPE &
-WEDGE_PTY_PID=$!
-
-# Also keep the pipe open for reading in case pseudotty exits, so that
-# trying to open the pipe for writing doesn't hang.
-sleep 10 3<$PTY_TYPE &
-WEDGE_PTY_PID2=$!
-
-# 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 &
+# We can feed input bytes into $PTY_TYPE to be passed onto ginfo, as
+# 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) &
PTY_PID=$!
-
# Get name of pseudo-terminal slave device
read PTS_DEVICE <$PIPEIN
+# Keeping the FIFO open for writing prevents the select call in
+# pseudotty returning EOF after a single "printf something >$PTY_TYPE".
+exec 7>$PTY_TYPE
+
# 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
Modified: trunk/info/t/Init-test.inc
===================================================================
--- trunk/info/t/Init-test.inc 2015-06-03 18:57:30 UTC (rev 6303)
+++ trunk/info/t/Init-test.inc 2015-06-03 22:07:44 UTC (rev 6304)
@@ -47,8 +47,6 @@
# Not an interactive test
PTY_PID=0
-WEDGE_PTY_PID=0
-WEDGE_PTY_PID2=0
SUBSHELL=0
# Get error messages in English
@@ -66,8 +64,6 @@
{
# Delete created files and kill spawned processes if any.
test $PTY_PID -ne 0 && kill $PTY_PID
- test $WEDGE_PTY_PID -ne 0 && kill $WEDGE_PTY_PID
- test $WEDGE_PTY_PID2 -ne 0 && kill $WEDGE_PTY_PID2
test $SUBSHELL -ne 0 && kill $SUBSHELL
rm -f $GINFO_OUTPUT
@@ -77,7 +73,7 @@
if test -n "$TIMED_OUT"; then
return 1
fi
- #killall `basename $0`
+ #killall `basename $0` # see below
exit $RETVAL
}
Modified: trunk/info/t/Timeout-test.inc
===================================================================
--- trunk/info/t/Timeout-test.inc 2015-06-03 18:57:30 UTC (rev 6303)
+++ trunk/info/t/Timeout-test.inc 2015-06-03 22:07:44 UTC (rev 6304)
@@ -24,7 +24,7 @@
if test $? != 0; then
status=2
else
- read -t 3 FINISHED <>$FINISHEDFIFO
+ read -t 3 FINISHED <$FINISHEDFIFO
status=$?
fi
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6304] info test suite changes for netbsd,
Gavin D. Smith <=