local.mk 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ## See sim/Makefile.am.
  2. ##
  3. ## Copyright (C) 1997-2022 Free Software Foundation, Inc.
  4. ##
  5. ## This program is free software; you can redistribute it and/or modify
  6. ## it under the terms of the GNU General Public License as published by
  7. ## the Free Software Foundation; either version 3 of the License, or
  8. ## (at your option) any later version.
  9. ##
  10. ## This program is distributed in the hope that it will be useful,
  11. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ## GNU General Public License for more details.
  14. ##
  15. ## You should have received a copy of the GNU General Public License
  16. ## along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ## Tweak the site.exp so it works with plain `runtest` from user.
  18. EXTRA_DEJAGNU_SITE_CONFIG = site-sim-config.exp
  19. # Custom verbose test variables that automake doesn't provide (yet?).
  20. AM_V_RUNTEST = $(AM_V_RUNTEST_@AM_V@)
  21. AM_V_RUNTEST_ = $(AM_V_RUNTEST_@AM_DEFAULT_V@)
  22. AM_V_RUNTEST_0 = @echo " RUNTEST $(RUNTESTFLAGS) $*";
  23. AM_V_RUNTEST_1 =
  24. site-sim-config.exp: Makefile
  25. $(AM_V_GEN)( \
  26. echo "set SIM_PRIMARY_TARGET \"$(SIM_PRIMARY_TARGET)\""; \
  27. echo "set builddir \"$(builddir)\""; \
  28. echo "set srcdir \"$(srcdir)/testsuite\""; \
  29. $(foreach V,$(SIM_TOOLCHAIN_VARS),echo "set $(V) \"$($(V))\"";) \
  30. ) > $@
  31. DO_RUNTEST = \
  32. LC_ALL=C; export LC_ALL; \
  33. EXPECT=${EXPECT} ; export EXPECT ; \
  34. runtest=$(RUNTEST); \
  35. $$runtest $(RUNTESTFLAGS)
  36. # Ignore dirs that only contain configuration settings.
  37. check/./config/%.exp: ; @true
  38. check/./lib/%.exp: ; @true
  39. check/%.exp:
  40. $(AM_V_at)mkdir -p testsuite/$*
  41. $(AM_V_RUNTEST)$(DO_RUNTEST) --objdir testsuite/$* --outdir testsuite/$* $*.exp
  42. check-DEJAGNU-parallel:
  43. $(AM_V_at)( \
  44. $(MAKE) -k \
  45. `cd $(srcdir)/testsuite && find . -name '*.exp' -printf 'check/%p '`; \
  46. ret=$$?; \
  47. $(SHELL) $(srcroot)/contrib/dg-extract-results.sh \
  48. `find testsuite/ -maxdepth 4 -name testrun.sum | sort` > testrun.sum; \
  49. $(SHELL) $(srcroot)/contrib/dg-extract-results.sh -L \
  50. `find testsuite/ -maxdepth 4 -name testrun.log | sort` > testrun.log; \
  51. echo; \
  52. $(SED) -n '/^.*===.*Summary.*===/,$$p' testrun.sum; \
  53. exit $$ret)
  54. check-DEJAGNU-single:
  55. $(AM_V_RUNTEST)$(DO_RUNTEST)
  56. # If running a single job, invoking runtest once is faster & has nicer output.
  57. check-DEJAGNU: site.exp
  58. $(AM_V_at)(set -e; \
  59. EXPECT=${EXPECT} ; export EXPECT ; \
  60. runtest=$(RUNTEST); \
  61. if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
  62. case "$(MAKEFLAGS)" in \
  63. *-j*) $(MAKE) check-DEJAGNU-parallel;; \
  64. *) $(MAKE) check-DEJAGNU-single;; \
  65. esac; \
  66. else \
  67. echo "WARNING: could not find \`runtest'" 1>&2; :;\
  68. fi)
  69. MOSTLYCLEANFILES += \
  70. site-sim-config.exp testrun.log testrun.sum
  71. include %D%/common/local.mk