dejagnu-relative-srcdir.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 DejaGnu testsuites have 'srcdir' defined to a relative path
  17. # (both as TCL variable and as environment variable).
  18. required=runtest
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_OUTPUT
  22. END
  23. cat > Makefile.am << 'END'
  24. AUTOMAKE_OPTIONS = dejagnu
  25. DEJATOOL = tcl env
  26. EXTRA_DIST = env.test/env.exp tcl.test/tcl.exp lib/tcl.exp
  27. END
  28. mkdir env.test tcl.test lib
  29. # DejaGnu can change $srcdir behind our backs, so we have to
  30. # save its original value. Thanks to Ian Lance Taylor for the
  31. # suggestion.
  32. cat > lib/tcl.exp << 'END'
  33. send_user "tcl_lib_srcdir: $srcdir\n"
  34. set orig_srcdir $srcdir
  35. END
  36. cat > env.test/env.exp << 'END'
  37. set env_srcdir $env(srcdir)
  38. send_user "env_srcdir: $env_srcdir\n"
  39. if { [ regexp "^\.(\./\.\.)?$" $env_srcdir ] } {
  40. pass "test_env_src"
  41. } else {
  42. fail "test_env_src"
  43. }
  44. END
  45. cat > tcl.test/tcl.exp << 'END'
  46. send_user "tcl_srcdir: $srcdir\n"
  47. if { [ regexp "^\.(\./\.\.)?$" $srcdir ] } {
  48. pass "test_tcl_src"
  49. } else {
  50. fail "test_tcl_src"
  51. }
  52. send_user "tcl_orig_srcdir: $orig_srcdir\n"
  53. if { [ regexp "^\.(\./\.\.)?$" $orig_srcdir ] } {
  54. pass "test_tcl_orig_src"
  55. } else {
  56. fail "test_tcl_orig_src"
  57. }
  58. END
  59. $ACLOCAL
  60. $AUTOCONF
  61. $AUTOMAKE --add-missing
  62. ./configure --srcdir=.
  63. $MAKE check
  64. # Sanity check: all tests have run.
  65. test -f env.log
  66. test -f env.sum
  67. test -f tcl.log
  68. test -f tcl.sum
  69. $MAKE distcheck
  70. :