Fix parallel build of test sources.
authorDiego Elio 'Flameeyes' Pettenò <flameeyes@gmail.com>
Sun, 13 Sep 2009 21:26:11 +0000 (23:26 +0200)
committerStef Walter <stef@memberwebs.com>
Sun, 13 Sep 2009 22:34:12 +0000 (22:34 +0000)
When building with make -jX with X greater than 1 (parallel make), if the
dependency tree given in the Makefile is not perfect, the build will fail.

Since the prep-gtest.sh generates two files, both should be listed in the
Makefile, with the latter depending on the former (in order of creation);
since the header file is generated slightly earlier than the source file,
this is the correct order (wrong order would work on most filesystems but
will fail on tmpfs, xfs and ext4).

Additionally, make sure to tell automake about the generated sources, the
BUILT_SOURCES variable will ensure that the dependencies inside the
generated source files will be taken properly care of.

Symptoms of the previous brokenness would look like missing includes,
because the run-(auto|prompt)-test.h header would be used _after_ the file
started being written but _before_ it was completely written (race
condition).

Additionally, in egg tests, avoid using BUILT_SOURCES to set up UNIT_AUTO,
and also append to it after test.make has been included, so that they won't
overwrite one the other.

Signed-off-by: Stef Walter <stef@memberwebs.com>
egg/tests/Makefile.am

index f490949..a7fa687 100644 (file)
@@ -1,7 +1,3 @@
-
-BUILT_SOURCES = \
-       asn1-def-test.h
-
 asn1-def-test.h: test.asn
        $(ASN1PARSER) -o asn1-def-test.h $(srcdir)/test.asn
 
@@ -14,7 +10,7 @@ UNIT_AUTO = \
        unit-test-secmem.c \
        unit-test-symkey.c \
        unit-test-openssl.c \
-       $(BUILT_SOURCES)
+       asn1-def-test.h
 
 UNIT_PROMPT =
 
@@ -26,3 +22,6 @@ EXTRA_DIST = \
        test-data
 
 include $(top_srcdir)/tests/gtest.make
+
+BUILT_SOURCES += \
+       asn1-def-test.h