[glib: 1/2] testing: Run tests specified with -p in the order specified



commit a537e538be6b1cf906985662e57b1cf48bcd86ea
Author: Simon McVittie <smcv collabora com>
Date:   Mon Apr 29 16:19:49 2019 +0100

    testing: Run tests specified with -p in the order specified
    
    Closes: #1763
    Signed-off-by: Simon McVittie <smcv collabora com>

 glib/gtestutils.c     |  5 +++++
 glib/tests/protocol.c |  4 ++--
 glib/tests/testing.c  | 10 ++++------
 3 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index 9d92bf74e..d129b8742 100644
--- a/glib/gtestutils.c
+++ b/glib/gtestutils.c
@@ -1242,6 +1242,11 @@ parse_args (gint    *argc_p,
           exit (0);
         }
     }
+
+  /* We've been prepending to test_paths, but its order matters, so
+   * permute it */
+  test_paths = g_slist_reverse (test_paths);
+
   /* collapse argv */
   e = 1;
   for (i = 1; i < argc; i++)
diff --git a/glib/tests/protocol.c b/glib/tests/protocol.c
index 4713f3d0b..f1e969af3 100644
--- a/glib/tests/protocol.c
+++ b/glib/tests/protocol.c
@@ -122,9 +122,9 @@ test_message (void)
           (gchar*)argv0,
           NULL,
           "--GTestSubprocess",
-          "-p", "/glib/testing/protocol/debug",
-          "-p", "/glib/testing/protocol/message",
           "-p", "/glib/testing/protocol/gtest-message",
+          "-p", "/glib/testing/protocol/message",
+          "-p", "/glib/testing/protocol/debug",
           NULL
   };
   GTestLogBuffer* tlb;
diff --git a/glib/tests/testing.c b/glib/tests/testing.c
index 28dfd8632..52895f7c1 100644
--- a/glib/tests/testing.c
+++ b/glib/tests/testing.c
@@ -1163,12 +1163,10 @@ test_tap (void)
                 NULL, NULL, &output, NULL, &status,
                 &error);
   g_assert_no_error (error);
-  /* FIXME: Tests are run in an order that is the reverse of the order
-   * of -p options. */
-  g_assert_nonnull (strstr (output, "\nok 1 /b/a\n"));
-  g_assert_nonnull (strstr (output, "\nok 2 /b/b\n"));
-  g_assert_nonnull (strstr (output, "\nok 3 /c/a\n"));
-  g_assert_nonnull (strstr (output, "\nok 4 /c/a\n"));
+  g_assert_nonnull (strstr (output, "\nok 1 /c/a\n"));
+  g_assert_nonnull (strstr (output, "\nok 2 /c/a\n"));
+  g_assert_nonnull (strstr (output, "\nok 3 /b/a\n"));
+  g_assert_nonnull (strstr (output, "\nok 4 /b/b\n"));
   g_assert_nonnull (strstr (output, "\n1..4\n"));
 
   g_spawn_check_exit_status (status, &error);


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