texinfo-commits
[Top][All Lists]
Advanced

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

[5439] wait for file with pty name to be created


From: Gavin D. Smith
Subject: [5439] wait for file with pty name to be created
Date: Sat, 12 Apr 2014 23:20:16 +0000

Revision: 5439
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5439
Author:   gavin
Date:     2014-04-12 23:20:14 +0000 (Sat, 12 Apr 2014)
Log Message:
-----------
wait for file with pty name to be created

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/pseudotty.c
    trunk/info/t/Init-test.inc
    trunk/info/t/index.sh
    trunk/info/t/tab.sh

Added Paths:
-----------
    trunk/info/t/Cleanup.inc
    trunk/info/t/Init-intera.inc

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-04-12 22:15:44 UTC (rev 5438)
+++ trunk/ChangeLog     2014-04-12 23:20:14 UTC (rev 5439)
@@ -1,5 +1,18 @@
 2014-04-12  Gavin Smith  <address@hidden>
 
+       * info/t/Init-intera.inc: New file for interactive tests.  Wait
+       for file containing name of pseudoterminal to be created by
+       subprocess.
+       * info/t/Cleanup.inc: File created: shell code for test cleanup
+       and exit.
+       * info/t/index.sh, info/t/tab.sh: Source new files.
+       * info/t/Init-test.inc: Record that test isn't interactive to allow
+       Cleanup.inc to be used for both kinds of tests.
+       * info/pseudotty.c: Call fclose on stdout instead of fflush to
+       encourage output file to be created quickly.
+
+2014-04-12  Gavin Smith  <address@hidden>
+
        * info/Makefile.am: Rules and variables for test suite.
        * info/pseudotty.c: New program, used by tests.
        * info/t/Init-test.inc: File created for test scripts.

Modified: trunk/info/pseudotty.c
===================================================================
--- trunk/info/pseudotty.c      2014-04-12 22:15:44 UTC (rev 5438)
+++ trunk/info/pseudotty.c      2014-04-12 23:20:14 UTC (rev 5439)
@@ -40,7 +40,7 @@
   if (slave == -1)
     exit (1);
   printf ("%s\n", name);
-  fflush (stdout);
+  fclose (stdout);
 
   while (read (master, &dummy, 1) > 0)
     ;

Added: trunk/info/t/Cleanup.inc
===================================================================
--- trunk/info/t/Cleanup.inc                            (rev 0)
+++ trunk/info/t/Cleanup.inc    2014-04-12 23:20:14 UTC (rev 5439)
@@ -0,0 +1,8 @@
+# Cleanup and exit. 
+
+# Delete created files and kill spawned processes if any.
+rm -f t/ginfo-output
+rm -f pty_file
+test $PTY_PID -ne 0 && kill $PTY_PID
+
+exit $RETVAL

Added: trunk/info/t/Init-intera.inc
===================================================================
--- trunk/info/t/Init-intera.inc                                (rev 0)
+++ trunk/info/t/Init-intera.inc        2014-04-12 23:20:14 UTC (rev 5439)
@@ -0,0 +1,13 @@
+# Initialize test of interactive operation
+
+# Code to redirect output to pseudoterminal
+# We could perhaps use AM_TESTS_FD_REDIRECT in Makefile.am instead,
+# although this would stop us from running test scripts from the command-line.
+
+rm -f pty_file
+./pseudotty >pty_file &
+PTY_PID=$!
+# Wait for pseudotty process to create file
+while test ! -f pty_file; do sleep 1; done
+exec >"$(cat pty_file | tr -d '\n')"
+

Modified: trunk/info/t/Init-test.inc
===================================================================
--- trunk/info/t/Init-test.inc  2014-04-12 22:15:44 UTC (rev 5438)
+++ trunk/info/t/Init-test.inc  2014-04-12 23:20:14 UTC (rev 5439)
@@ -17,3 +17,6 @@
 
 # Remove any accidentally left over files from previous tests
 rm -f t/ginfo-output
+
+# Not an interactive test
+PTY_PID=0

Modified: trunk/info/t/index.sh
===================================================================
--- trunk/info/t/index.sh       2014-04-12 22:15:44 UTC (rev 5438)
+++ trunk/info/t/index.sh       2014-04-12 23:20:14 UTC (rev 5439)
@@ -1,18 +1,10 @@
 #!/bin/sh
 
 . t/Init-test.inc
+. t/Init-intera.inc 
 
 # Follow an index entry
 
-# TODO: Use AM_TESTS_FD_REDIRECT instead
-
-./pseudotty >pty_file &
-PTY_PID=$!
-exec >"$(cat pty_file | tr -d '\n')"
-rm -f pty_file
-
-echo ${GINFO}
-
 rm -f t/ginfo-output
 $GINFO -f intera --restore t/index.drib
 kill $PTY_PID

Modified: trunk/info/t/tab.sh
===================================================================
--- trunk/info/t/tab.sh 2014-04-12 22:15:44 UTC (rev 5438)
+++ trunk/info/t/tab.sh 2014-04-12 23:20:14 UTC (rev 5439)
@@ -1,22 +1,14 @@
 #!/bin/sh
 
 . t/Init-test.inc
+. t/Init-intera.inc
 
 # Tab to first link and follow it
-
-./pseudotty >pty_file &
-PTY_PID=$!
-exec >"$(cat pty_file | tr -d '\n')"
-rm -f pty_file
-
-rm -f t/ginfo-output
 $GINFO -f intera --restore t/tab.drib
-kill $PTY_PID
 
 test -f t/ginfo-output || exit 1
 diff t/ginfo-output t/node-target
 RETVAL=$?
-rm -f t/ginfo-output
 
-exit $RETVAL
+. t/Cleanup.inc
 




reply via email to

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