[libsoup/wip/smcv/xmlrpc-tests-glib-2-62] xmlrpc tests: Cope with GLib 2.62 TAP output



commit c105146645114d82f75c6b16e8e6bfdc9a75c100
Author: Simon McVittie <smcv debian org>
Date:   Sun Oct 6 16:44:15 2019 +0100

    xmlrpc tests: Cope with GLib 2.62 TAP output
    
    In GLib 2.62, "some-test-executable -l" outputs TAP headers before the
    list of tests. Ignore those lines. Otherwise, the assertion immediately
    below will fail, leading to test failure with a message like:
    
        ERROR:../tests/xmlrpc-server-test.c:347:main: 'g_str_has_prefix (tests[i], "/xmlrpc/")' should be TRUE
    
    Signed-off-by: Simon McVittie <smcv debian org>

 tests/xmlrpc-old-server-test.c | 8 ++++++++
 tests/xmlrpc-server-test.c     | 8 ++++++++
 2 files changed, 16 insertions(+)
---
diff --git a/tests/xmlrpc-old-server-test.c b/tests/xmlrpc-old-server-test.c
index a7076b5a..b5376121 100644
--- a/tests/xmlrpc-old-server-test.c
+++ b/tests/xmlrpc-old-server-test.c
@@ -344,6 +344,14 @@ main (int argc, char **argv)
                g_free (out);
 
                for (i = 0; tests[i] && *tests[i]; i++) {
+                       /* GLib >= 2.62 defaults to TAP output for tests, and
+                        * this adds TAP diagnostics "#..." and the test count
+                        * "1..N", even in the output of "some-test -l".
+                        * Ignore those. */
+                       if (   tests[i][0] == '#'
+                           || g_str_has_prefix (tests[i], "1.."))
+                               continue;
+
                        g_assert_true (g_str_has_prefix (tests[i], "/xmlrpc-old/"));
                        path = g_strdup_printf ("/xmlrpc-old-server/%s", tests[i] + strlen ("/xmlrpc-old/"));
                        g_test_add_data_func (path, tests[i], do_one_xmlrpc_test);
diff --git a/tests/xmlrpc-server-test.c b/tests/xmlrpc-server-test.c
index 80f04ea8..a96df618 100644
--- a/tests/xmlrpc-server-test.c
+++ b/tests/xmlrpc-server-test.c
@@ -344,6 +344,14 @@ main (int argc, char **argv)
                g_free (out);
 
                for (i = 0; tests[i] && *tests[i]; i++) {
+                       /* GLib >= 2.62 defaults to TAP output for tests, and
+                        * this adds TAP diagnostics "#..." and the test count
+                        * "1..N", even in the output of "some-test -l".
+                        * Ignore those. */
+                       if (   tests[i][0] == '#'
+                           || g_str_has_prefix (tests[i], "1.."))
+                               continue;
+
                        g_assert_true (g_str_has_prefix (tests[i], "/xmlrpc/"));
                        path = g_strdup_printf ("/xmlrpc-server/%s", tests[i] + strlen ("/xmlrpc/"));
                        g_test_add_data_func (path, tests[i], do_one_xmlrpc_test);


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