[gjs] gjs-unit: Allow running just one test case



commit a579bab22320f4ae53634eb3731eb444679497ab
Author: Colin Walters <walters verbum org>
Date:   Fri Jun 17 12:37:01 2011 -0400

    gjs-unit: Allow running just one test case
    
    For example:
    $ env TOP_SRCDIR=. BUILDDIR=. GI_TYPELIB_PATH=. G_SLICE=always-malloc libtool --mode=execute valgrind --leak-check=full --suppressions=test/gjs.supp --log-file=/tmp/gjs-valgrind.log  ./gjs-unit testGIMarshalling.js

 test/gjs-unit.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/test/gjs-unit.c b/test/gjs-unit.c
index a222d9d..60857a5 100644
--- a/test/gjs-unit.c
+++ b/test/gjs-unit.c
@@ -187,6 +187,10 @@ main(int argc, char **argv)
     GSList *all_tests, *iter;
     GSList *test_filenames = NULL;
     int retval;
+    const char *target_unit = NULL;
+
+    if (argc >= 2)
+        target_unit = argv[1];
 
     working_dir = g_get_current_dir();
 
@@ -269,6 +273,9 @@ main(int argc, char **argv)
             g_free(name);
             continue;
         }
+        
+        if (target_unit != NULL && strcmp (name, target_unit) != 0)
+            continue;
 
         /* pretty print, drop 'test' prefix and '.js' suffix from test name */
         test_name = g_strconcat("/js/", name + 4, NULL);



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