parallel-tests-log-compiler-2.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #! /bin/sh
  2. # Copyright (C) 2009-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 parallel-tests features:
  17. # - per-extension "test runners" a.k.a. "log compilers" (xxx_LOG_COMPILER
  18. # and xxx_LOG_FLAGS), when some tests are PROGRAMS.
  19. # See also related test 'parallel-tests-log-compiler-1.sh'.
  20. required='cc native'
  21. . test-init.sh
  22. cat >> configure.ac << 'END'
  23. AC_PROG_CC
  24. AC_OUTPUT
  25. END
  26. cat > Makefile.am << 'END'
  27. ## Note that automake should not match the '/test' part
  28. ## of 'sub/test' as '.test' suffix.
  29. TESTS = foo.chk bar.test $(check_PROGRAMS) sub/test
  30. check_PROGRAMS = baz bla.test bli.suff
  31. TEST_EXTENSIONS = .chk .test
  32. CHK_LOG_COMPILER = ./chk-compiler
  33. TEST_LOG_COMPILER = ./test-compiler
  34. LOG_COMPILER = ./noext-compiler
  35. AM_CHK_LOG_FLAGS = 1
  36. CHK_LOG_FLAGS = 2
  37. AM_TEST_LOG_FLAGS = 3
  38. TEST_LOG_FLAGS = 4
  39. AM_LOG_FLAGS = 5
  40. LOG_FLAGS = 6
  41. END
  42. mkdir sub
  43. cat >chk-compiler <<'END'
  44. #! /bin/sh
  45. echo $0 "$@"
  46. shift
  47. shift
  48. exec "$@"
  49. exit 127
  50. END
  51. chmod a+x chk-compiler
  52. cp chk-compiler test-compiler
  53. cp chk-compiler noext-compiler
  54. cat >foo.chk << 'END'
  55. #! /bin/sh
  56. exit 0
  57. END
  58. chmod a+x foo.chk
  59. cp foo.chk bar.test
  60. cp foo.chk sub/test
  61. cat >baz.c << 'END'
  62. int main (void)
  63. {
  64. return 0;
  65. }
  66. END
  67. cp baz.c bla.c
  68. cp baz.c bli.c
  69. $ACLOCAL
  70. $AUTOCONF
  71. $AUTOMAKE -a
  72. ./configure
  73. $MAKE
  74. $MAKE check || { cat test-suite.log; exit 1; }
  75. ls -l . sub
  76. cat test-suite.log
  77. grep 'chk-compiler *1 *2' foo.log
  78. grep 'test-compiler *3 *4' bar.log
  79. grep 'noext-compiler *5 *6' baz.log
  80. grep 'test-compiler *3 *4' bla.log
  81. grep 'noext-compiler *5 *6' bli.suff.log
  82. grep 'noext-compiler *5 *6' sub/test.log
  83. :