check-exported-srcdir.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 testsuite driver (either with or without the
  17. # serial-tests option enabled) exports the 'srcdir' value in the
  18. # environment of the tests. This is documented in the manual.
  19. # For gen-testsuite-part: ==> try-with-serial-tests <==
  20. . test-init.sh
  21. show_info ()
  22. {
  23. if test x"$am_serial_tests" != x"yes"; then
  24. cat foo.log
  25. cat test-suite.log
  26. else
  27. :
  28. fi
  29. }
  30. mkdir SrcDir
  31. mv [!S]* SrcDir
  32. mkdir BuildDir
  33. cd SrcDir
  34. cat >> configure.ac << 'END'
  35. AC_OUTPUT
  36. END
  37. cat > Makefile.am << 'END'
  38. TESTS = foo.test
  39. END
  40. cat > foo.test <<'END'
  41. #!/bin/sh
  42. echo "foo.test: srcdir='$srcdir'"
  43. test x"$srcdir" = x"../SrcDir"
  44. END
  45. chmod a+x foo.test
  46. $ACLOCAL
  47. $AUTOCONF
  48. $AUTOMAKE -a
  49. cd ../BuildDir
  50. ../SrcDir/configure
  51. $MAKE check || { show_info; exit 1; }
  52. show_info
  53. :