self-check-explicit-skips.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. # Sanity check for the automake testsuite.
  17. # Check that our testsuite framework can be instructed not to consider
  18. # an early exit due to some command exiting unexpectedly with status 77.
  19. am_create_testdir=no
  20. . test-init.sh
  21. set +e
  22. unset am_explicit_skips stderr_fileno_
  23. # FIXME: this can be simplified when we improve our runtime checks on the
  24. # testsuite shell to ensure it supports "VAR=val shell_func" correctly.
  25. run_dummy_test ()
  26. {
  27. env $2 $AM_TEST_RUNNER_SHELL -c "
  28. am_create_testdir=no
  29. . test-init.sh
  30. $1
  31. " dummy.sh
  32. }
  33. run_dummy_test 'exit 77'
  34. test $? -eq 77 || exit 1
  35. run_dummy_test 'sh -c "exit 77"' am_explicit_skips=no
  36. test $? -eq 77 || exit 1
  37. run_dummy_test '$PERL -e "exit 77"; true' am_explicit_skips=yes
  38. test $? -eq 78 || exit 1
  39. run_dummy_test 'sh -c "exit 77"; exit 0' am_explicit_skips=y
  40. test $? -eq 78 || exit 1
  41. run_dummy_test 'skip_ "foo"; :' am_explicit_skips=y
  42. test $? -eq 77 || exit 1
  43. :