You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2013/05/27 23:26:29 UTC

[1/2] git commit: updated refs/heads/1.3.x to 7720cec

Updated Branches:
  refs/heads/1.3.x 583a41973 -> 7720cecb2
  refs/heads/master 48c1190bc -> b1c87da66


Remove bashisms from JS test runner

1. Stop using bash arrays.
2. Account for the sh-builtin `echo` not having an `-n`
   argument on BSDs.
3. Strip spaces from `wc -l` output when calculating the
   number of tests for 1.

Patch by Klaus Trainer & Jan Lehnardt.

Closes COUCHDB-1793.


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

Branch: refs/heads/1.3.x
Commit: 7720cecb22f28aecf72ae3e1cb2679b1ce31bd1f
Parents: 583a419
Author: Jan Lehnardt <ja...@apache.org>
Authored: Mon May 27 17:13:30 2013 -0400
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Mon May 27 17:26:20 2013 -0400

----------------------------------------------------------------------
 test/javascript/run.tpl |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/7720cecb/test/javascript/run.tpl
----------------------------------------------------------------------
diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl
index 3736bec..97bc379 100644
--- a/test/javascript/run.tpl
+++ b/test/javascript/run.tpl
@@ -65,7 +65,7 @@ process_response() {
 
 run() {
     # start the tests
-    echo -n "$1 ... "
+    /bin/echo -n "$1 ... "
     $COUCHJS -H -u $COUCH_URI_FILE \
         $SCRIPT_DIR/json2.js \
         $SCRIPT_DIR/sha1.js \
@@ -96,11 +96,13 @@ echo "Running javascript tests ..."
 if [ "$#" -eq 0 ];
 then
     COUNTER=1
-    FILES=($SCRIPT_DIR/test/*.js)
-    for TEST_SRC in "${FILES[@]}"
+    FILES="$SCRIPT_DIR/test/*.js"
+    FILE_COUNT=$(ls -l $FILES | wc -l)
+    FILE_COUNT=$(expr $FILE_COUNT + 0)
+    for TEST_SRC in $FILES
     do
-        echo -n "$COUNTER/${#FILES[@]} " 
-        let COUNTER=COUNTER+1
+        /bin/echo -n "$COUNTER/$FILE_COUNT "
+        COUNTER=$(expr $COUNTER + 1)
         run $TEST_SRC
     done
 else


[2/2] git commit: updated refs/heads/master to b1c87da

Posted by ja...@apache.org.
Remove bashisms from JS test runner

1. Stop using bash arrays.
2. Account for the sh-builtin `echo` not having an `-n`
   argument on BSDs.
3. Strip spaces from `wc -l` output when calculating the
   number of tests for 1.

Patch by Klaus Trainer & Jan Lehnardt.

Closes COUCHDB-1793.


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

Branch: refs/heads/master
Commit: b1c87da66ce6e5c59ee14681c54e64652137782f
Parents: 48c1190
Author: Jan Lehnardt <ja...@apache.org>
Authored: Mon May 27 17:13:30 2013 -0400
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Mon May 27 17:26:26 2013 -0400

----------------------------------------------------------------------
 test/javascript/run.tpl |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/b1c87da6/test/javascript/run.tpl
----------------------------------------------------------------------
diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl
index 2c785a6..6b8d5b8 100644
--- a/test/javascript/run.tpl
+++ b/test/javascript/run.tpl
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+#!/bin/sh -e
 
 # Licensed under the Apache License, Version 2.0 (the "License"); you may not
 # use this file except in compliance with the License. You may obtain a copy of
@@ -65,7 +65,7 @@ process_response() {
 
 run() {
     # start the tests
-    echo -n "$1 ... "
+    /bin/echo -n "$1 ... "
     $COUCHJS -H -u $COUCH_URI_FILE \
         $SCRIPT_DIR/json2.js \
         $SCRIPT_DIR/sha1.js \
@@ -97,11 +97,13 @@ echo "Running javascript tests ..."
 if [ "$#" -eq 0 ];
 then
     COUNTER=1
-    FILES=($SCRIPT_DIR/test/*.js)
-    for TEST_SRC in "${FILES[@]}"
+    FILES="$SCRIPT_DIR/test/*.js"
+    FILE_COUNT=$(ls -l $FILES | wc -l)
+    FILE_COUNT=$(expr $FILE_COUNT + 0)
+    for TEST_SRC in $FILES
     do
-        echo -n "$COUNTER/${#FILES[@]} " 
-        let COUNTER=COUNTER+1
+        /bin/echo -n "$COUNTER/$FILE_COUNT "
+        COUNTER=$(expr $COUNTER + 1)
         run $TEST_SRC
     done
 else