test-driver-acsubst.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. # parallel-tests:
  17. # - LOG_DRIVER variables can be AC_SUBST'd
  18. . test-init.sh
  19. mkdir test-drivers
  20. cp "$am_testaux_srcdir"/trivial-test-driver test-drivers/triv \
  21. || fatal_ "failed to fetch auxiliary script trivial-test-driver"
  22. cp "$am_scriptdir"/test-driver test-drivers/dflt \
  23. || fatal_ "failed to fetch auxiliary script test-driver"
  24. cat >> configure.ac <<'END'
  25. AC_SUBST([LOG_DRIVER], ['${SHELL} test-drivers/triv'])
  26. AC_SUBST([TEST_LOG_DRIVER], ['${SHELL} test-drivers/dflt'])
  27. AC_SUBST([SH_LOG_DRIVER], ['${my_drv}'])
  28. AC_OUTPUT
  29. END
  30. cat > Makefile.am <<'END'
  31. TEST_EXTENSIONS = .test .sh
  32. my_drv = $(SHELL) test-drivers/dflt
  33. TESTS = foo bar.test baz.sh
  34. XFAIL_TESTS = baz.sh
  35. .PHONY: check-autodefs
  36. check-autodefs:
  37. ### For debugging.
  38. @echo LOG_DRIVER = $(LOG_DRIVER)
  39. @echo TEST_LOG_DRIVER = $(TEST_LOG_DRIVER)
  40. @echo SH_LOG_DRIVER = $(SH_LOG_DRIVER)
  41. ### Checks here.
  42. @echo ' ' $(LOG_DRIVER) ' ' | grep ' test-drivers/triv '
  43. @echo ' ' $(TEST_LOG_DRIVER) ' ' | grep ' test-drivers/dflt '
  44. @echo ' ' $(SH_LOG_DRIVER) ' ' | grep ' test-drivers/dflt '
  45. END
  46. $ACLOCAL
  47. $AUTOMAKE
  48. $AUTOCONF
  49. ./configure
  50. cat > foo <<'END'
  51. #!/bin/sh
  52. echo "PASS: from $0"
  53. exit 1 # exit status should be ignored by the trivial-test-driver.
  54. END
  55. cat > bar.test <<'END'
  56. #!/bin/sh
  57. exit 77
  58. END
  59. cat > baz.sh <<'END'
  60. #!/bin/sh
  61. exit 1
  62. END
  63. chmod a+x foo bar.test baz.sh
  64. $MAKE check-autodefs
  65. run_make -O -e IGNORE check
  66. cat test-suite.log
  67. cat foo.log
  68. cat bar.log
  69. cat baz.log
  70. test $am_make_rc -eq 0
  71. count_test_results total=3 pass=1 fail=0 skip=1 xfail=1 xpass=0 error=0
  72. :