2
0

parallel-tests-exit-status-reported.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #! /bin/sh
  2. # Copyright (C) 2013-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. # The exit status of a test should be reported in the test logs, so
  17. # that one can see at a glance whether the test has succeeded or failed,
  18. # without having to look also into the corresponding .trs file.
  19. # See automake bug#11814.
  20. . test-init.sh
  21. echo AC_OUTPUT >> configure.ac
  22. echo XFAIL_TESTS = t3.test t00.test > Makefile.am
  23. echo TESTS = t00.test >> Makefile.am
  24. for s in 0 1 2 3 5 77 78 99 100 126 127; do
  25. echo "TESTS += t${s}.test" >> Makefile.am
  26. cat > t${s}.test <<END
  27. #!/bin/sh
  28. printf "%s\\n%s\\n" 'random' 'will exit with status $s'
  29. exit $s
  30. END
  31. done
  32. cp t0.test t00.test
  33. chmod a+x *.test
  34. $ACLOCAL
  35. $AUTOCONF
  36. $AUTOMAKE -a
  37. ./configure
  38. run_make -e FAIL check
  39. ls -l # For debugging.
  40. match_result ()
  41. {
  42. cat "$1.log" # For debugging.
  43. test $(wc -l <"$1.log") -eq 3
  44. sed -n '$p' "$1.log" | grep "^$2 $1\\.test (exit status: $3)$"
  45. }
  46. match_result t0 PASS 0
  47. match_result t00 XPASS 0
  48. match_result t1 FAIL 1
  49. match_result t2 FAIL 2
  50. match_result t3 XFAIL 3
  51. match_result t5 FAIL 5
  52. match_result t77 SKIP 77
  53. match_result t78 FAIL 78
  54. match_result t99 ERROR 99
  55. match_result t100 FAIL 100
  56. match_result t126 FAIL 126
  57. match_result t127 FAIL 127
  58. :