[gegl] Use generated func names directly for test output



commit fe580d5bfeae68eabaf26aec5b88d4a9750db523
Author: Danny Robson <danny blubinc net>
Date:   Wed May 19 16:05:48 2010 +1000

    Use generated func names directly for test output
    
    G_STRFUNC can produce slightly different output on each compiler, eg
    function names under GCC, and full function signatures on clang.
    
    Instead of using G_STRFUNC for output, we store the generated function
    name from buffer-tests.inc in a macro for each test and print that.

 tests/buffer/Makefile.am   |    4 +++-
 tests/buffer/buffer-test.c |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/tests/buffer/Makefile.am b/tests/buffer/Makefile.am
index f5ef9e7..53dd629 100644
--- a/tests/buffer/Makefile.am
+++ b/tests/buffer/Makefile.am
@@ -29,8 +29,10 @@ buffer-tests.inc: $(buffer_test_SOURCES) Makefile.am $(top_srcdir)/tests/buffer/
 	@echo 'Generating $@'
 	@echo '/* this file is generated by the build system */' > $@
 	@for TEST in  `ls tests/*.c |sed -e s:tests/:: -e s:\\\.c::`; do \
-	     echo "#define TEST() static gchar * $$TEST (void)" >> $@;\
+             echo "#define TESTNAME $$TEST" >> $@;\
+	     echo "#define TEST() static gchar * TESTNAME (void)" >> $@;\
 	     echo "#include \"tests/"$$TEST".c\"" >> $@;\
+	     echo "#undef TESTNAME" >> $@;\
 	     echo "#undef TEST" >> $@;\
 	done;
 	@echo 'typedef gchar *(*TestFunc) ();TestFunc tests[]={' >> $@
diff --git a/tests/buffer/buffer-test.c b/tests/buffer/buffer-test.c
index 8e68731..b3913b4 100644
--- a/tests/buffer/buffer-test.c
+++ b/tests/buffer/buffer-test.c
@@ -26,7 +26,7 @@
  */
 
 #define test_start()              GString *gstring=g_string_new("");\
-                                  print (("Test: %s\n", G_STRFUNC))
+                                  print (("Test: %s\n", G_STRINGIFY (TESTNAME)))
 #define print(args)		  G_STMT_START {		\
 	gchar *_fmt = g_strdup_printf args;			\
 	g_string_append (gstring, _fmt);			\



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