texinfo-commits
[Top][All Lists]
Advanced

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

[5536] TERM setting in tests


From: Gavin D. Smith
Subject: [5536] TERM setting in tests
Date: Thu, 08 May 2014 22:58:32 +0000

Revision: 5536
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5536
Author:   gavin
Date:     2014-05-08 22:58:31 +0000 (Thu, 08 May 2014)
Log Message:
-----------
TERM setting in tests

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/session.c
    trunk/info/t/Init-intera.inc
    trunk/info/t/Init-test.inc
    trunk/info/terminal.c
    trunk/info/terminal.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-05-08 22:13:32 UTC (rev 5535)
+++ trunk/ChangeLog     2014-05-08 22:58:31 UTC (rev 5536)
@@ -1,11 +1,23 @@
 2014-05-08  Gavin Smith  <address@hidden>
 
-       * info-utils.c (scan_node_contents): Pass offset relative to start
-       of node contents of "*" starting reference to scan_reference_label.
-       Report by Benno Schulenberg 8th May, 2014. 
+       * info/session.c (initialize_terminal_and_keymaps): Don't quit if
+       terminal is dumb, because we might not be running interactively.
+       (initialize_info_session): Quit if terminal is dumb.
+       * info/terminal.c (terminal_initialize_terminal): Comment corrected.
+       (terminal_prep_terminal): Return 0 for a dumb terminal.
 
+       * info/t/Init-test.inc: Run tests with TERM=dumb by default.
+       * info/t/Init-intera.inc: Run interactive tests with TERM=vt100.
+       Suggested by Karl Berry.
+
 2014-05-08  Gavin Smith  <address@hidden>
 
+       * info/info-utils.c (scan_node_contents): Pass offset relative to
+       start of node contents of "*" starting reference to
+       scan_reference_label.  Report by Benno Schulenberg 8th May, 2014. 
+
+2014-05-08  Gavin Smith  <address@hidden>
+
        * info/session.c (begin_multiple_window_info_session): Deal with
        references to desired nodes being invalid and display dir node
        as a back-up.

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2014-05-08 22:13:32 UTC (rev 5535)
+++ trunk/info/session.c        2014-05-08 22:58:31 UTC (rev 5536)
@@ -276,16 +276,6 @@
 {
   char *term_name = getenv ("TERM");
   terminal_initialize_terminal (term_name);
-
-  if (terminal_is_dumb_p)
-    {
-      if (!term_name)
-        term_name = "dumb";
-
-      info_error (msg_term_too_dumb, term_name);
-      exit (EXIT_FAILURE);
-    }
-
   read_init_file (init_file);
 }
 
@@ -294,7 +284,14 @@
 void
 initialize_info_session (void)
 {
-  terminal_prep_terminal ();
+  if (!terminal_prep_terminal())
+    {
+      /* Terminal too dumb to run interactively. */
+      char *term_name = getenv ("TERM");
+      info_error (msg_term_too_dumb, term_name);
+      exit (EXIT_FAILURE);
+    }
+
   terminal_clear_screen ();
 
   window_initialize_windows (screenwidth, screenheight);

Modified: trunk/info/t/Init-intera.inc
===================================================================
--- trunk/info/t/Init-intera.inc        2014-05-08 22:13:32 UTC (rev 5535)
+++ trunk/info/t/Init-intera.inc        2014-05-08 22:58:31 UTC (rev 5536)
@@ -5,6 +5,9 @@
 # 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.
 
+# Avoid info complaining that terminal is too dumb
+export TERM=vt100
+
 GINFO_PTY_FILE=$0.pty
 rm -f $GINFO_PTY_FILE
 ./pseudotty >$GINFO_PTY_FILE &

Modified: trunk/info/t/Init-test.inc
===================================================================
--- trunk/info/t/Init-test.inc  2014-05-08 22:13:32 UTC (rev 5535)
+++ trunk/info/t/Init-test.inc  2014-05-08 22:58:31 UTC (rev 5536)
@@ -25,5 +25,8 @@
 # Get error messages in English
 LC_ALL=C; export LC_ALL
 
+# Make sure that non-interactive operation works even if terminal is dumb
+export TERM=dumb
+
 # TODO: Exit test after so long, in case (for example) we get stuck in
 # interactive mode.

Modified: trunk/info/terminal.c
===================================================================
--- trunk/info/terminal.c       2014-05-08 22:13:32 UTC (rev 5535)
+++ trunk/info/terminal.c       2014-05-08 22:58:31 UTC (rev 5536)
@@ -2,7 +2,7 @@
    $Id$
 
    Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, 1998,
-   1999, 2001, 2002, 2004, 2007, 2008, 2012, 2013
+   1999, 2001, 2002, 2004, 2007, 2008, 2012, 2013, 2014
    Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -504,7 +504,7 @@
    becomes nonzero.  The variables SCREENHEIGHT and SCREENWIDTH are set
    to the dimensions that this terminal actually has.  The variable
    TERMINAL_HAS_META_P becomes nonzero if this terminal supports a Meta
-   key.  Finally, the terminal screen is cleared. */
+   key.  Get and save various termcap strings. */
 void
 terminal_initialize_terminal (char *terminal_name)
 {
@@ -687,12 +687,16 @@
 #  endif /* !HAVE_TERMIO_H */
 #endif /* !HAVE_TERMIOS_H */
 
-/* Prepare to start using the terminal to read characters singly. */
-void
+/* Prepare to start using the terminal to read characters singly.  Return
+   0 if terminal is too dumb to run Info interactively. */
+int
 terminal_prep_terminal (void)
 {
   int tty;
 
+  if (terminal_is_dumb_p)
+    return 0;
+
   if (terminal_prep_terminal_hook)
     {
       (*terminal_prep_terminal_hook) ();
@@ -826,6 +830,7 @@
   ioctl (tty, TIOCSETN, &ttybuff);
 # endif
 #endif /* !HAVE_TERMIOS_H && !HAVE_TERMIO_H */
+  return 1;
 }
 
 /* Restore the tty settings back to what they were before we started using

Modified: trunk/info/terminal.h
===================================================================
--- trunk/info/terminal.h       2014-05-08 22:13:32 UTC (rev 5535)
+++ trunk/info/terminal.h       2014-05-08 22:58:31 UTC (rev 5536)
@@ -61,7 +61,7 @@
 extern VFunction *terminal_get_screen_size_hook;
 
 /* Save and restore tty settings. */
-extern void terminal_prep_terminal (void);
+extern int terminal_prep_terminal (void);
 extern void terminal_unprep_terminal (void);
 
 extern VFunction *terminal_prep_terminal_hook;




reply via email to

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