]> granicus.if.org Git - postgis/commitdiff
Register a notice handler in cu_tester
authorSandro Santilli <strk@keybit.net>
Tue, 23 Jun 2015 17:04:43 +0000 (17:04 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 23 Jun 2015 17:04:43 +0000 (17:04 +0000)
Useful for debugging sessions

git-svn-id: http://svn.osgeo.org/postgis/trunk@13692 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/cunit/cu_tester.c

index ccbb22663fa48f10a98a70665c0039be2a6a678e..d8a1466519124f3ac5c7b40f7a23499c060472d4 100644 (file)
@@ -20,6 +20,9 @@
 static void
 cu_errorreporter(const char *fmt, va_list ap);
 
+static void
+cu_noticereporter(const char *fmt, va_list ap);
+
 
 /* ADD YOUR SUITE SETUP FUNCTION HERE (1 of 2) */
 extern void print_suite_setup();
@@ -128,7 +131,7 @@ int main(int argc, char *argv[])
        PG_SuiteSetup *setupfunc = setupfuncs;
 
        /* Install the custom error handler */
-       lwgeom_set_handlers(0, 0, 0, cu_errorreporter, 0);
+       lwgeom_set_handlers(0, 0, 0, cu_errorreporter, cu_noticereporter);
 
        /* Initialize the CUnit test registry */
        if (CUE_SUCCESS != CU_initialize_registry())
@@ -250,7 +253,16 @@ cu_errorreporter(const char *fmt, va_list ap)
 {
   vsnprintf (cu_error_msg, MAX_CUNIT_MSG_LENGTH, fmt, ap);
   cu_error_msg[MAX_CUNIT_MSG_LENGTH]='\0';
-  /* fprintf(stderr, "ERROR: %s\n", cu_error_msg); */
+  /*fprintf(stderr, "ERROR: %s\n", cu_error_msg);*/
+}
+
+static void
+cu_noticereporter(const char *fmt, va_list ap)
+{
+  char buf[MAX_CUNIT_MSG_LENGTH+1];
+  vsnprintf (buf, MAX_CUNIT_MSG_LENGTH, fmt, ap);
+  buf[MAX_CUNIT_MSG_LENGTH]='\0';
+  /*fprintf(stderr, "NOTICE: %s\n", buf);*/
 }
 
 void