couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject git commit: updated refs/heads/master to 7c23a6e
Date Fri, 13 Dec 2013 18:08:16 GMT
Updated Branches:
  refs/heads/master 391bbe19f -> 7c23a6ed8


Run a directory full of tests

It's now possible to supply a directory to the JavaScript
test runner and it will run all the .js files in that
direcotry.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/7c23a6ed
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/7c23a6ed
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/7c23a6ed

Branch: refs/heads/master
Commit: 7c23a6ed848ecec2518b352462a8c7f0c98369cf
Parents: 391bbe1
Author: Volker Mische <volker.mische@gmail.com>
Authored: Fri Dec 13 18:44:40 2013 +0100
Committer: Volker Mische <volker.mische@gmail.com>
Committed: Fri Dec 13 18:44:40 2013 +0100

----------------------------------------------------------------------
 test/javascript/run.tpl | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/7c23a6ed/test/javascript/run.tpl
----------------------------------------------------------------------
diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl
index 5f19b36..75192da 100644
--- a/test/javascript/run.tpl
+++ b/test/javascript/run.tpl
@@ -88,6 +88,18 @@ run() {
 
 }
 
+run_files() {
+    COUNTER=1
+    FILE_COUNT=$(ls -l $1 | wc -l)
+    FILE_COUNT=$(expr $FILE_COUNT + 0)
+    for TEST_SRC in $1
+    do
+        /bin/echo -n "$COUNTER/$FILE_COUNT "
+        COUNTER=$(expr $COUNTER + 1)
+        run $TEST_SRC
+    done
+}
+
 # start CouchDB
 if [ -z $COUCHDB_NO_START ]; then
     $MAKE dev
@@ -98,25 +110,20 @@ echo "Running javascript tests ..."
 
 if [ "$#" -eq 0 ];
 then
-    COUNTER=1
-    FILES="$SCRIPT_DIR/test/*.js"
-    FILE_COUNT=$(ls -l $FILES | wc -l)
-    FILE_COUNT=$(expr $FILE_COUNT + 0)
-    for TEST_SRC in $FILES
-    do
-        /bin/echo -n "$COUNTER/$FILE_COUNT "
-        COUNTER=$(expr $COUNTER + 1)
-        run $TEST_SRC
-    done
+    run_files "$SCRIPT_DIR/test/*.js"
 else
-    TEST_SRC="$1"
-    if [ ! -f $TEST_SRC ]; then
-        TEST_SRC="$SCRIPT_DIR/test/$1"
+    if [ -d $1 ]; then
+        run_files "$1/*.js"
+    else
+        TEST_SRC="$1"
         if [ ! -f $TEST_SRC ]; then
-            TEST_SRC="$SCRIPT_DIR/test/$1.js"
+            TEST_SRC="$SCRIPT_DIR/test/$1"
             if [ ! -f $TEST_SRC ]; then
-                echo "file $1 does not exist"
-                exit 1
+                TEST_SRC="$SCRIPT_DIR/test/$1.js"
+                if [ ! -f $TEST_SRC ]; then
+                    echo "file $1 does not exist"
+                    exit 1
+                fi
             fi
         fi
     fi


Mime
View raw message