2
0

parallel-tests-log-override-1.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 parallel-tests features: runtime redefinition of $(TEST_SUITE_LOG).
  17. . test-init.sh
  18. cat >> configure.ac <<'END'
  19. AC_OUTPUT
  20. END
  21. cat > Makefile.am <<'END'
  22. TESTS = pass.test skip.test xfail.test
  23. XFAIL_TESTS = xfail.test
  24. EXTRA_DIST = $(TESTS)
  25. END
  26. cat > pass.test <<'END'
  27. #! /bin/sh
  28. exit 0
  29. END
  30. cat > skip.test <<'END'
  31. #! /bin/sh
  32. echo "% test skipped %"
  33. exit 77
  34. END
  35. cat > xfail.test <<'END'
  36. #! /bin/sh
  37. echo "# expected failure #"
  38. exit 1
  39. END
  40. chmod a+x *.test
  41. test_log_edit ()
  42. {
  43. sed -e "s|^ *$me 1\.0:.*$| $me 1.0: ???|" \
  44. -e "s|^=====*|=======================|" $*
  45. }
  46. test_log_expected ()
  47. {
  48. test_log_edit orig > exp
  49. test_log_edit $1 > got
  50. diff exp got || exit 1
  51. rm -f exp got
  52. }
  53. $ACLOCAL
  54. $AUTOCONF
  55. $AUTOMAKE -a
  56. ./configure
  57. $MAKE check
  58. ls -l
  59. cat test-suite.log
  60. cp test-suite.log orig
  61. $MAKE clean
  62. test -f test-suite.log && exit 99 # Sanity check.
  63. # Check that we can override the testsuite log file at runtime.
  64. run_make TEST_SUITE_LOG=zardoz.log check
  65. ls -l
  66. test ! -e test-suite.log
  67. cat zardoz.log
  68. test_log_expected zardoz.log
  69. # Sanity check the distribution too (this also does minimal checks on
  70. # VPATH support).
  71. run_make TEST_SUITE_LOG=zardoz.log distcheck
  72. # Check that cleanup rules remove the correct file even when
  73. # user overrides are in place.
  74. cp orig test-suite.log
  75. run_make TEST_SUITE_LOG=zardoz.log clean
  76. ls -l
  77. test ! -e zardoz.log
  78. diff orig test-suite.log
  79. # Check that the default testsuite log doesn't get unduly modified.
  80. # Also check that the testsuite log file doesn't need to be named
  81. # accordingly to the '*.log' pattern.
  82. chmod a-w test-suite.log
  83. run_make TEST_SUITE_LOG=TheLogFile check
  84. ls -l
  85. diff orig test-suite.log
  86. test_log_expected TheLogFile
  87. run_make TEST_SUITE_LOG=TheLogFile clean
  88. ls -l
  89. test ! -e TheLogFile
  90. diff orig test-suite.log
  91. :