defs.in 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. # -*- shell-script -*-
  2. # @configure_input@
  3. #
  4. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
  5. # 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
  6. #
  7. # (This file was originally part of GNU Automake.)
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; either version 3 of the License, or (at
  12. # your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU General Public License
  20. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. # Defines for Automake testing environment.
  22. # Tom Tromey <tromey@cygnus.com>
  23. # Be Bourne compatible.
  24. # (Snippet copied from configure's initialization in Autoconf 2.57.)
  25. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  26. emulate sh
  27. NULLCMD=:
  28. # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  29. # is contrary to our usage. Disable this feature.
  30. alias -g '${1+"$@"}'='"$@"'
  31. elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
  32. set -o posix
  33. fi
  34. # Ensure we are running from the right directory.
  35. test -f ./defs || {
  36. echo "defs: not found in current directory" 1>&2
  37. exit 1
  38. }
  39. # If srcdir is not set, then we are not running from `make check', be verbose.
  40. if test -z "$srcdir"; then
  41. VERBOSE=x
  42. # compute $srcdir.
  43. srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'`
  44. test $srcdir = $0 && srcdir=.
  45. fi
  46. # Ensure $srcdir is set correctly.
  47. test -f $srcdir/defs.in || {
  48. echo "$srcdir/defs.in not found, check \$srcdir" 1>&2
  49. exit 1
  50. }
  51. me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'`
  52. # See how redirections should work. User can set VERBOSE to see all
  53. # output.
  54. test -z "$VERBOSE" && {
  55. exec > /dev/null 2>&1
  56. }
  57. # Make sure we override the user shell.
  58. SHELL='@SHELL@'
  59. export SHELL
  60. srcdir_abs=`cd $srcdir && pwd`
  61. test -z "$TEXI2DVI" && TEXI2DVI=$srcdir_abs/texi2dvi
  62. # be sure we use texi2dvi and texindex from our own directory, not
  63. # whatever happens to be in the path.
  64. echo "defs: prepending $srcdir_abs to PATH for testing."
  65. PATH="@abs_builddir@:@abs_srcdir@:$PATH"
  66. # Some shells forget to export modified environment variables.
  67. # (See note about `export' in the Autoconf manual.)
  68. export PATH
  69. # User can override various tools used.
  70. test -z "$PERL" && PERL='@PERL@'
  71. if test -n "$required"
  72. then
  73. for tool in $required
  74. do
  75. # Check that each required tool is present.
  76. case $tool in
  77. hevea)
  78. # HeVeA supports -version only. Use configure to find it.
  79. test -n "@HEVEA@" || exit 77
  80. ;;
  81. tex)
  82. # No all versions of Tex support `--version', so we use
  83. # a configure check.
  84. test -n "@TEX@" || exit 77
  85. ;;
  86. # Generic case: the tool must support --version.
  87. *)
  88. echo "$me: running $tool --version"
  89. ( $tool --version ) || exit 77
  90. ;;
  91. esac
  92. done
  93. fi
  94. # Always use an absolute srcdir. Otherwise symlinks made in subdirs
  95. # of the test dir just won't work.
  96. case "$srcdir" in
  97. [\\/]* | ?:[\\/]*)
  98. ;;
  99. *)
  100. srcdir=`CDPATH=: && cd "$srcdir" && pwd`
  101. ;;
  102. esac
  103. chmod -R a+rwx testSubDir > /dev/null 2>&1
  104. rm -rf testSubDir > /dev/null 2>&1
  105. mkdir testSubDir
  106. # Copy in some files we need.
  107. cp $srcdir/../doc/texinfo.tex testSubDir || exit 1
  108. cd ./testSubDir
  109. # Unset the user's envvars that might change the behavior.
  110. unset TEXI2DVI_BUILD_MODE
  111. unset TEXI2DVI_BUILD_DIRECTORY
  112. echo "=== Running test $0"
  113. # POSIX no longer requires 'egrep' and 'fgrep',
  114. # but some hosts lack 'grep -E' and 'grep -F'.
  115. EGREP='@EGREP@'
  116. FGREP='@FGREP@'
  117. # The amount we should wait after modifying files depends on the platform.
  118. # For instance, Windows '95, '98 and ME have 2-second granularity
  119. # and can be up to 3 seconds in the future w.r.t. the system clock.
  120. sleep='sleep @MODIFICATION_DELAY@'
  121. # The tests call `make -e' but we do not want $srcdir from the environment
  122. # to override the definition from the Makefile.
  123. testsrcdir=$srcdir
  124. unset srcdir
  125. # create_input_texi < INPUT
  126. # -------------------------
  127. # Create input.texi adding stdin inside a default prologue/epilogue
  128. create_input_texi ()
  129. {
  130. {
  131. cat << END
  132. \input texinfo @c -*-texinfo-*-
  133. @setfilename input
  134. @settitle input
  135. @ifnottex
  136. @node Top
  137. @top input
  138. @end ifnottex
  139. END
  140. cat
  141. cat << END
  142. @bye
  143. END
  144. } >input.texi
  145. }
  146. # create_input_tex < INPUT
  147. # ------------------------
  148. # Create input.tex adding stdin inside a default prologue/epilogue
  149. create_input_tex ()
  150. {
  151. {
  152. cat << END
  153. \documentclass{article}
  154. \begin{document}
  155. END
  156. cat
  157. cat << END
  158. \end{document}
  159. END
  160. } >input.tex
  161. }
  162. # TEXI2DVI_run status [options...]
  163. # --------------------------------
  164. # Run texi2dvi with OPTIONS, and fail if does not exit with STATUS.
  165. TEXI2DVI_run ()
  166. {
  167. expected_exitcode=$1
  168. shift
  169. exitcode=0
  170. if test -n "$VERBOSE"; then
  171. set x --debug --verbose ${1+"$@"}
  172. shift
  173. fi
  174. texi2dvi ${1+"$@"} 2>stderr >stdout || exitcode=$?
  175. cat stderr
  176. cat stdout
  177. test $exitcode = $expected_exitcode || exit 1
  178. }
  179. # TEXI2DVI_fail [options...]
  180. # ---------------------------
  181. # Run texi2dvi with OPTIONS, and fail if does not exit with failure.
  182. TEXI2DVI_fail ()
  183. {
  184. TEXI2DVI_run 1 ${1+"$@"}
  185. }
  186. # TEXI2DVI_pass [options...]
  187. # ---------------------------
  188. # Run texi2dvi with OPTIONS, and fail if does not exit with failure.
  189. TEXI2DVI_pass ()
  190. {
  191. TEXI2DVI_run 0 ${1+"$@"}
  192. }
  193. # optionset_get N OPTIONSET<1> -- OPTIONSET<2> -- ...
  194. # ---------------------------------------------------
  195. # Return OPTIONSET<N>
  196. optionset_get ()
  197. {
  198. n=$1
  199. shift
  200. # Find the optionset.
  201. while test $n != 1; do
  202. case $1 in
  203. --) n=`expr $n - 1`;;
  204. esac
  205. shift
  206. done
  207. # Return the optionset.
  208. while true; do
  209. case $#:$1 in
  210. 0:) break;;
  211. *:--) shift; break;;
  212. *) echo "$1"; shift;;
  213. esac
  214. done
  215. }
  216. # list_files ()
  217. # -------------
  218. # Return the sorted list of files in this directory, except the "invisible" ones.
  219. list_files ()
  220. {
  221. for f in *
  222. do
  223. case $f in
  224. texinfo.tex | stdout | stderr | ls.expected | ls.value );;
  225. *) echo $f;;
  226. esac
  227. done | sort
  228. }
  229. # assert_files (EXPECTED-FILES)
  230. # -----------------------------
  231. # Only those files are valid in the current directory.
  232. assert_files ()
  233. {
  234. if test -n "$VERBOSE"; then
  235. ls
  236. fi
  237. list_files > ls.value
  238. echo "$*" | tr ' ' '\n' | sort > ls.expected
  239. diff -u ls.expected ls.value
  240. }
  241. # assert_and_remove_files (EXPECTED-FILES)
  242. # ----------------------------------------
  243. # Only those files are valid in the current directory. Remove them
  244. # afterwards.
  245. assert_and_remove_files ()
  246. {
  247. assert_files "$@"
  248. rm -rf "$@"
  249. }
  250. # title TITLE...
  251. # --------------
  252. # Make a huge title to ease the reading of the output.
  253. title ()
  254. {
  255. (
  256. set +x
  257. echo " $@ " | sed -e 's/./=/g'
  258. echo " $@ "
  259. echo " $@ " | sed -e 's/./=/g'
  260. )
  261. }
  262. # $latex_paragraph
  263. # ----------------
  264. # Some lengthy LaTeX.
  265. # grep -E '^[a-zA-Z]+$' /usr/share/dict/words | sed 200q | pr --page-width=76 --column=5 --omit-header
  266. latex_paragraph='
  267. A Acrux Aegean Ahmad Albany
  268. AOL Actaeon Aelfric Ahmadabad Albee
  269. Aachen Acton Aeneas Ahmed Alberio
  270. Aaliyah Acts Aeneid Ahriman Albert
  271. Aaron Acuff Aeolus Aida Alberta
  272. Abbas Ada Aeroflot Aiken Alberto
  273. Abbasid Adam Aeschylus Aileen Albigensian
  274. Abbott Adams Aesculapius Aimee Albion
  275. Abby Adan Aesop Ainu Albireo
  276. Abdul Adana Afghan Airedale Albuquerque
  277. Abe Adar Afghanistan Airedales Alcatraz
  278. Abel Addams Afghans Aisha Alcestis
  279. Abelard Adderley Africa Ajax Alcibiades
  280. Abelson Addie African Akbar Alcmena
  281. Aberdeen Addison Africans Akhmatova Alcoa
  282. Abernathy Adela Afrikaans Akihito Alcott
  283. Abidjan Adelaide Afrikaner Akita Alcuin
  284. Abigail Adele Afrikaners Akkad Alcyone
  285. Abilene Adeline Afro Akron Aldan
  286. Abner Aden Afrocentrism Al Aldebaran
  287. Abraham Adenauer Afros Ala Alden
  288. Abram Adhara Ag Alabama Alderamin
  289. Abrams Adidas Agamemnon Alabaman Aldo
  290. Absalom Adirondack Agassi Alabamans Aldrin
  291. Abuja Adirondacks Agassiz Alabamian Alec
  292. Abyssinia Adkins Agatha Alabamians Aleichem
  293. Abyssinian Adler Aggie Aladdin Alejandra
  294. Ac Adolf Aglaia Alamo Alejandro
  295. Acadia Adolfo Agnes Alamogordo Alembert
  296. Acapulco Adolph Agnew Alan Aleppo
  297. Accra Adonis Agni Alana Aleut
  298. Acevedo Adonises Agra Alar Aleutian
  299. Achaean Adrian Agricola Alaric Alex
  300. Achebe Adriana Agrippa Alaska Alexander
  301. Achernar Adriatic Agrippina Alaskan Alexandra
  302. Acheson Adrienne Aguilar Alaskans Alexandria
  303. Achilles Advent Aguinaldo Alba Alexei
  304. Aconcagua Adventist Aguirre Albania Alexis
  305. Acosta Advents Agustin Albanian Alfonso
  306. Acropolis Advil Ahab Albanians Alfonzo
  307. '
  308. # Turn on shell traces when VERBOSE is set.
  309. if test -n "$VERBOSE"; then
  310. set -x
  311. else
  312. :
  313. fi
  314. pwd