testsuite: Don't pretend we're a GTest

This is a meson test, not a GTest thing. So:

- Use g_print(), not g_test_message
That makes meson test --verbose print the actual log messsages.

- Don't g_assert() all the time
Instead, run tests through to the end and just return a non-0 exit
status.
This commit is contained in:
Benjamin Otte 2019-03-19 03:57:04 +01:00 committed by Timm Bäder
parent cc878ec00f
commit 2a7e4ae7f6

View File

@ -49,7 +49,7 @@ save_image (cairo_surface_t *surface,
{ {
char *filename = get_output_file (test_name, ".node", extension); char *filename = get_output_file (test_name, ".node", extension);
g_test_message ("Storing test result image at %s", filename); g_print ("Storing test result image at %s\n", filename);
g_assert (cairo_surface_write_to_png (surface, filename) == CAIRO_STATUS_SUCCESS); g_assert (cairo_surface_write_to_png (surface, filename) == CAIRO_STATUS_SUCCESS);
g_free (filename); g_free (filename);
} }
@ -82,8 +82,8 @@ main (int argc, char **argv)
window = gdk_surface_new_toplevel (gdk_display_get_default(), 10 , 10); window = gdk_surface_new_toplevel (gdk_display_get_default(), 10 , 10);
renderer = gsk_renderer_new_for_surface (window); renderer = gsk_renderer_new_for_surface (window);
g_test_message ("Node file: '%s'\n", node_file); g_print ("Node file: '%s'\n", node_file);
g_test_message ("PNG file: '%s'\n", png_file); g_print ("PNG file: '%s'\n", png_file);
/* Load the render node from the given .node file */ /* Load the render node from the given .node file */
{ {
@ -94,7 +94,7 @@ main (int argc, char **argv)
if (!g_file_get_contents (node_file, &contents, &len, &error)) if (!g_file_get_contents (node_file, &contents, &len, &error))
{ {
g_test_message ("Could not open node file: %s\n", error->message); g_print ("Could not open node file: %s\n", error->message);
g_clear_error (&error); g_clear_error (&error);
g_test_fail (); g_test_fail ();
return -1; return -1;
@ -132,7 +132,5 @@ main (int argc, char **argv)
if (diff_surface) if (diff_surface)
save_image (diff_surface, node_file, ".diff.png"); save_image (diff_surface, node_file, ".diff.png");
g_assert (diff_surface == NULL); return diff_surface == NULL ? 0 : 1;
return 0;
} }