test_start() uses G_STRFUNC to determine function name
Forums ► For GEGL developers (read-only) ► test_start() uses G_STRFUNC to determine function name
-
Albert Chin
(about 2 years ago)
- Martin Nordholts (about 2 years ago)
Sent: 2009-11-29 17:17:55 UTC (about 2 years ago)
From: Albert Chin
test_start() uses G_STRFUNC to determine function name
tests/buffer/buffer-test.c uses G_STRFUNC to print the name of the test
function. However, this assumes the compiler supports
__PRETTY_FUNCTION__ or __func__. If it doesn't, then test output is
prepended with:
Test: ???This basically causes the diff comparison to fail for most non-GCC
compilers. Patch attached to fix this by manually adding the function
name. Yeah, ugly, but I can't see an easier way to fix this.--
albert chin (china@thewrittenword.com)Index: tests/buffer/buffer-test.c
===================================================================
--- tests/buffer/buffer-test.c.orig 2009-06-17 20:01:33.000000000 +0000
+++ tests/buffer/buffer-test.c 2009-11-29 15:40:16.115468554 +0000
@@ -25,8 +25,8 @@
* rendering.
*/
-#define test_start() GString *gstring=g_string_new("");\
- print (("Test: %s\n", G_STRFUNC))
+#define test_start(arg) GString *gstring=g_string_new("");\
+ print (("Test: %s\n", arg))
#define print(args) G_STMT_START { \
gchar *_fmt = g_strdup_printf args; \
g_string_append (gstring, _fmt); \
Index: tests/buffer/tests/buffer_shift_diagonal.c
===================================================================
--- tests/buffer/tests/buffer_shift_diagonal.c.orig 2009-04-17 17:15:11.000000000 +0000
+++ tests/buffer/tests/buffer_shift_diagonal.c 2009-11-29 15:40:39.224892970 +0000
@@ -3,7 +3,7 @@
GeglBuffer *buffer, *sub, *subsub;
GeglRectangle subrect = {5, 5, 10, 10};
GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
+ test_start ("buffer_shift_diagonal");
buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
sub = gegl_buffer_create_sub_buffer (buffer, &subrect);
Index: tests/buffer/tests/buffer_shift_horizontal.c
===================================================================
--- tests/buffer/tests/buffer_shift_horizontal.c.orig 2009-04-17 17:15:11.000000000 +0000
+++ tests/buffer/tests/buffer_shift_horizontal.c 2009-11-29 15:40:48.991496841 +0000
@@ -3,7 +3,7 @@
GeglBuffer *buffer, *sub, *subsub;
GeglRectangle subrect = {5, 5, 10, 10};
GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
+ test_start ("buffer_shift_horizontal");
buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
sub = gegl_buffer_create_sub_buffer (buffer, &subrect);
Index: tests/buffer/tests/buffer_shift_vertical.c
===================================================================
--- tests/buffer/tests/buffer_shift_vertical.c.orig 2009-04-17 17:15:11.000000000 +0000
+++ tests/buffer/tests/buffer_shift_vertical.c 2009-11-29 15:40:58.951643321 +0000
@@ -3,7 +3,7 @@
GeglBuffer *buffer, *sub, *subsub;
GeglRectangle subrect = {5, 5, 10, 10};
GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
+ test_start ("buffer_shift_vertical");
buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
sub = gegl_buffer_create_sub_buffer (buffer, &subrect);
Index: tests/buffer/tests/disabled_abyss.c
===================================================================
--- tests/buffer/tests/disabled_abyss.c.orig 2009-04-17 17:15:11.000000000 +0000
+++ tests/buffer/tests/disabled_abyss.c 2009-11-29 15:41:07.221880799 +0000
@@ -8,7 +8,7 @@
GeglRectangle subrect = {5, 5, 10, 10};
GeglRectangle subsubrect = {3, 3, 4, 4};
GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
+ test_start ("disabled_abyss");
buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
sub = g_object_new (GEGL_TYPE_BUFFER,
Index: tests/buffer/tests/get_shifted.c
===================================================================
--- tests/buffer/tests/get_shifted.c.orig 2009-04-17 17:15:11.000000000 +0000
+++ tests/buffer/tests/get_shifted.c 2009-11-29 15:41:14.951446310 +0000
@@ -4,7 +4,7 @@
GeglRectangle subrect = {5, 5, 10, 10};
GeglRectangle foor = {0, 0, 10, 10};
GeglRectangle rect = {0, 0, 20, 20};
- test_start ();
+ test_start ("get_shifted");
buffer = gegl_buffer_new (&rect, babl_format ("Y float"));
sub = gegl_buffer_create_sub_buffer (buffer, &subrect);
Index: tests/buffer/tests/linear_from_data.c
===================================================================
--- tests/buffer/tests/linear_from_data.c.orig 2009-06-17 20:01:33.000000000 +0000
+++ tests/buffer/tests/linear_from_data.c 2009-11-29 15:41:25.816936350 +0000
@@ -4,7 +4,7 @@
GeglRectangle extent = {0,0, 10, 10};
gfloat *buf;
gint i;
- test_start();
+ test_start("linear_from_data");
buf = g_malloc (sizeof (float) * 10 * 10);
for (i=0;i));
vgrad (buffer);
print_buffer (buffer);_______________________________________________
Gegl-developer mailing list
Gegl-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer
Sent: 2009-12-01 20:01:43 UTC (about 2 years ago)
From: Martin Nordholts
test_start() uses G_STRFUNC to determine function name
Albert Chin wrote:
> tests/buffer/buffer-test.c uses G_STRFUNC to print the name of the test
> function. However, this assumes the compiler supports
> __PRETTY_FUNCTION__ or __func__. If it doesn't, then test output is
> prepended with:
> Test: ???
>
> This basically causes the diff comparison to fail for most non-GCC
> compilers. Patch attached to fix this by manually adding the function
> name. Yeah, ugly, but I can't see an easier way to fix this.It seems like a reasonable workaround to an ugly problem to me. Could
you provide your patches (the other two as well) in git format-patch format?BR,
Martin--
My GIMP Blog:
http://www.chromecode.com/
"Reducing UI clutter, docking bars removed"_______________________________________________
Gegl-developer mailing list
Gegl-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer



