123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365 |
- # -*- shell-script -*-
- # @configure_input@
- #
- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- # 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
- #
- # (This file was originally part of GNU Automake.)
- #
- # 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/>.
- # Defines for Automake testing environment.
- # Tom Tromey <tromey@cygnus.com>
- # Be Bourne compatible.
- # (Snippet copied from configure's initialization in Autoconf 2.57.)
- if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
- fi
- # Ensure we are running from the right directory.
- test -f ./defs || {
- echo "defs: not found in current directory" 1>&2
- exit 1
- }
- # If srcdir is not set, then we are not running from `make check', be verbose.
- if test -z "$srcdir"; then
- VERBOSE=x
- # compute $srcdir.
- srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'`
- test $srcdir = $0 && srcdir=.
- fi
- # Ensure $srcdir is set correctly.
- test -f $srcdir/defs.in || {
- echo "$srcdir/defs.in not found, check \$srcdir" 1>&2
- exit 1
- }
- me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'`
- # See how redirections should work. User can set VERBOSE to see all
- # output.
- test -z "$VERBOSE" && {
- exec > /dev/null 2>&1
- }
- # Make sure we override the user shell.
- SHELL='@SHELL@'
- export SHELL
- srcdir_abs=`cd $srcdir && pwd`
- test -z "$TEXI2DVI" && TEXI2DVI=$srcdir_abs/texi2dvi
- # be sure we use texi2dvi and texindex from our own directory, not
- # whatever happens to be in the path.
- echo "defs: prepending $srcdir_abs to PATH for testing."
- PATH="@abs_builddir@:@abs_srcdir@:$PATH"
- # Some shells forget to export modified environment variables.
- # (See note about `export' in the Autoconf manual.)
- export PATH
- # User can override various tools used.
- test -z "$PERL" && PERL='@PERL@'
- if test -n "$required"
- then
- for tool in $required
- do
- # Check that each required tool is present.
- case $tool in
- hevea)
- # HeVeA supports -version only. Use configure to find it.
- test -n "@HEVEA@" || exit 77
- ;;
- tex)
- # No all versions of Tex support `--version', so we use
- # a configure check.
- test -n "@TEX@" || exit 77
- ;;
- # Generic case: the tool must support --version.
- *)
- echo "$me: running $tool --version"
- ( $tool --version ) || exit 77
- ;;
- esac
- done
- fi
- # Always use an absolute srcdir. Otherwise symlinks made in subdirs
- # of the test dir just won't work.
- case "$srcdir" in
- [\\/]* | ?:[\\/]*)
- ;;
- *)
- srcdir=`CDPATH=: && cd "$srcdir" && pwd`
- ;;
- esac
- chmod -R a+rwx testSubDir > /dev/null 2>&1
- rm -rf testSubDir > /dev/null 2>&1
- mkdir testSubDir
- # Copy in some files we need.
- cp $srcdir/../doc/texinfo.tex testSubDir || exit 1
- cd ./testSubDir
- # Unset the user's envvars that might change the behavior.
- unset TEXI2DVI_BUILD_MODE
- unset TEXI2DVI_BUILD_DIRECTORY
- echo "=== Running test $0"
- # POSIX no longer requires 'egrep' and 'fgrep',
- # but some hosts lack 'grep -E' and 'grep -F'.
- EGREP='@EGREP@'
- FGREP='@FGREP@'
- # The amount we should wait after modifying files depends on the platform.
- # For instance, Windows '95, '98 and ME have 2-second granularity
- # and can be up to 3 seconds in the future w.r.t. the system clock.
- sleep='sleep @MODIFICATION_DELAY@'
- # The tests call `make -e' but we do not want $srcdir from the environment
- # to override the definition from the Makefile.
- testsrcdir=$srcdir
- unset srcdir
- # create_input_texi < INPUT
- # -------------------------
- # Create input.texi adding stdin inside a default prologue/epilogue
- create_input_texi ()
- {
- {
- cat << END
- \input texinfo @c -*-texinfo-*-
- @setfilename input
- @settitle input
- @ifnottex
- @node Top
- @top input
- @end ifnottex
- END
- cat
- cat << END
- @bye
- END
- } >input.texi
- }
- # create_input_tex < INPUT
- # ------------------------
- # Create input.tex adding stdin inside a default prologue/epilogue
- create_input_tex ()
- {
- {
- cat << END
- \documentclass{article}
- \begin{document}
- END
- cat
- cat << END
- \end{document}
- END
- } >input.tex
- }
- # TEXI2DVI_run status [options...]
- # --------------------------------
- # Run texi2dvi with OPTIONS, and fail if does not exit with STATUS.
- TEXI2DVI_run ()
- {
- expected_exitcode=$1
- shift
- exitcode=0
- if test -n "$VERBOSE"; then
- set x --debug --verbose ${1+"$@"}
- shift
- fi
- texi2dvi ${1+"$@"} 2>stderr >stdout || exitcode=$?
- cat stderr
- cat stdout
- test $exitcode = $expected_exitcode || exit 1
- }
- # TEXI2DVI_fail [options...]
- # ---------------------------
- # Run texi2dvi with OPTIONS, and fail if does not exit with failure.
- TEXI2DVI_fail ()
- {
- TEXI2DVI_run 1 ${1+"$@"}
- }
- # TEXI2DVI_pass [options...]
- # ---------------------------
- # Run texi2dvi with OPTIONS, and fail if does not exit with failure.
- TEXI2DVI_pass ()
- {
- TEXI2DVI_run 0 ${1+"$@"}
- }
- # optionset_get N OPTIONSET<1> -- OPTIONSET<2> -- ...
- # ---------------------------------------------------
- # Return OPTIONSET<N>
- optionset_get ()
- {
- n=$1
- shift
- # Find the optionset.
- while test $n != 1; do
- case $1 in
- --) n=`expr $n - 1`;;
- esac
- shift
- done
- # Return the optionset.
- while true; do
- case $#:$1 in
- 0:) break;;
- *:--) shift; break;;
- *) echo "$1"; shift;;
- esac
- done
- }
- # list_files ()
- # -------------
- # Return the sorted list of files in this directory, except the "invisible" ones.
- list_files ()
- {
- for f in *
- do
- case $f in
- texinfo.tex | stdout | stderr | ls.expected | ls.value );;
- *) echo $f;;
- esac
- done | sort
- }
- # assert_files (EXPECTED-FILES)
- # -----------------------------
- # Only those files are valid in the current directory.
- assert_files ()
- {
- if test -n "$VERBOSE"; then
- ls
- fi
- list_files > ls.value
- echo "$*" | tr ' ' '\n' | sort > ls.expected
- diff -u ls.expected ls.value
- }
- # assert_and_remove_files (EXPECTED-FILES)
- # ----------------------------------------
- # Only those files are valid in the current directory. Remove them
- # afterwards.
- assert_and_remove_files ()
- {
- assert_files "$@"
- rm -rf "$@"
- }
- # title TITLE...
- # --------------
- # Make a huge title to ease the reading of the output.
- title ()
- {
- (
- set +x
- echo " $@ " | sed -e 's/./=/g'
- echo " $@ "
- echo " $@ " | sed -e 's/./=/g'
- )
- }
- # $latex_paragraph
- # ----------------
- # Some lengthy LaTeX.
- # grep -E '^[a-zA-Z]+$' /usr/share/dict/words | sed 200q | pr --page-width=76 --column=5 --omit-header
- latex_paragraph='
- A Acrux Aegean Ahmad Albany
- AOL Actaeon Aelfric Ahmadabad Albee
- Aachen Acton Aeneas Ahmed Alberio
- Aaliyah Acts Aeneid Ahriman Albert
- Aaron Acuff Aeolus Aida Alberta
- Abbas Ada Aeroflot Aiken Alberto
- Abbasid Adam Aeschylus Aileen Albigensian
- Abbott Adams Aesculapius Aimee Albion
- Abby Adan Aesop Ainu Albireo
- Abdul Adana Afghan Airedale Albuquerque
- Abe Adar Afghanistan Airedales Alcatraz
- Abel Addams Afghans Aisha Alcestis
- Abelard Adderley Africa Ajax Alcibiades
- Abelson Addie African Akbar Alcmena
- Aberdeen Addison Africans Akhmatova Alcoa
- Abernathy Adela Afrikaans Akihito Alcott
- Abidjan Adelaide Afrikaner Akita Alcuin
- Abigail Adele Afrikaners Akkad Alcyone
- Abilene Adeline Afro Akron Aldan
- Abner Aden Afrocentrism Al Aldebaran
- Abraham Adenauer Afros Ala Alden
- Abram Adhara Ag Alabama Alderamin
- Abrams Adidas Agamemnon Alabaman Aldo
- Absalom Adirondack Agassi Alabamans Aldrin
- Abuja Adirondacks Agassiz Alabamian Alec
- Abyssinia Adkins Agatha Alabamians Aleichem
- Abyssinian Adler Aggie Aladdin Alejandra
- Ac Adolf Aglaia Alamo Alejandro
- Acadia Adolfo Agnes Alamogordo Alembert
- Acapulco Adolph Agnew Alan Aleppo
- Accra Adonis Agni Alana Aleut
- Acevedo Adonises Agra Alar Aleutian
- Achaean Adrian Agricola Alaric Alex
- Achebe Adriana Agrippa Alaska Alexander
- Achernar Adriatic Agrippina Alaskan Alexandra
- Acheson Adrienne Aguilar Alaskans Alexandria
- Achilles Advent Aguinaldo Alba Alexei
- Aconcagua Adventist Aguirre Albania Alexis
- Acosta Advents Agustin Albanian Alfonso
- Acropolis Advil Ahab Albanians Alfonzo
- '
- # Turn on shell traces when VERBOSE is set.
- if test -n "$VERBOSE"; then
- set -x
- else
- :
- fi
- pwd
|