test-driver-strip-vpath.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. # Custom test drivers: check that the test name passed to the test
  17. # driver has any VPATH prefix stripped.
  18. . test-init.sh
  19. ocwd=$(pwd) || fatal_ "cannot get current working directory"
  20. mkdir src build
  21. mv install-sh missing configure.ac src
  22. rm -f depcomp
  23. cd src
  24. cat >> configure.ac << 'END'
  25. AC_OUTPUT
  26. END
  27. cat > Makefile.am << 'END'
  28. # The directories of the 'bar.test' and 'baz.test' tests are deliberately
  29. # called as the source directory, to verify that the VPATH-stripping code
  30. # doesn't get too easily confused.
  31. # The $(empty) are for eliciting VPATH rewrites on make implementations
  32. # that support it (e.g., Solaris make), to improve coverage.
  33. empty =
  34. TESTS = $(empty) foo.test src/bar.test ./src/baz.test $(empty)
  35. $(TESTS):
  36. TEST_LOG_DRIVER = $(srcdir)/checkstrip-driver
  37. EXTRA_DIST = checkstrip-driver
  38. END
  39. cat > checkstrip-driver <<'END'
  40. #! /bin/sh
  41. set -e
  42. while test $# -gt 0; do
  43. case $1 in
  44. --log-file) log_file=$2; shift;;
  45. --trs-file) trs_file=$2; shift;;
  46. --test-name) test_name=$2; shift;;
  47. --expect-failure|--color-tests|--enable-hard-errors) shift;;
  48. --) shift; break;;
  49. *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
  50. esac
  51. shift
  52. done
  53. echo "test name: $test_name" # For debugging.
  54. case $test_name in
  55. foo.test|./foo.test|src/ba[rz].test|./src/ba[rz].test);;
  56. *) exit 1;;
  57. esac
  58. echo dummy > "$log_file"
  59. echo dummy > "$trs_file"
  60. END
  61. chmod a+x checkstrip-driver
  62. $ACLOCAL
  63. $AUTOCONF
  64. $AUTOMAKE
  65. cd ..
  66. mkdir build1
  67. cd build1
  68. ../src/configure
  69. # "$MAKE -n" is for debugging, should highlight any VPATH rewrite.
  70. $MAKE -n check || :
  71. $MAKE check
  72. cd ..
  73. mkdir build2
  74. cd build2
  75. "$ocwd"/src/configure
  76. # "$MAKE -n" is for debugging, should highlight any VPATH rewrite.
  77. $MAKE -n check || :
  78. $MAKE check
  79. cd ..
  80. cd src
  81. ./configure
  82. $MAKE distcheck
  83. :