diff options
author | Jan Lehnardt <jan@apache.org> | 2013-05-27 17:13:30 -0400 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2013-05-27 17:26:26 -0400 |
commit | b1c87da66ce6e5c59ee14681c54e64652137782f (patch) | |
tree | 5188ca289dc1d754360fee2c321ea51abc55e706 | |
parent | 48c1190bc20dc1df32fe62e8480dba78e06ecda6 (diff) | |
download | couchdb-b1c87da66ce6e5c59ee14681c54e64652137782f.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.tpl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl index 2c785a6cd..6b8d5b8ce 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 |