[glib/mjog/1908-gtest-skip-suites: 2/2] gtestutils: Allow whole test suites to be skipped



commit 60b48beb2ab8759c98730e9118de45afa24c0c18
Author: Michael Gratton <mike vee net>
Date:   Thu Oct 17 11:35:49 2019 +1100

    gtestutils: Allow whole test suites to be skipped
    
    Before executing a test squite, check that its name isn't present in
    the list of skipped paths and if so, skip the whole suite. Per other
    cases, report it skipped only if in verbose mode.
    
    This enables skipping a whole test suite using `-s /suite-name`.
    
    Fixes #1908

 glib/gtestutils.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index 43fba1a53..49261da32 100644
--- a/glib/gtestutils.c
+++ b/glib/gtestutils.c
@@ -2709,6 +2709,13 @@ g_test_run_suite_internal (GTestSuite *suite,
 
   g_return_val_if_fail (suite != NULL, -1);
 
+  if (g_slist_find_custom (test_paths_skipped, old_name, (GCompareFunc)g_strcmp0))
+    {
+    if (g_test_verbose ())
+      g_print ("GTest: skipping: %s\n", old_name);
+    return 0;
+    }
+
   g_test_log (G_TEST_LOG_START_SUITE, suite->name, NULL, 0, NULL);
 
   for (iter = suite->cases; iter; iter = iter->next)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]