texinfo-commits
[Top][All Lists]
Advanced

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

[5438] work on info browser test suite


From: Gavin D. Smith
Subject: [5438] work on info browser test suite
Date: Sat, 12 Apr 2014 22:15:46 +0000

Revision: 5438
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5438
Author:   gavin
Date:     2014-04-12 22:15:44 +0000 (Sat, 12 Apr 2014)
Log Message:
-----------
work on info browser test suite

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/Makefile.am

Added Paths:
-----------
    trunk/info/pseudotty.c
    trunk/info/t/
    trunk/info/t/Infokey-config
    trunk/info/t/Init-test.inc
    trunk/info/t/dir-3-menus.sh
    trunk/info/t/dir-file-menu.sh
    trunk/info/t/dir-file-no-menu.sh
    trunk/info/t/dir-to-file.sh
    trunk/info/t/dir-to-no-file.sh
    trunk/info/t/dir.sh
    trunk/info/t/file-node.sh
    trunk/info/t/file.sh
    trunk/info/t/help.sh
    trunk/info/t/index.drib
    trunk/info/t/index.sh
    trunk/info/t/infodir/
    trunk/info/t/infodir/dir
    trunk/info/t/infodir/file-menu.info
    trunk/info/t/infodir/file1.info
    trunk/info/t/infodir/intera.info
    trunk/info/t/infodir/sample.info
    trunk/info/t/node-target
    trunk/info/t/tab.drib
    trunk/info/t/tab.sh

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-04-08 23:40:40 UTC (rev 5437)
+++ trunk/ChangeLog     2014-04-12 22:15:44 UTC (rev 5438)
@@ -1,3 +1,19 @@
+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.
+       * info/t/file.sh, info/t/file-node.sh, info/t/dir.sh,
+       info/t/dir-to-file.sh, info/t/dir-to-no-file.sh,
+       info/t/dir-file-menu.sh, info/t/dir-file-no-menu.sh,
+       info/t/dir-3-menus.sh, info/t/tab.sh, info/t/index.sh,
+       info/t/help.sh: Test scripts created.
+       * info/t/index.drib, info/t/tab.drib,
+       info/t/Infokey-config, info/t/node-target, info/t/infodir/dir,
+       info/t/infodir/file-menu.info, info/t/infodir/file1.info,
+       info/t/infodir/intera.info, info/t/infodir/sample.info: Files created
+       with data for tests.
+
 2014-04-08  Karl Berry  <address@hidden>
 
        * NEWS,

Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am      2014-04-08 23:40:40 UTC (rev 5437)
+++ trunk/info/Makefile.am      2014-04-12 22:15:44 UTC (rev 5438)
@@ -78,3 +78,25 @@
 # The following hack is necessary to hint make before the automatic
 # dependencies are built.
 BUILT_SOURCES = funs.h
+
+# Test suite
+
+check_DATA = t/Info-config
+t/Info-config: t/Infokey-config
+       ./infokey --output $@ $<
+
+check_PROGRAMS = pseudotty
+pseudotty_SOURCES = pseudotty.c
+
+TESTS = \
+       t/file.sh \
+       t/file-node.sh \
+       t/dir.sh \
+       t/dir-to-file.sh \
+       t/dir-to-no-file.sh \
+       t/dir-file-menu.sh \
+       t/dir-file-no-menu.sh \
+       t/dir-3-menus.sh \
+       t/tab.sh \
+       t/index.sh \
+       t/help.sh

Added: trunk/info/pseudotty.c
===================================================================
--- trunk/info/pseudotty.c                              (rev 0)
+++ trunk/info/pseudotty.c      2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,47 @@
+/* Copyright 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 of the License, 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/>. */
+
+/* pseudotty - open pseudo-terminal and print name of slave device to
+   standard output.  Read and ignore any data sent to terminal.  This
+   is so we can run tests interactively without messing up the screen. */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+int master, slave;
+char *name;
+char dummy; 
+
+main ()
+{
+  if ((master = getpt ()) == -1)
+    exit (1);
+
+  if (grantpt (master) < 0 || unlockpt (master) < 0)
+    exit (1);
+  if (!(name = ptsname (master)))
+    exit (1);
+
+  slave = open (name, O_RDWR);
+  if (slave == -1)
+    exit (1);
+  printf ("%s\n", name);
+  fflush (stdout);
+
+  while (read (master, &dummy, 1) > 0)
+    ;
+}

Added: trunk/info/t/Infokey-config
===================================================================
--- trunk/info/t/Infokey-config                         (rev 0)
+++ trunk/info/t/Infokey-config 2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,5 @@
+#info
+D      print-node      # Dump node to file
+#echo-area
+#var
+infopath-no-defaults=On

Added: trunk/info/t/Init-test.inc
===================================================================
--- trunk/info/t/Init-test.inc                          (rev 0)
+++ trunk/info/t/Init-test.inc  2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,19 @@
+# Set up test environment. This file is not to be run directly, but to
+# be sourced by the other tests.
+
+# Allow running with "make check" and individual tests at the command-line
+srcdir=${srcdir:-.}
+
+GINFO="./ginfo --init-file $srcdir/t/Info-config"
+
+# Only look for Info files in our test directory
+export infodir=$srcdir/t/infodir
+export INFOPATH=$infodir
+
+# Dump nodes with M-x print-node
+# TODO: Use different output files in each test to allow running them
+# in parallel.
+export INFO_PRINT_COMMAND='>t/ginfo-output'
+
+# Remove any accidentally left over files from previous tests
+rm -f t/ginfo-output

Added: trunk/info/t/dir-3-menus.sh
===================================================================
--- trunk/info/t/dir-3-menus.sh                         (rev 0)
+++ trunk/info/t/dir-3-menus.sh 2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. t/Init-test.inc
+
+# Follow several menus in a file to get to desired node
+$GINFO --output - file-menu 'First entry' 'Node 2' 'Node 3' \
+       | grep 'Arrived at Node 3.'
+


Property changes on: trunk/info/t/dir-3-menus.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/info/t/dir-file-menu.sh
===================================================================
--- trunk/info/t/dir-file-menu.sh                               (rev 0)
+++ trunk/info/t/dir-file-menu.sh       2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+. t/Init-test.inc
+
+# Follow a menu in a file
+$GINFO --output - file-menu 'First entry' | grep 'Arrived at Node 1.'
+


Property changes on: trunk/info/t/dir-file-menu.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/info/t/dir-file-no-menu.sh
===================================================================
--- trunk/info/t/dir-file-no-menu.sh                            (rev 0)
+++ trunk/info/t/dir-file-no-menu.sh    2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+. t/Init-test.inc
+
+# Try to select a non-existent menu item
+$GINFO --output - file-menu 'Not an entry' 2>&1 | grep 'No menu item'
+


Property changes on: trunk/info/t/dir-file-no-menu.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/info/t/dir-to-file.sh
===================================================================
--- trunk/info/t/dir-to-file.sh                         (rev 0)
+++ trunk/info/t/dir-to-file.sh 2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+. t/Init-test.inc
+
+# Follow a reference to file1 in dir
+$GINFO --output - file1


Property changes on: trunk/info/t/dir-to-file.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/info/t/dir-to-no-file.sh
===================================================================
--- trunk/info/t/dir-to-no-file.sh                              (rev 0)
+++ trunk/info/t/dir-to-no-file.sh      2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+. t/Init-test.inc
+
+# Look for a non-existent entry in dir
+$GINFO --output - not-a-file 2>&1 | grep 'No menu item'
+


Property changes on: trunk/info/t/dir-to-no-file.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/info/t/dir.sh
===================================================================
--- trunk/info/t/dir.sh                         (rev 0)
+++ trunk/info/t/dir.sh 2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+. t/Init-test.inc
+
+# Load top-level dir node
+${GINFO} --output -


Property changes on: trunk/info/t/dir.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/info/t/file-node.sh
===================================================================
--- trunk/info/t/file-node.sh                           (rev 0)
+++ trunk/info/t/file-node.sh   2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+. t/Init-test.inc
+
+# Load a node in loaded file using --node.  Note that the file has to specified
+# by --file, and not reached through the dir file.
+
+$GINFO --output - --file file-menu --node Unreachable \
+       | grep 'not linked to elsewhere'


Property changes on: trunk/info/t/file-node.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/info/t/file.sh
===================================================================
--- trunk/info/t/file.sh                                (rev 0)
+++ trunk/info/t/file.sh        2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+. t/Init-test.inc
+
+$GINFO --output - --file $infodir/sample.info


Property changes on: trunk/info/t/file.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/info/t/help.sh
===================================================================
--- trunk/info/t/help.sh                                (rev 0)
+++ trunk/info/t/help.sh        2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+. t/Init-test.inc
+
+# Test --help flag
+$GINFO --help | grep 'strict-node-location'


Property changes on: trunk/info/t/help.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/info/t/index.drib
===================================================================
--- trunk/info/t/index.drib                             (rev 0)
+++ trunk/info/t/index.drib     2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,2 @@
+iabc
+Dq
\ No newline at end of file

Added: trunk/info/t/index.sh
===================================================================
--- trunk/info/t/index.sh                               (rev 0)
+++ trunk/info/t/index.sh       2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+. t/Init-test.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
+
+test -f t/ginfo-output || exit 1
+
+# Return non-zero (test failure) if files differ
+diff t/ginfo-output t/node-target


Property changes on: trunk/info/t/index.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/info/t/infodir/dir
===================================================================
(Binary files differ)


Property changes on: trunk/info/t/infodir/dir
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/info/t/infodir/file-menu.info
===================================================================
(Binary files differ)


Property changes on: trunk/info/t/infodir/file-menu.info
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/info/t/infodir/file1.info
===================================================================
(Binary files differ)


Property changes on: trunk/info/t/infodir/file1.info
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/info/t/infodir/intera.info
===================================================================
(Binary files differ)


Property changes on: trunk/info/t/infodir/intera.info
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/info/t/infodir/sample.info
===================================================================
(Binary files differ)


Property changes on: trunk/info/t/infodir/sample.info
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/info/t/node-target
===================================================================
--- trunk/info/t/node-target                            (rev 0)
+++ trunk/info/t/node-target    2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,3 @@
+File: intera.info,  Node: Node 1
+
+Arrived at Node 1.

Added: trunk/info/t/tab.drib
===================================================================
--- trunk/info/t/tab.drib                               (rev 0)
+++ trunk/info/t/tab.drib       2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,2 @@
+       
+Dq
\ No newline at end of file

Added: trunk/info/t/tab.sh
===================================================================
--- trunk/info/t/tab.sh                         (rev 0)
+++ trunk/info/t/tab.sh 2014-04-12 22:15:44 UTC (rev 5438)
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. t/Init-test.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
+


Property changes on: trunk/info/t/tab.sh
___________________________________________________________________
Added: svn:executable
   + *




reply via email to

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