diff mbox

timezone: fix parallel check failures

Message ID 1442599289-17404-1-git-send-email-vapier@gentoo.org
State Superseded
Delegated to: Mike Frysinger
Headers show

Commit Message

Mike Frysinger Sept. 18, 2015, 6:01 p.m. UTC
The XT testdata install rules expect the testdata dir to already exist in
the build tree, but it doesn't actually create it.  Instead, it relies on
the build-testdata define happening to be executed before it (which runs
zic which creates the dir).  When we run in parallel though, it's easy to
hit a failure:
$ cd timezone
$ rm -rf $objdir/timezone/testdata
$ make check -j
...
cp testdata/XT1 .../timezone/testdata/XT1
cp: cannot create regular file '.../timezone/testdata/XT1': No such file or directory
Makefile:116: recipe for target '.../timezone/testdata/XT1' failed
make: *** [.../timezone/testdata/XT1] Error 1
make: *** Waiting for unfinished jobs....

Add an explicit rule to create the dir to avoid all that.  Use an
order-only rule to avoid needlessly checking timestamps here.

2015-09-18  Mike Frysinger  <vapier@gentoo.org>

	* timezone/Makefile ($(testdata)): New rule.
	($(testdata)/XT%): Depend on $(testdata) (order only).
---
 timezone/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Roland McGrath Sept. 18, 2015, 6:11 p.m. UTC | #1
You you handle it via dependencies we have the %/ pattern rule
so all you need to do is make $(testdata)/ the dependency.
In other places we just use $(make-target-directory) as first command.
diff mbox

Patch

diff --git a/timezone/Makefile b/timezone/Makefile
index 81d4a3e..d1d9d4b 100644
--- a/timezone/Makefile
+++ b/timezone/Makefile
@@ -112,7 +112,9 @@  $(testdata)/America/Sao_Paulo: southamerica $(zic-deps)
 $(testdata)/Asia/Tokyo: asia $(zic-deps)
 	$(build-testdata)
 
-$(testdata)/XT%: testdata/XT%
+$(testdata):
+	mkdir -p $@
+$(testdata)/XT%: testdata/XT% | $(testdata)
 	cp $< $@
 
 $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make