txinfo-vtexi4.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #! /bin/sh
  2. # Copyright (C) 2011-2017 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Check that the version.texi file is automatically created and distributed
  17. # if @included into a texi source. Also check that is correctly defined
  18. # @values definitions it is advertised to.
  19. # See also the related test 'txinfo-vtexi4.sh', which does similar checks,
  20. # but for more vers*.texi files, and does not require makeinfo, tex and
  21. # texi2dvi.
  22. required='makeinfo tex texi2dvi grep-nonprint'
  23. . test-init.sh
  24. test $(LC_ALL=C date '+%u') -gt 0 && test $(LC_ALL=C date '+%u') -lt 8 \
  25. && day=$(LC_ALL=C date '+%d') && test -n "$day" \
  26. && month=$(LC_ALL=C date '+%B') && test -n "$month" \
  27. && year=$(LC_ALL=C date '+%Y') && test -n "$year" \
  28. || skip_ "'date' is not POSIX-compliant enough"
  29. day=$(echo "$day" | sed 's/^0//')
  30. cat > configure.ac << END
  31. AC_INIT([$me], [123.456])
  32. AM_INIT_AUTOMAKE
  33. AC_CONFIG_FILES([Makefile])
  34. AC_OUTPUT
  35. END
  36. cat > defs.am <<END
  37. my_date_rx = $day $month $year
  38. my_month_rx = $month $year
  39. my_version_rx = 123\.456
  40. END
  41. cat > Makefile.am << 'END'
  42. include defs.am
  43. info_TEXINFOS = foo.texi
  44. test-grepinfo:
  45. ## Not useless uses of cat: we only tested that grep works on
  46. ## non-text input when that's given from a pipe.
  47. cat $(srcdir)/foo.info | grep 'GREPVERSION=$(my_version_rx)='
  48. cat $(srcdir)/foo.info | grep 'GREPEDITION=$(my_version_rx)='
  49. cat $(srcdir)/foo.info | grep 'GREPDATE=$(my_date_rx)='
  50. cat $(srcdir)/foo.info | grep 'GREPMONTH=$(my_month_rx)='
  51. test-distfiles:
  52. @echo DISTFILES = $(DISTFILES)
  53. echo ' ' $(DISTFILES) ' ' | grep '[ /]version.texi '
  54. test-distdir: distdir
  55. ls -l $(distdir)
  56. diff $(srcdir)/version.texi $(distdir)/version.texi
  57. .PHONY: test-grepinfo test-distfiles test-distdir
  58. check-local: test-grepinfo test-distfiles test-distdir
  59. END
  60. cat > foo.texi << 'END'
  61. \input texinfo
  62. @c %**start of header
  63. @setfilename foo.info
  64. @settitle Zardoz
  65. @c %**end of header
  66. @node Top
  67. @include version.texi
  68. GREPVERSION=@value{VERSION}=
  69. GREPEDITION=@value{EDITION}=
  70. GREPDATE=@value{UPDATED}=
  71. GREPMONTH=@value{UPDATED-MONTH}=
  72. @bye
  73. END
  74. $ACLOCAL
  75. $AUTOCONF
  76. $AUTOMAKE -a
  77. ./configure
  78. $MAKE all dvi
  79. # Debugging & sanity checks.
  80. ls -l
  81. cat version.texi
  82. cat foo.info
  83. test -f foo.dvi
  84. $MAKE test-grepinfo
  85. $MAKE test-distfiles
  86. $MAKE test-distdir
  87. $MAKE distcheck
  88. :