[gnome-keyring] Fix parallel build of test sources.



commit 94f87d6fb174c9c5604f9462c93c354310e14dc4
Author: Diego Elio 'Flameeyes' Pettenò <flameeyes gmail com>
Date:   Sun Sep 13 23:26:11 2009 +0200

    Fix parallel build of test sources.
    
    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        |   11 +++++------
 pkcs11/gck/tests/Makefile.am |   15 ++++++---------
 tests/gtest.make             |   14 ++++++++++++--
 3 files changed, 23 insertions(+), 17 deletions(-)
---
diff --git a/egg/tests/Makefile.am b/egg/tests/Makefile.am
index f421882..b9b490e 100644
--- a/egg/tests/Makefile.am
+++ b/egg/tests/Makefile.am
@@ -1,10 +1,6 @@
-
-BUILT_SOURCES = \
-	asn1-def-test.h
-
 asn1-def-test.h: test.asn
 	$(ASN1PARSER) -o asn1-def-test.h $(srcdir)/test.asn 
-	
+
 # Test files should be listed in order they need to run
 UNIT_AUTO = \
 	unit-test-asn1.c \
@@ -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
diff --git a/pkcs11/gck/tests/Makefile.am b/pkcs11/gck/tests/Makefile.am
index 96fe68e..f6abe15 100644
--- a/pkcs11/gck/tests/Makefile.am
+++ b/pkcs11/gck/tests/Makefile.am
@@ -1,10 +1,7 @@
 
-BUILT_SOURCES = \
-	asn1-def-test.h
-
 asn1-def-test.h: test.asn
-	$(ASN1PARSER) -o asn1-def-test.h $(srcdir)/test.asn 
-	
+	$(ASN1PARSER) -o asn1-def-test.h $(srcdir)/test.asn
+
 # Test files should be listed in order they need to run
 UNIT_AUTO = \
 	unit-test-attributes.c \
@@ -22,9 +19,9 @@ UNIT_AUTO = \
 	unit-test-file-tracker.c \
 	mock-locked-object.c mock-locked-object.h \
 	test-module.c test-module.h \
-	$(BUILT_SOURCES)
+	asn1-def-test.h
 
-UNIT_PROMPT = 
+UNIT_PROMPT =
 
 UNIT_LIBS =  \
 	$(top_builddir)/pkcs11/gck/libgck.la \
@@ -43,9 +40,9 @@ noinst_PROGRAMS += \
 
 dump_data_file_SOURCES = \
 	dump-data-file.c
-	
+
 dump_data_file_LDADD = \
 	$(top_builddir)/pkcs11/gck/libgck.la \
 	$(top_builddir)/egg/libegg.la \
 	$(DAEMON_LIBS)
-	
\ No newline at end of file
+
diff --git a/tests/gtest.make b/tests/gtest.make
index 6f420f9..faffd42 100644
--- a/tests/gtest.make
+++ b/tests/gtest.make
@@ -23,9 +23,11 @@ noinst_PROGRAMS= \
 	run-auto-test \
 	run-prompt-test
 		
-run-auto-test.c: $(UNIT_AUTO) Makefile.am $(top_srcdir)/tests/prep-gtest.sh
+run-auto-test.h: $(UNIT_AUTO) Makefile.am $(top_srcdir)/tests/prep-gtest.sh
 	sh $(top_srcdir)/tests/prep-gtest.sh -b run-auto-test $(UNIT_AUTO)
 
+run-auto-test.c: run-auto-test.h
+
 run_auto_test_SOURCES = \
 	run-auto-test.c run-auto-test.h \
 	$(UNIT_AUTO)
@@ -37,9 +39,11 @@ run_auto_test_LDADD = \
 run_auto_test_CFLAGS = \
 	$(UNIT_FLAGS)
 
-run-prompt-test.c: $(UNIT_PROMPT) Makefile.am $(top_srcdir)/tests/prep-gtest.sh
+run-prompt-test.h: $(UNIT_PROMPT) Makefile.am $(top_srcdir)/tests/prep-gtest.sh
 	sh $(top_srcdir)/tests/prep-gtest.sh -b run-prompt-test $(UNIT_PROMPT)
 
+run-prompt-test.c: run-prompt-test.h
+
 run_prompt_test_SOURCES = \
 	run-prompt-test.c \
 	run-prompt-test.h \
@@ -52,6 +56,12 @@ run_prompt_test_LDADD = \
 run_prompt_test_CFLAGS = \
 	$(UNIT_FLAGS)
 
+BUILT_SOURCES = \
+	run-auto-test.c \
+	run-auto-test.h \
+	run-prompt-test.c \
+	run-prompt-test.h
+
 # ------------------------------------------------------------------------------
 # Run the tests
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]