[evolution-data-server/sqlite-refactor: 17/17] test-client-custom-summary: Added --filter option.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/sqlite-refactor: 17/17] test-client-custom-summary: Added --filter option.
- Date: Tue, 26 Nov 2013 11:54:32 +0000 (UTC)
commit 8752860a626de5aa4692cd1b5463e917204c5301
Author: Tristan Van Berkom <tristanvb openismus com>
Date: Tue Nov 26 20:42:56 2013 +0900
test-client-custom-summary: Added --filter option.
Pass a regular expression to filter which test cases should run
tests/libebook/client/test-client-custom-summary.c | 28 ++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/tests/libebook/client/test-client-custom-summary.c
b/tests/libebook/client/test-client-custom-summary.c
index f30e3df..c06ce34 100644
--- a/tests/libebook/client/test-client-custom-summary.c
+++ b/tests/libebook/client/test-client-custom-summary.c
@@ -60,6 +60,18 @@ setup_custom_book (ESource *scratch,
static ETestServerClosure setup_custom_closure = { E_TEST_SERVER_ADDRESS_BOOK, setup_custom_book, 0, TRUE,
NULL };
static ETestServerClosure setup_default_closure = { E_TEST_SERVER_ADDRESS_BOOK, NULL, 0, TRUE, NULL };
+/* Filter which tests we want to try with a regexp */
+static GRegex *test_regex = NULL;
+static gchar *test_filter = NULL;
+
+static GOptionEntry entries[] = {
+
+ { "filter", 'f', 0, G_OPTION_ARG_STRING, &test_filter,
+ "A regular expression to filter which tests should be added", NULL },
+ { NULL }
+};
+
+
/* Define this macro to expect E_CLIENT_ERROR_NOT_SUPPORTED
* only on phone number queries when EDS is built with no
* phone number support.
@@ -137,6 +149,12 @@ add_client_test_sexp (const gchar *prefix,
data->num_contacts = num_contacts;
data->phone_number_query = phone_number_query;
+ /* Filter out anything that was not specified in the test filter */
+ if (test_regex && !g_regex_match (test_regex, path, 0, NULL)) {
+ g_free (path);
+ return;
+ }
+
if (custom)
g_test_add (
path, ClientTestFixture, data,
@@ -302,6 +320,7 @@ gint
main (gint argc,
gchar **argv)
{
+ GOptionContext *context;
gint ret, i;
SuiteType suites[] = {
{ search_test, FALSE, FALSE, "/EBookClient/Default/Search" },
@@ -314,6 +333,15 @@ main (gint argc,
{ uid_test, TRUE, TRUE, "/EBookClient/Custom/DirectAccess/SearchUID" }
};
+ /* Parse our regex first */
+ context = g_option_context_new (NULL);
+ g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+ g_option_context_parse (context, &argc, &argv, NULL);
+ g_option_context_free (context);
+
+ if (test_filter)
+ test_regex = g_regex_new (test_filter, 0, 0, NULL);
+
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugzilla.gnome.org/");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]