summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2013-05-27 17:13:30 -0400
committerJan Lehnardt <jan@apache.org>2013-05-27 17:26:20 -0400
commit7720cecb22f28aecf72ae3e1cb2679b1ce31bd1f (patch)
tree47538866280f9237b7155b3f91a4bbbbf34f65bf
parent583a419737969d5ecfb009cd330304ba0884d363 (diff)
downloadcouchdb-7720cecb22f28aecf72ae3e1cb2679b1ce31bd1f.tar.gz
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.
-rw-r--r--test/javascript/run.tpl12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl
index 3736becc0..97bc379c9 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