[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6039] more sh and build portability in tests
From: |
karl |
Subject: |
[6039] more sh and build portability in tests |
Date: |
Wed, 14 Jan 2015 19:38:28 +0000 |
Revision: 6039
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6039
Author: karl
Date: 2015-01-14 19:38:26 +0000 (Wed, 14 Jan 2015)
Log Message:
-----------
more sh and build portability in tests
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/t/Cleanup.inc
trunk/info/t/Init-inter.inc
trunk/info/t/Init-test.inc
trunk/info/t/Timeout-test.inc
trunk/info/t/adjust-anchors.sh
trunk/info/t/all-only.sh
trunk/info/t/anchor-positions.sh
trunk/info/t/c-u-m-x-scroll-forward.sh
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-01-14 19:33:17 UTC (rev 6038)
+++ trunk/ChangeLog 2015-01-14 19:38:26 UTC (rev 6039)
@@ -1,5 +1,12 @@
2015-01-14 Karl Berry <address@hidden>
+ * info/t/Cleanup.inc,
+ * info/t/Init-inter.inc,
+ * info/t/Init-test.inc,
+ * info/t/Timeout-test.inc: portability (export, test -v, ...),
+ usability with separate builddir != srcdir,
+ usual style.
+
* texindex/Makefile.am,
* info/Makefile.am,
* install-info/tests/Makefile.am (EXTRA_DIST): new files needed,
Modified: trunk/info/t/Cleanup.inc
===================================================================
--- trunk/info/t/Cleanup.inc 2015-01-14 19:33:17 UTC (rev 6038)
+++ trunk/info/t/Cleanup.inc 2015-01-14 19:38:26 UTC (rev 6039)
@@ -1,11 +1,26 @@
-# Cleanup and exit.
+# 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
+# the Free Software Foundation; either version 3, 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/>.
+# Cleanup and exit for tests
+
# Delete created files and kill spawned processes if any.
rm -f $GINFO_OUTPUT
rm -f $0.pipein $0.pipeout
test $PTY_PID -ne 0 && kill $PTY_PID
-if test -v TIMED_OUT
+if test -n "$TIMED_OUT"
then
return 1
fi
Modified: trunk/info/t/Init-inter.inc
===================================================================
--- trunk/info/t/Init-inter.inc 2015-01-14 19:33:17 UTC (rev 6038)
+++ trunk/info/t/Init-inter.inc 2015-01-14 19:38:26 UTC (rev 6039)
@@ -1,4 +1,4 @@
-# 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
@@ -14,10 +14,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Initialize test of interactive operation
-# This file is not to be run directly
+# This file is to be sourced, not run directly
# Avoid ginfo complaining that terminal is too dumb
-export TERM=vt100
+TERM=vt100; export TERM
# Create named pipes to communicate with pseudotty program
rm -f $0.pipein $0.pipeout
@@ -39,7 +39,7 @@
# 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
# files.
-export LIBC_FATAL_STDERR_=1
+LIBC_FATAL_STDERR_=1; export LIBC_FATAL_STDERR
run_ginfo ()
{
@@ -56,10 +56,10 @@
GINFO_PID=
# Try 3 times and then give up. The process may never have started, have
# started under a different name, or have already exited.
- for i in 1 2 3
- do
- GINFO_PID=$( pgrep -P $SUBSHELL $GINFO_NAME ; \
- test $? -eq 0 -o $? -eq 1 || exit 99 )
+ for i in 1 2 3; do
+ GINFO_PID=`pgrep -P $SUBSHELL $GINFO_NAME`
+ test $? -eq 0 || test $? -eq 1 || exit 99
+ test -n "$GINFO_PID" || exit 99
# This use of pgrep is likely not portable (works on procps). Check if it
# is likely to have worked.
@@ -75,7 +75,7 @@
echo $GINFO_PID | grep -v '^[0-9]*$' >/dev/null
test $? -eq 0 && { GINFO_PID=unknown; break; }
- GINFO_PID=$(echo $GINFO_PID | tr -d '\n')
+ GINFO_PID=`echo $GINFO_PID | tr -d '\n'`
test "$GINFO_PID" = "" || break
sleep 1 # Give subshell time to spawn ginfo process
Modified: trunk/info/t/Init-test.inc
===================================================================
--- trunk/info/t/Init-test.inc 2015-01-14 19:33:17 UTC (rev 6038)
+++ trunk/info/t/Init-test.inc 2015-01-14 19:38:26 UTC (rev 6039)
@@ -1,6 +1,21 @@
-# Set up test environment
-# This file is not to be run directly
+# 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
+# the Free Software Foundation; either version 3, 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/>.
+# Set up standalone info test environment
+# This file is to be sourced, not to be run directly
+
# Allow running with "make check" and individual tests at the command-line
srcdir=${srcdir:-.}
@@ -13,17 +28,17 @@
#GINFO_NAME=memcheck-x86-li
# Only look for Info files in our test directory
-export infodir=$srcdir/t/infodir
-export INFOPATH=$infodir
+infodir=$srcdir/t/infodir; export infodir
+INFOPATH=$infodir; export INFOPATH
-export t=$srcdir/t
+t=$srcdir/t; export t
-GINFO_OUTPUT=$0.out
+GINFO_OUTPUT=`basename $0.out`
# Remove left over file from previous tests
rm -f $GINFO_OUTPUT
# File to dump nodes to with M-x print-node
-export INFO_PRINT_COMMAND=">$GINFO_OUTPUT"
+INFO_PRINT_COMMAND=">$GINFO_OUTPUT"; export INFO_PRINT_COMMAND
# Not an interactive test
PTY_PID=0
@@ -32,4 +47,4 @@
LC_ALL=C; export LC_ALL
# Make sure that non-interactive operation works even if terminal is dumb
-export TERM=dumb
+TERM=dumb; export TERM
Modified: trunk/info/t/Timeout-test.inc
===================================================================
--- trunk/info/t/Timeout-test.inc 2015-01-14 19:33:17 UTC (rev 6038)
+++ trunk/info/t/Timeout-test.inc 2015-01-14 19:38:26 UTC (rev 6039)
@@ -1,4 +1,4 @@
-# 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
@@ -15,20 +15,21 @@
# Shell script snippet. Wait for program to finish.
+# Not timed out yet
+TIMED_OUT=
+
read -t 3 FINISHED <>$0.finished
rm -f $0.finished
-if test "$FINISHED" = failure
-then
+if test "$FINISHED" = failure; then
echo 'Program exited unsuccessfully' >&2
RETVAL=1
-elif ! test "$FINISHED" = finished
-then
+
+elif test "$FINISHED" != finished; then
# Kill ginfo if we have its PID. Failing this, it will probably exit
# with an I/O error when pseudotty is killed in Cleanup.inc.
test "$GINFO_PID" != unknown && kill $GINFO_PID
echo 'Program timed out after 3 seconds' >&2
TIMED_OUT=1
-
fi
Modified: trunk/info/t/adjust-anchors.sh
===================================================================
--- trunk/info/t/adjust-anchors.sh 2015-01-14 19:33:17 UTC (rev 6038)
+++ trunk/info/t/adjust-anchors.sh 2015-01-14 19:38:26 UTC (rev 6039)
@@ -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,7 +18,7 @@
. $srcdir/t/Init-test.inc
. $t/Init-inter.inc
-export LANG=en_US.iso8859-1
+LANG=en_US.iso8859-1; export LANG
run_ginfo -f anchors
# Go to anchor in a UTF-8 encoded file when the current character encoding is
Modified: trunk/info/t/all-only.sh
===================================================================
--- trunk/info/t/all-only.sh 2015-01-14 19:33:17 UTC (rev 6038)
+++ trunk/info/t/all-only.sh 2015-01-14 19:38:26 UTC (rev 6039)
@@ -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
@@ -19,7 +19,7 @@
. $t/Init-inter.inc
# Try to stop a "man" command finding a man page called "intera"
-export MANPATH=.
+MANPATH=.; export MANPATH
# Check that if there is only one file found with --all, we go straight
# to that file without loading a menu of matching files. This relies
Modified: trunk/info/t/anchor-positions.sh
===================================================================
--- trunk/info/t/anchor-positions.sh 2015-01-14 19:33:17 UTC (rev 6038)
+++ trunk/info/t/anchor-positions.sh 2015-01-14 19:38:26 UTC (rev 6039)
@@ -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
@@ -20,7 +20,7 @@
# Open a UTF-8 file with anchors in various positions. Check that character
# encoding conversion doesn't cause the program to freeze.
-export LANG=en_US.iso8859-1
+LANG=en_US.iso8859-1; export LANG
run_ginfo -f anchor-positions
printf q >$PTY_TYPE
Modified: trunk/info/t/c-u-m-x-scroll-forward.sh
===================================================================
--- trunk/info/t/c-u-m-x-scroll-forward.sh 2015-01-14 19:33:17 UTC (rev
6038)
+++ trunk/info/t/c-u-m-x-scroll-forward.sh 2015-01-14 19:38:26 UTC (rev
6039)
@@ -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
@@ -23,7 +23,8 @@
# status line and 1 line for the echo area.
# This relies on the TIOCGWINSZ ioctl failing for the pseudotty (see
# terminal_get_screen_size in terminal.c).
-export LINES=7 COLUMNS=80
+LINES=7; export LINES
+COLUMNS=80; export COLUMNS
run_ginfo -f intera -n 'Scroll four lines'
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6039] more sh and build portability in tests,
karl <=