Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around automake bug related to recheck #475

Merged
merged 1 commit into from
Apr 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,40 @@ etags:
cd $(srcdir)/tools/ir-generator; ctags -e -R --langmap=Flex:+.l,YACC:+.ypp \
. ../../lib

# XXX(seth): automake as of version 1.15 has a bug that makes "recheck" interact
# very badly with parallel make.
#
# Here's the background: there are two "top-level" targets in an automake-based
# makefile: "all", and "all-am". A very important difference between them is
# that "all" *spawns a second copy of make*, while "all-am" does not. This means
# that depending on "all" is dangerous: if a rule depends on "all", but
# also depends on other targets directly, the two copies of make can end up
# racing to build those targets, resulting in corrupted artifacts and build
# failures.
#
# So how does this tie into the "recheck" target? The rule that automake
# generates depends on "all", *not* on "all-am". This is unlike other
# automake-generated targets (e.g. "check" or "install"), which correctly depend
# on "all-am", so I'm not sure how things went wrong for "recheck". This bad
# rule was causing "recheck" builds to fail frequently if they were built in
# parallel.
#
# Unfortunately, there's no easy way to override "recheck" and just change which
# targets it depends on, so to resolve this I've been forced to copy the entire
# automake-generated rule. The only difference is that "all" has been replaced
# with "all-am".
recheck: all-am $(check_LTLIBRARIES) $(check_PROGRAMS)
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@set +e; $(am__set_TESTS_bases); \
bases=`for i in $$bases; do echo $$i; done \
| $(am__list_recheck_tests)` || exit 1; \
log_list=`for i in $$bases; do echo $$i.log; done`; \
log_list=`echo $$log_list`; \
$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
am__force_recheck=am--force-recheck \
TEST_LOGS="$$log_list"; \
exit $$?

check-%:
@$(MAKE) check TESTS="$(filter $*/%, $(TESTS) $(EXTRA_TESTS))"

Expand Down