[cairo] [PATCH 2/2] build: Change make-cairo-test-constructors to use an input file

Rob Bradford rob at robster.org.uk
Tue Sep 27 07:41:18 PDT 2011


From: Rob Bradford <rob at linux.intel.com>

Previously this script would take all the files to use for the test on the
command line. However since the set of tests is too large for bash this script
has been changed to load the list of input files from a file.

To support this in the Makefile we must use a GNU extension to make to support
creating this file from the target list
---
 test/Makefile.am                     |    3 ++-
 test/make-cairo-test-constructors.sh |    9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 0a36780..5c5715a 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -76,7 +76,8 @@ noinst_PROGRAMS = cairo-test-suite$(EXEEXT) # always build
 TESTS += cairo-test-suite$(EXEEXT)
 
 cairo-test-constructors.c: Makefile $(test_sources) make-cairo-test-constructors.sh
-	(cd $(srcdir) && sh ./make-cairo-test-constructors.sh $(test_sources)) > $@
+	$(foreach test_source, $(test_sources), echo $(test_source) >> test-sources-tmp;)
+	(cd $(srcdir) && sh ./make-cairo-test-constructors.sh test-sources-tmp; rm test-sources-tmp) > $@
 
 cairo_test_suite_SOURCES = 		\
 	$(cairo_test_suite_sources)	\
diff --git a/test/make-cairo-test-constructors.sh b/test/make-cairo-test-constructors.sh
index cb1391e..638c24f 100644
--- a/test/make-cairo-test-constructors.sh
+++ b/test/make-cairo-test-constructors.sh
@@ -14,7 +14,10 @@ void _cairo_test_runner_register_tests (void);
 
 HERE
 
-cat "$@" |  sed '/^CAIRO_TEST/!d; s/CAIRO_TEST.*(\(.*\),.*/extern void _register_\1 (void);/'
+cat $1 | while read line; do
+ cat $line | sed '/^CAIRO_TEST/!d; s/CAIRO_TEST.*(\(.*\),.*/extern void _register_\1 (void);/'
+done
+
 cat <<HERE
 
 void
@@ -22,7 +25,9 @@ _cairo_test_runner_register_tests (void)
 {
 HERE
 
-cat "$@" |  sed '/^CAIRO_TEST/!d; s/CAIRO_TEST.*(\(.*\),.*/    _register_\1 ();/'
+cat $1 | while read line; do
+  cat $line |  sed '/^CAIRO_TEST/!d; s/CAIRO_TEST.*(\(.*\),.*/    _register_\1 ();/'
+done
 
 echo "}"
 
-- 
1.7.6.2



More information about the cairo mailing list