txitextest 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/bin/sh
  2. # $Id$
  3. # Copyright 2006, 2011, 2012, 2013 Free Software Foundation, Inc.
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 3 of the License,
  8. # or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. #
  18. # Original author: Karl Berry.
  19. #
  20. # Test texinfo.tex changes by running various manuals through with an
  21. # old version, saving the .ps result from dvips, doing the same with a
  22. # new version, and comparing. Idea from Stepan Kasal.
  23. #
  24. # Another option is to run the manuals all the way through using
  25. # texi2dvi, which tests in another way.
  26. tsrc=`cd \`dirname $0\` && pwd`/../..
  27. PATH=$tsrc/util:$PATH
  28. tdoc=$tsrc/doc
  29. default_manuals="$tdoc/texinfo.texi $tdoc/info.texi $tdoc/info-stnd.texi"
  30. olddir=$tsrc/../gnulib/config
  31. newdir=$tdoc
  32. tempdir=$tsrc/@tests/test
  33. full=false
  34. manuals=
  35. while test $# -gt 0; do
  36. case $1 in
  37. --f*) full=true;;
  38. --o*) shift; olddir="$1";;
  39. --n*) shift; newdir="$1";;
  40. --t*) shift; tempdir="$1";;
  41. -*) echo "$0: unknown option \`$1'." >&2; exit 1;;
  42. *) manuals="$manuals $1";;
  43. esac
  44. shift
  45. done
  46. test -z "$manuals" && manuals=$default_manuals
  47. initial_dir=`pwd`
  48. cd $tempdir || exit 1
  49. rm -f *
  50. run_tex() \
  51. {
  52. TEXINPUTS=.:$mandir: tex $manual \
  53. || { echo "$0: tex $manual failed." >&2; exit 1; }
  54. }
  55. for manual in $manuals; do
  56. mandir=`dirname $manual`
  57. test $mandir = . && mandir=$initial_dir
  58. manual_base=`basename "$manual" | sed 's/\.[^.]*$//'`
  59. rm -rf $manual_base.* texinfo.tex
  60. ln -s $newdir/texinfo.tex texinfo.tex
  61. if $full; then
  62. # instead of comparing, do full test of just the new texinfo.tex.
  63. echo "$0: testing $manual_base... (tex)"
  64. texi2dvi $manual || { echo "texi2dvi $manual failed." >&2; exit 1; }
  65. echo "$0: testing $manual_base... (pdf)"
  66. texi2dvi --pdf $manual \
  67. || { echo "texi2dvi --pdf $manual failed." >&2; exit 1; }
  68. else
  69. echo "$0: testing $manual_base... (new)"
  70. run_tex
  71. dvips $manual_base -o || exit 1
  72. mv $manual_base.ps new.$manual_base.ps
  73. echo "$0: testing $manual_base... (old)"
  74. rm -rf $manual_base.* texinfo.tex
  75. ln -s $olddir/texinfo.tex texinfo.tex
  76. run_tex
  77. dvips $manual_base -o || exit 1
  78. mv $manual_base.ps old.$manual_base.ps
  79. diff -U0 old.$manual_base.ps new.$manual_base.ps
  80. fi
  81. done