test-trs-basic.sh 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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 harness features:
  17. # - creation and removal of '.trs' auxiliary files
  18. # - check some internals regarding the use of '.trs' files.
  19. . test-init.sh
  20. cat >> configure.ac <<END
  21. AC_OUTPUT
  22. END
  23. cat > Makefile.am << 'END'
  24. TEST_EXTENSIONS = .sh .test
  25. TESTS = foo.test bar.sh sub/zardoz.test
  26. TEST_LOG_COMPILER = $(SHELL)
  27. SH_LOG_COMPILER = $(SHELL)
  28. ## Used to check some internal details. And yes, the quotes around
  29. ## '$bases' are deliberate: they check for whitespace normalization.
  30. tb:
  31. $(am__set_TESTS_bases); echo "$$bases" > $@
  32. END
  33. cat > foo.test << 'END'
  34. #! /bin/sh
  35. exit $FOO_STATUS
  36. END
  37. : > bar.sh
  38. mkdir sub
  39. : > sub/zardoz.test
  40. FOO_STATUS=0; export FOO_STATUS
  41. $ACLOCAL
  42. $AUTOCONF
  43. $AUTOMAKE -a
  44. #
  45. # Check some internal details first.
  46. #
  47. for vpath in : false; do
  48. if $vpath; then
  49. srcdir=..
  50. mkdir build
  51. cd build
  52. else
  53. srcdir=.
  54. fi
  55. $srcdir/configure
  56. $MAKE tb
  57. test x"$(cat tb)" = x"foo bar sub/zardoz"
  58. rm -f tb
  59. # Please don't change the order of the stuff in TESTS, below.
  60. run_make TESTS='foo.test foo2.sh foo-log foolog.test a.log.b.sh 0.exe' tb
  61. test x"$(cat tb)" = x"foo foo2 foo-log foolog a.log.b 0.exe"
  62. rm -f tb
  63. cd $srcdir
  64. done
  65. #
  66. # The 'test-suite.stamp' file and the '.trs' files get created by
  67. # "make check" and removed by "make clean" and "make mostlyclean".
  68. #
  69. : > unrelated.trs
  70. : > sub/foo.trs
  71. $MAKE check
  72. test -f foo.trs
  73. test -f bar.trs
  74. test -f sub/zardoz.trs
  75. $MAKE clean
  76. test ! -e foo.trs
  77. test ! -e bar.trs
  78. test ! -e sub/zardoz.trs
  79. # Unrelated '.trs' files shouldn't be removed.
  80. test -f unrelated.trs
  81. test -f sub/foo.trs
  82. # The files should be properly created in case of testsuite failure too.
  83. FOO_STATUS=1 $MAKE check && exit 1
  84. test -f foo.trs
  85. test -f bar.trs
  86. test -f sub/zardoz.trs
  87. $MAKE mostlyclean
  88. test ! -e foo.trs
  89. test ! -e bar.trs
  90. test ! -e sub/zardoz.trs
  91. # Unrelated '.trs' files shouldn't be removed.
  92. test -f unrelated.trs
  93. test -f sub/foo.trs
  94. #
  95. # Try with a subset of TESTS.
  96. #
  97. run_make TESTS=foo.test check
  98. test -f foo.trs
  99. test ! -e bar.trs
  100. test ! -e sub/zardoz.trs
  101. $MAKE clean
  102. test ! -e foo.trs
  103. run_make TESTS='foo.test bar.sh' check
  104. test -f foo.trs
  105. test -f bar.trs
  106. test ! -e sub/zardoz.trs
  107. # "make clean" shouldn't remove '.trs' files for tests not in $(TESTS).
  108. run_make TESTS=bar.sh clean
  109. test -f foo.trs
  110. test ! -e bar.trs
  111. $MAKE clean
  112. #
  113. # Try with a subset of TEST_LOGS.
  114. #
  115. run_make TEST_LOGS=sub/zardoz.log check
  116. test ! -e foo.trs
  117. test ! -e bar.trs
  118. test -f sub/zardoz.trs
  119. $MAKE clean
  120. test ! -e sub/zardoz.trs
  121. run_make TEST_LOGS='foo.log bar.log' check
  122. test -f foo.trs
  123. test -f bar.trs
  124. test ! -e sub/zardoz.trs
  125. # "make clean" shouldn't remove '.trs' files for tests whose log
  126. # is not in $(TEST_LOGS).
  127. run_make TEST_LOGS=foo.log clean
  128. test ! -e foo.trs
  129. test -f bar.trs
  130. test ! -e sub/zardoz.trs
  131. :