git » libfiu » commit 053239c

tests/utils: Fix broken dependency chain in Makefile

author Alberto Bertogli
2018-03-25 18:51:29 UTC
committer Alberto Bertogli
2018-03-25 18:51:29 UTC
parent bb09361e0761aaf0503132305d2e56d2cbfad5de

tests/utils: Fix broken dependency chain in Makefile

There is a bug in tests/utils/Makefile, where the tests themselves don't
depend on the target for their libraries.  The higher-level target "all"
(the default) does, and that's why it works under most circumstances.

However, a parallel build can fail because of this, as the ordering is
not guaranteed. For example, this causes it to break on my workstation:

  make clean; ( cd tests/utils; make clean); make; V=1 make -j 8 tests

This bug was found by the Debian build system (thanks!), see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=893049 for more
details.

So this patch fixes the problem by making the tests depend on the
appropriate targets.

tests/utils/Makefile +2 -2

diff --git a/tests/utils/Makefile b/tests/utils/Makefile
index fc78d2e..0c79bad 100644
--- a/tests/utils/Makefile
+++ b/tests/utils/Makefile
@@ -10,7 +10,7 @@ endif
 
 default: all
 
-all: lnlibs tests
+all: tests
 
 
 # Link the libraries to a single place, as the scripts expect.
@@ -34,7 +34,7 @@ SRCS := $(wildcard test-*)
 
 tests: $(patsubst %,run-%,$(SRCS))
 
-run-%: %
+run-%: % lnlibs
 	$(NICE_RUN) ./$< > output-$<.txt 2>&1