[gnome-desktop-testing] Run tests in subdirectories, per latest test specification



commit 5534df68fa4457b9bebd8d74e237af6c36b2f2cc
Author: Colin Walters <walters verbum org>
Date:   Sat Apr 27 19:00:07 2013 -0400

    Run tests in subdirectories, per latest test specification
    
    This avoids a huge directory and is just nicer.

 src/gnome-desktop-testing-runner.js |   36 ++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 7 deletions(-)
---
diff --git a/src/gnome-desktop-testing-runner.js b/src/gnome-desktop-testing-runner.js
index a1f9cfd..d0df1a2 100755
--- a/src/gnome-desktop-testing-runner.js
+++ b/src/gnome-desktop-testing-runner.js
@@ -46,7 +46,7 @@ function runTestsInDirectory(file) {
     let testSuccess = true;
     while (dirEnum != null && (info = dirEnum.next_file(cancellable)) != null) {
         let name = info.get_name();
-        if (name.indexOf('.testmeta') < 0)
+        if (name.indexOf('.test') < 0)
            continue;
         let child = dirEnum.get_child(info);
         let childPath = child.get_path();
@@ -92,17 +92,39 @@ function runTestsInDirectory(file) {
         if (!skipped)
            ntests += 1;
     }
+    return testSuccess;
 }
 
-let testDirs = ARGV.slice();
+let prefixRoot = Gio.File.new_for_path(GLib.getenv('DATADIR') + '/installed-tests');
 
-if (testDirs.length == 0) {
-    testDirs = [GLib.getenv('DATADIR') + '/installed-tests'];
+let testDirs = [];
+
+if (ARGV.length == 0) {
+    let dirEnum;
+    let info;
+    let cancellable = null;
+
+    dirEnum = prefixRoot.enumerate_children('standard::name,standard::type',
+                                           Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,
+                                           cancellable);
+    while ((info = dirEnum.next_file(cancellable)) != null) {
+       let ftype = info.get_file_type();
+       if (ftype == Gio.FileType.DIRECTORY) {
+           testDirs.push(dirEnum.get_child(info));
+       }
+    }
+    dirEnum.close(cancellable);
+} else {
+    for (let i = 0; i < ARGV.length; i++) {
+       testDirs.push(prefixRoot.get_child(ARGV[i]));
+    }
 }
 
-testDirs.forEach(function(path) {
-    runTestsInDirectory(Gio.File.new_for_path(path));
-});
+for (let i = 0; i < testDirs.length; i++) {
+    if (!runTestsInDirectory(testDirs[i])) {
+       break;
+    }
+};
 
 let rval;
 if (nFailedTests == 0) {


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