parallel-tests-console-output.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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: some checks on console output about testsuite
  17. # progress.
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_OUTPUT
  21. END
  22. cat > Makefile.am << 'END'
  23. XFAIL_TESTS = sub/xpass.test xfail.test error.test
  24. TESTS = $(XFAIL_TESTS) fail.test pass.test a/b/skip.test sub/error2.test
  25. pass.log: fail.log
  26. error.log: pass.log
  27. sub/xpass.log: error.log
  28. sub/error2.log: xfail.log
  29. a/b/skip.log: sub/error2.log
  30. END
  31. cat > exp <<'END'
  32. FAIL: fail.test
  33. PASS: pass.test
  34. ERROR: error.test
  35. XPASS: sub/xpass.test
  36. XFAIL: xfail.test
  37. ERROR: sub/error2.test
  38. SKIP: a/b/skip.test
  39. END
  40. mkdir sub a a/b
  41. cat > pass.test << 'END'
  42. #!/bin/sh
  43. exit 0
  44. END
  45. cp pass.test sub/xpass.test
  46. cat > fail.test << 'END'
  47. #!/bin/sh
  48. exit 1
  49. END
  50. cat > xfail.test << 'END'
  51. #!/bin/sh
  52. # The sleep should ensure expected execution order of tests
  53. # even when make is run in parallel mode.
  54. # Creative quoting below to plase maintainer-check.
  55. sleep '10'
  56. exit 1
  57. END
  58. cat > error.test << 'END'
  59. #!/bin/sh
  60. exit 99
  61. END
  62. cp error.test sub/error2.test
  63. cat > a/b/skip.test << 'END'
  64. #!/bin/sh
  65. exit 77
  66. END
  67. chmod a+x pass.test fail.test xfail.test sub/xpass.test \
  68. a/b/skip.test error.test sub/error2.test
  69. $ACLOCAL
  70. $AUTOCONF
  71. $AUTOMAKE -a
  72. for vpath in : false; do
  73. if $vpath; then
  74. mkdir build
  75. cd build
  76. srcdir=..
  77. else
  78. srcdir=.
  79. fi
  80. $srcdir/configure
  81. run_make -O -e FAIL check
  82. LC_ALL=C grep '^[A-Z][A-Z]*:' stdout > got
  83. cat got
  84. diff $srcdir/exp got
  85. cd $srcdir
  86. done
  87. :