parallel-tests-unreadable.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 that the testsuite driver copes well with unreadable '.log'
  17. # and '.trs' files.
  18. . test-init.sh
  19. : > t
  20. chmod a-r t && test ! -r t || skip_ "you can still read unreadable files"
  21. rm -f t
  22. cat >> configure.ac << 'END'
  23. AC_OUTPUT
  24. END
  25. cat > Makefile.am << 'END'
  26. TESTS = foo.test bar.test
  27. END
  28. cat > foo.test << 'END'
  29. #! /bin/sh
  30. echo foofoofoo
  31. exit 0
  32. END
  33. cat > bar.test << 'END'
  34. #! /bin/sh
  35. echo barbarbar
  36. exit 77
  37. END
  38. chmod a+x foo.test bar.test
  39. $ACLOCAL
  40. $AUTOCONF
  41. $AUTOMAKE -a
  42. ./configure
  43. for files in \
  44. 'foo.log bar.log' \
  45. 'foo.trs bar.trs' \
  46. 'foo.trs bar.log' \
  47. 'foo.log bar.trs' \
  48. ; do
  49. $MAKE check
  50. rm -f test-suite.log
  51. chmod a-r $files
  52. $MAKE test-suite.log || { ls -l; exit 1; }
  53. ls -l
  54. grep '^foofoofoo$' foo.log
  55. grep '^:test-result: PASS' foo.trs
  56. grep '^barbarbar$' bar.log
  57. grep '^:test-result: SKIP' bar.trs
  58. grep '^SKIP: bar' test-suite.log
  59. grep '^barbarbar$' test-suite.log
  60. $EGREP ':.*foo|foofoofoo' test-suite.log && exit 1
  61. : For shells with busted 'set -e'.
  62. done
  63. :