check8.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #! /bin/sh
  2. # Copyright (C) 2008-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 subdir TESTS.
  17. # For gen-testsuite-part: ==> try-with-serial-tests <==
  18. required='cc native'
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_PROG_CC
  22. AC_OUTPUT
  23. END
  24. cat > Makefile.am << 'END'
  25. AUTOMAKE_OPTIONS = subdir-objects
  26. TESTS = foo sub/foo $(check_PROGRAMS)
  27. XFAIL_TESTS = foo sub/baz
  28. check_PROGRAMS = bar sub/bar baz sub/baz
  29. END
  30. mkdir sub
  31. cat > foo <<'END'
  32. #! /bin/sh
  33. test -f "$srcdir/Makefile.am"
  34. END
  35. cat > sub/foo <<'END'
  36. #! /bin/sh
  37. test -f "$srcdir/Makefile.am"
  38. END
  39. chmod a+x foo sub/foo
  40. cat > bar.c <<'END'
  41. int main (void) { return 0; }
  42. END
  43. cat > sub/bar.c <<'END'
  44. int main (void) { return 0; }
  45. END
  46. cat > baz.c <<'END'
  47. #include <stdlib.h>
  48. int main (void) { return EXIT_FAILURE; }
  49. END
  50. cat > sub/baz.c <<'END'
  51. #include <stdlib.h>
  52. int main (void) { return EXIT_FAILURE; }
  53. END
  54. $ACLOCAL
  55. $AUTOCONF
  56. $AUTOMAKE -a
  57. ./configure
  58. run_make -E -O -e FAIL check
  59. grep 'XPASS.* foo$' stdout
  60. grep '^[^X]*PASS.* sub/foo$' stdout
  61. grep '^[^X]*PASS.* bar' stdout
  62. grep '^[^X]*PASS.* sub/bar' stdout
  63. grep '^[^X]*FAIL.* baz' stdout
  64. grep 'XFAIL.* sub/baz' stdout
  65. # The parallel test driver should cause circular dependencies.
  66. # Look for known warnings from a couple of 'make' implementations.
  67. grep -i 'circular.*dependency' stderr && exit 1
  68. grep -i 'graph cycles' stderr && exit 1
  69. $MAKE distclean
  70. mkdir build
  71. cd build
  72. ../configure
  73. run_make -O -e FAIL check
  74. # Note: we are not grepping for the space in the lines from the 'foo'
  75. # tests, due to the Solaris make VPATH rewriting (if we fix that, we
  76. # can still write a separate test for it).
  77. grep 'XPASS.*foo$' stdout
  78. grep '^[^X]*PASS.*sub/foo$' stdout
  79. grep '^[^X]*PASS.* bar' stdout
  80. grep '^[^X]*PASS.* sub/bar' stdout
  81. grep '^[^X]*FAIL.* baz' stdout
  82. grep 'XFAIL.* sub/baz' stdout
  83. :