[gnome-desktop-testing] Sort tests *after* doing command line filtering



commit 65808963eaca92a44ac872945d512a599be87bf4
Author: Colin Walters <walters verbum org>
Date:   Fri May 31 14:49:34 2013 -0400

    Sort tests *after* doing command line filtering
    
    Otherwise ordering is broken, since we're using
    g_ptr_array_remove_index_fast().

 src/gnome-desktop-testing-runner.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/src/gnome-desktop-testing-runner.c b/src/gnome-desktop-testing-runner.c
index a203c5c..ede3e13 100755
--- a/src/gnome-desktop-testing-runner.c
+++ b/src/gnome-desktop-testing-runner.c
@@ -449,15 +449,21 @@ cmp_tests (gconstpointer adata,
   Test **b_pp = (gpointer)bdata;
   Test *a = *a_pp;
   Test *b = *b_pp;
-  const char *apath = gs_file_get_path_cached (a->path);
-  const char *bpath = gs_file_get_path_cached (b->path);
 
   if (a->type == b->type)
-    return strcmp (apath, bpath);
+    {
+      const char *apath = gs_file_get_path_cached (a->path);
+      const char *bpath = gs_file_get_path_cached (b->path);
+      return strcmp (apath, bpath);
+    }
   else if (a->type < b->type)
-    return -1;
+    {
+      return -1;
+    }
   else
-    return 1;
+    {
+      return 1;
+    }
 }
 
 int
@@ -510,8 +516,6 @@ main (int argc, char **argv)
         goto out;
     }
 
-  g_ptr_array_sort (app->tests, cmp_tests);
-
   if (argc > 1)
     {
       j = 0;
@@ -535,6 +539,8 @@ main (int argc, char **argv)
         }
     }
 
+  g_ptr_array_sort (app->tests, cmp_tests);
+
   total_tests = app->tests->len;
 
   if (opt_list)


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