[librsvg] tests: Make crash test accept commandline args



commit 9561652435e93c7b791fe7ca1708ce1196fae820
Author: Benjamin Otte <otte redhat com>
Date:   Wed Oct 14 20:22:22 2015 +0200

    tests: Make crash test accept commandline args
    
    Again, copied from gdk-pixbuf

 tests/crash.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/tests/crash.c b/tests/crash.c
index 832f9be..57c2ba7 100644
--- a/tests/crash.c
+++ b/tests/crash.c
@@ -28,12 +28,24 @@ main (int argc, char *argv[])
     RSVG_G_TYPE_INIT;
     g_test_init (&argc, &argv, NULL);
 
-    base = g_file_new_for_path (test_utils_get_test_data_path ());
-    crash = g_file_get_child (base, "crash");
-    test_utils_add_test_for_all_files ("/crash", crash, crash, test_crash, NULL);
-    g_object_unref (base);
-    g_object_unref (crash);
-                                       
+    if (argc < 2) {
+        base = g_file_new_for_path (test_utils_get_test_data_path ());
+        crash = g_file_get_child (base, "crash");
+        test_utils_add_test_for_all_files ("/crash", crash, crash, test_crash, NULL);
+        g_object_unref (base);
+        g_object_unref (crash);
+    } else {
+        guint i;
+
+        for (i = 1; i < argc; i++) {
+            GFile *file = g_file_new_for_commandline_arg (argv[i]);
+
+            test_utils_add_test_for_all_files ("/crash", NULL, file, test_crash, NULL);
+
+            g_object_unref (file);
+        }
+    }
+
     result = g_test_run ();
 
     rsvg_cleanup ();


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