parallel-tests-dry-run-1.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #! /bin/sh
  2. # Copyright (C) 2012-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 interactions between the parallel test harness and "make -n".
  17. # See also sister test 'parallel-tests-dry-run-2.sh'.
  18. . test-init.sh
  19. echo AC_OUTPUT >> configure.ac
  20. cat > Makefile.am <<'END'
  21. TESTS = foo.test bar.test
  22. $(TESTS):
  23. END
  24. $ACLOCAL
  25. $AUTOCONF
  26. $AUTOMAKE -a
  27. ./configure
  28. # Avoid confusion with test logs.
  29. rm -f config.log
  30. log_files='test-suite.log foo.log bar.log'
  31. all_exist ()
  32. {
  33. st=0
  34. for i in $*; do
  35. test -f $i || { echo File $i not found; st=1; }
  36. done
  37. test $st -eq 0
  38. }
  39. none_exist ()
  40. {
  41. st=0
  42. for i in $*; do
  43. if test -r $i || test -f $i; then
  44. echo File $i found
  45. st=1
  46. fi
  47. done
  48. test $st -eq 0
  49. }
  50. for targ in check recheck $log_files; do
  51. $MAKE -n "$targ"
  52. none_exist $log_files
  53. done
  54. touch $log_files
  55. $MAKE -n mostlyclean
  56. all_exist $log_files
  57. $MAKE -n clean
  58. all_exist $log_files
  59. cat > foo.test <<'END'
  60. #! /bin/sh
  61. exit 0
  62. END
  63. cat > bar.test <<'END'
  64. #! /bin/sh
  65. exit 1
  66. END
  67. chmod a+x foo.test bar.test
  68. $MAKE check && exit 1
  69. for targ in recheck clean mostlyclean distclean; do
  70. $MAKE -n "$targ"
  71. all_exist $log_files
  72. done
  73. :