tap-deps.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. # Basic TAP test protocol support:
  17. # - dependencies between test scripts
  18. . test-init.sh
  19. cat > Makefile.am << 'END'
  20. # The tests are *deliberately* listed in inversed order here.
  21. TESTS = c.test b.test a.test
  22. b.log: a.log
  23. c.log: b.log
  24. END
  25. . tap-setup.sh
  26. cat > a.test << 'END'
  27. #!/bin/sh
  28. echo 1..2
  29. echo ok 1
  30. # Creative quoting below to please maintainer-check.
  31. sleep '3'
  32. echo ok 2
  33. : > a.run
  34. END
  35. cat > b.test << 'END'
  36. #!/bin/sh
  37. echo 1..2
  38. if test -f a.run; then
  39. echo ok 1
  40. else
  41. echo not ok 1
  42. fi
  43. # Creative quoting below to please maintainer-check.
  44. sleep '3'
  45. echo ok 2
  46. : > b.run
  47. END
  48. cat > c.test << 'END'
  49. #!/bin/sh
  50. echo 1..1
  51. test -f b.run || { echo 'Bail out!'; exit 1; }
  52. echo ok 1
  53. rm -f a.run b.run
  54. END
  55. chmod a+x *.test
  56. run_make -O check
  57. count_test_results total=5 pass=5 fail=0 xpass=0 xfail=0 skip=0 error=0
  58. cat > exp << 'END'
  59. PASS: a.test 1
  60. PASS: a.test 2
  61. PASS: b.test 1
  62. PASS: b.test 2
  63. PASS: c.test 1
  64. END
  65. grep ': [abc]\.test' stdout > got
  66. cat exp
  67. cat got
  68. diff exp got
  69. # TODO: it would be nice to also redo the checks forcing parallel make...
  70. :