test_start() uses G_STRFUNC to determine function name

ForumsFor GEGL developers (read-only) ► test_start() uses G_STRFUNC to determine function name

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

Welcome!


Lost password?

Not a member? Sign up!

Random tutorials | Latest tutorials

  1. Cool glowing text Cool glowing text 40
  2. Creating 3D icons Creating 3D icons 35
  3. Create an amazing electricity effect on any object! Create an amazing electricity effect on any object! 6
  4. Create the Dragan effect Create the Dragan effect 2

Latest comments

But I just have 1 more prob (bear with me) I am really having troub... (2 days ago in [AVATAR] Become a real Na'Vi using GIMP!)

I got it to work :) I had to close the image and restart it. I thin... (2 days ago in Create cool rifts with translucent lights!)

there was a second and 3rd release of 2.6.12. we included the lates... (2 days ago in Last stable 2.6 release: 2.6.12 has arrived)

Poll

Is GIMP an adequate application for you to create printed graphics like flyers, advertisments etc?

Latest forum activities

Your Ad Here

facts & numbers

gimpusers.com RSS feed

48 identi.ca followers
750 Twitter followers

powered by bitfire it services