From 8253f98a18043cba76cc7524f752b3586e63b747 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 20 Jan 2013 03:23:38 -0500 Subject: [PATCH] Add start/stop suite log messages These will be used in the following commits, when implementing support for TAP as an alternative test driver protocol. https://bugzilla.gnome.org/show_bug.cgi?id=692125 --- glib/gtester.c | 2 ++ glib/gtestutils.c | 10 ++++++++++ glib/gtestutils.h | 4 +++- glib/tests/protocol.c | 4 ++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/glib/gtester.c b/glib/gtester.c index 0a2feb22e..12f7f1a8f 100644 --- a/glib/gtester.c +++ b/glib/gtester.c @@ -130,6 +130,8 @@ test_log_msg (GTestLogMsg *msg) guint i; gchar **strv; case G_TEST_LOG_NONE: + case G_TEST_LOG_START_SUITE: + case G_TEST_LOG_STOP_SUITE: break; case G_TEST_LOG_ERROR: strv = g_strsplit (msg->strings[0], "\n", -1); diff --git a/glib/gtestutils.c b/glib/gtestutils.c index 3ab4e167e..529cbd335 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -595,6 +595,8 @@ g_test_log_type_name (GTestLogType log_type) case G_TEST_LOG_MIN_RESULT: return "minperf"; case G_TEST_LOG_MAX_RESULT: return "maxperf"; case G_TEST_LOG_MESSAGE: return "message"; + case G_TEST_LOG_START_SUITE: return "start suite"; + case G_TEST_LOG_STOP_SUITE: return "stop suite"; } return "???"; } @@ -660,6 +662,10 @@ g_test_log (GTestLogType lbit, if (g_test_verbose()) g_print ("GTest: random seed: %s\n", string2); break; + case G_TEST_LOG_START_SUITE: + break; + case G_TEST_LOG_STOP_SUITE: + break; case G_TEST_LOG_STOP_CASE: if (g_test_verbose()) g_print ("GTest: result: %s\n", fail ? "FAIL" : "OK"); @@ -1911,6 +1917,8 @@ g_test_run_suite_internal (GTestSuite *suite, g_return_val_if_fail (suite != NULL, -1); + g_test_log (G_TEST_LOG_START_SUITE, suite->name, NULL, 0, NULL); + while (path[0] == '/') path++; l = strlen (path); @@ -1941,6 +1949,8 @@ g_test_run_suite_internal (GTestSuite *suite, g_free (test_run_name); test_run_name = old_name; + g_test_log (G_TEST_LOG_STOP_SUITE, suite->name, NULL, 0, NULL); + return n_bad; } diff --git a/glib/gtestutils.h b/glib/gtestutils.h index 63e3b7493..d5796289c 100644 --- a/glib/gtestutils.h +++ b/glib/gtestutils.h @@ -309,7 +309,9 @@ typedef enum { G_TEST_LOG_STOP_CASE, /* d:status d:nforks d:elapsed */ G_TEST_LOG_MIN_RESULT, /* s:blurb d:result */ G_TEST_LOG_MAX_RESULT, /* s:blurb d:result */ - G_TEST_LOG_MESSAGE /* s:blurb */ + G_TEST_LOG_MESSAGE, /* s:blurb */ + G_TEST_LOG_START_SUITE, + G_TEST_LOG_STOP_SUITE } GTestLogType; typedef struct { diff --git a/glib/tests/protocol.c b/glib/tests/protocol.c index 8e0292d7d..9aa4879d3 100644 --- a/glib/tests/protocol.c +++ b/glib/tests/protocol.c @@ -193,6 +193,8 @@ test_message (void) { case G_TEST_LOG_START_BINARY: case G_TEST_LOG_START_CASE: + case G_TEST_LOG_START_SUITE: + case G_TEST_LOG_STOP_SUITE: /* ignore */ break; case G_TEST_LOG_STOP_CASE: @@ -302,6 +304,8 @@ test_error (void) { case G_TEST_LOG_START_BINARY: case G_TEST_LOG_START_CASE: + case G_TEST_LOG_START_SUITE: + case G_TEST_LOG_STOP_SUITE: /* ignore */ break; case G_TEST_LOG_STOP_CASE: