[PATCH] Compile CuTest.c separately.

Andreas Metzler ametzler at downhill.at.eu.org
Fri Dec 23 05:25:58 PST 2011


Use regular compile and link instead of having #include "CuTest.c" in
every test. Works around gcc optimization issue.
---
 tests/Makefile.am      |   10 +++++++++-
 tests/conf-test.c      |    2 --
 tests/hash-test.c      |    2 --
 tests/pin-test.c       |    2 --
 tests/ptr-array-test.c |    2 --
 tests/test-init.c      |    2 --
 tests/uri-test.c       |    2 --
 7 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6015c1e..819b74a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -22,9 +22,17 @@ noinst_PROGRAMS = \
 	print-messages \
 	$(CHECK_PROGS)
 
+cutestfiles = cutest/CuTest.c cutest/CuTest.h
+
+conf_test_SOURCES = conf-test.c $(cutestfiles)
+hash_test_SOURCES = hash-test.c $(cutestfiles)
+pin_test_SOURCES = pin-test.c $(cutestfiles)
+ptr_array_test_SOURCES = ptr-array-test.c $(cutestfiles)
 test_init_SOURCES = \
 	test-init.c \
-	mock-module.c mock-module.h
+	mock-module.c mock-module.h $(cutestfiles)
+
+uri_test_SOURCES = uri-test.c $(cutestfiles)
 
 TESTS = $(CHECK_PROGS:=$(EXEEXT))
 
diff --git a/tests/conf-test.c b/tests/conf-test.c
index b86ffa7..df44fae 100644
--- a/tests/conf-test.c
+++ b/tests/conf-test.c
@@ -403,5 +403,3 @@ main (void)
 	CuStringDelete (output);
 	return ret;
 }
-
-#include "CuTest.c"
diff --git a/tests/hash-test.c b/tests/hash-test.c
index c1040cd..876088b 100644
--- a/tests/hash-test.c
+++ b/tests/hash-test.c
@@ -407,5 +407,3 @@ main (void)
 
 	return ret;
 }
-
-#include "CuTest.c"
diff --git a/tests/pin-test.c b/tests/pin-test.c
index f4cfd8d..0f6261f 100644
--- a/tests/pin-test.c
+++ b/tests/pin-test.c
@@ -295,5 +295,3 @@ main (void)
 
 	return ret;
 }
-
-#include "CuTest.c"
diff --git a/tests/ptr-array-test.c b/tests/ptr-array-test.c
index 4eca468..b75614f 100644
--- a/tests/ptr-array-test.c
+++ b/tests/ptr-array-test.c
@@ -255,5 +255,3 @@ main (void)
 
 	return ret;
 }
-
-#include "CuTest.c"
diff --git a/tests/test-init.c b/tests/test-init.c
index af07860..10790a8 100644
--- a/tests/test-init.c
+++ b/tests/test-init.c
@@ -251,5 +251,3 @@ main (void)
 
 	return ret;
 }
-
-#include "CuTest.c"
diff --git a/tests/uri-test.c b/tests/uri-test.c
index 0d57835..2012c0f 100644
--- a/tests/uri-test.c
+++ b/tests/uri-test.c
@@ -1211,5 +1211,3 @@ main (void)
 	CuStringDelete (output);
 	return ret;
 }
-
-#include "CuTest.c"
-- 
1.7.2.5


--Nq2Wo0NMKNjxTN9z--


More information about the p11-glue mailing list