You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by we...@apache.org on 2013/04/10 03:52:56 UTC

[4/6] git commit: updated refs/heads/1.3.x to 5e64395

Refactor javascript runner script to handle couchdb restarts. Single interpreter per test.


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

Branch: refs/heads/1.3.x
Commit: 9838eef739b1522cb60399e4a15024213f18a5b9
Parents: 0208778
Author: Wendall Cada <we...@apache.org>
Authored: Tue Apr 9 18:45:16 2013 -0700
Committer: Wendall Cada <we...@apache.org>
Committed: Tue Apr 9 18:45:16 2013 -0700

----------------------------------------------------------------------
 test/javascript/run.tpl |  115 +++++++++++++++++++++++++++--------------
 1 files changed, 76 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/9838eef7/test/javascript/run.tpl
----------------------------------------------------------------------
diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl
index 647a29a..5b1e075 100644
--- a/test/javascript/run.tpl
+++ b/test/javascript/run.tpl
@@ -27,9 +27,82 @@ if [ -z "$MAKE" ]; then
     MAKE=make
 fi
 
+trap 'abort' EXIT INT
+
+start() {
+	./utils/run -b -r 0 -n \
+		-a $BUILD_DIR/etc/couchdb/default_dev.ini \
+		-a $SRC_DIR/test/random_port.ini \
+		-a $BUILD_DIR/etc/couchdb/local_dev.ini 1>/dev/null
+}
+
+stop() {
+    ./utils/run -d 1>/dev/null
+}
+
+restart() {
+    stop
+    start
+}
+
+abort() {
+    trap - 0
+    stop
+    exit 2
+}
+
+process_response() {
+    while read data
+    do
+        if [ $data = 'restart' ];
+        then
+            restart
+        else
+            echo "$data"
+        fi
+    done
+}
+
+run() {
+    # start the tests
+    echo -n "$1 ... "
+    $COUCHJS -H -u $COUCH_URI_FILE \
+        $SCRIPT_DIR/json2.js \
+        $SCRIPT_DIR/sha1.js \
+        $SCRIPT_DIR/oauth.js \
+        $SCRIPT_DIR/couch.js \
+        $SCRIPT_DIR/couch_test_runner.js \
+        $JS_TEST_DIR/couch_http.js \
+        $JS_TEST_DIR/test_setup.js \
+        $1 \
+        $JS_TEST_DIR/cli_runner.js | process_response
+
+    if [ -z $RESULT ]; then
+        RESULT=$?
+    elif [ "$?" -eq 1 ]; then
+        RESULT=$?
+    fi
+
+}
+
+# start CouchDB
+if [ -z $COUCHDB_NO_START ]; then
+    $MAKE dev
+    start
+fi
+
+echo "Running javascript tests ..."
+
 if [ "$#" -eq 0 ];
 then
-    TEST_SRC="$SCRIPT_DIR/test/*.js"
+    COUNTER=1
+    FILES=($SCRIPT_DIR/test/*.js)
+    for TEST_SRC in "${FILES[@]}"
+    do
+        echo -n "$COUNTER/${#FILES[@]} " 
+        let COUNTER=COUNTER+1
+        run $TEST_SRC
+    done
 else
     TEST_SRC="$1"
     if [ ! -f $TEST_SRC ]; then
@@ -40,46 +113,10 @@ else
                 echo "file $1 does not exist"
                 exit 1
             fi
+            run $TEST_SRC
         fi
     fi
 fi
 
-# stop CouchDB on exit from various signals
-abort() {
-    trap - 0
-    ./utils/run -d
-    exit 2
-}
-
-# start CouchDB
-if [ -z $COUCHDB_NO_START ]; then
-    $MAKE dev
-    trap 'abort' EXIT INT
-	./utils/run -b -r 1 -n \
-		-a $BUILD_DIR/etc/couchdb/default_dev.ini \
-		-a $SRC_DIR/test/random_port.ini \
-		-a $BUILD_DIR/etc/couchdb/local_dev.ini
-	sleep 1 # give it a sec
-fi
-
-# start the tests
-$COUCHJS -H -u $COUCH_URI_FILE \
-	$SCRIPT_DIR/json2.js \
-	$SCRIPT_DIR/sha1.js \
-	$SCRIPT_DIR/oauth.js \
-	$SCRIPT_DIR/couch.js \
-	$SCRIPT_DIR/couch_test_runner.js \
-	$SCRIPT_DIR/couch_tests.js \
-	$TEST_SRC \
-	$JS_TEST_DIR/couch_http.js \
-	$JS_TEST_DIR/cli_runner.js
-
-RESULT=$?
-
-if [ -z $COUCHDB_NO_START ]; then
-    # stop CouchDB
-    ./utils/run -d
-    trap - 0
-fi
-
+trap - 0
 exit $RESULT


Re: [4/6] git commit: updated refs/heads/1.3.x to 5e64395

Posted by Wendall Cada <we...@apache.org>.
On 04/15/2013 11:30 AM, Jan Lehnardt wrote:
> On Apr 10, 2013, at 02:52 , wendallc@apache.org wrote:
>
>> Refactor javascript runner script to handle couchdb restarts. Single interpreter per test.
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/9838eef7
>> Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/9838eef7
>> Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/9838eef7
>>
>> Branch: refs/heads/1.3.x
> Can you update NEWS & CHANGES with the test suite updates in all the relevant branches?
Yes! I am new to this process and completely forgot. I'll do so as soon 
as I have time in the next couple days.
>
> Thanks! :)
> Jan
> --
> PS: We should really address not having to do this manually anymore. Noah, would now be
> a good time rethinking all this?
Agreed. :)

Wendall
>
>> Commit: 9838eef739b1522cb60399e4a15024213f18a5b9
>> Parents: 0208778
>> Author: Wendall Cada <we...@apache.org>
>> Authored: Tue Apr 9 18:45:16 2013 -0700
>> Committer: Wendall Cada <we...@apache.org>
>> Committed: Tue Apr 9 18:45:16 2013 -0700
>>
>> ----------------------------------------------------------------------
>> test/javascript/run.tpl |  115 +++++++++++++++++++++++++++--------------
>> 1 files changed, 76 insertions(+), 39 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>> http://git-wip-us.apache.org/repos/asf/couchdb/blob/9838eef7/test/javascript/run.tpl
>> ----------------------------------------------------------------------
>> diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl
>> index 647a29a..5b1e075 100644
>> --- a/test/javascript/run.tpl
>> +++ b/test/javascript/run.tpl
>> @@ -27,9 +27,82 @@ if [ -z "$MAKE" ]; then
>>      MAKE=make
>> fi
>>
>> +trap 'abort' EXIT INT
>> +
>> +start() {
>> +	./utils/run -b -r 0 -n \
>> +		-a $BUILD_DIR/etc/couchdb/default_dev.ini \
>> +		-a $SRC_DIR/test/random_port.ini \
>> +		-a $BUILD_DIR/etc/couchdb/local_dev.ini 1>/dev/null
>> +}
>> +
>> +stop() {
>> +    ./utils/run -d 1>/dev/null
>> +}
>> +
>> +restart() {
>> +    stop
>> +    start
>> +}
>> +
>> +abort() {
>> +    trap - 0
>> +    stop
>> +    exit 2
>> +}
>> +
>> +process_response() {
>> +    while read data
>> +    do
>> +        if [ $data = 'restart' ];
>> +        then
>> +            restart
>> +        else
>> +            echo "$data"
>> +        fi
>> +    done
>> +}
>> +
>> +run() {
>> +    # start the tests
>> +    echo -n "$1 ... "
>> +    $COUCHJS -H -u $COUCH_URI_FILE \
>> +        $SCRIPT_DIR/json2.js \
>> +        $SCRIPT_DIR/sha1.js \
>> +        $SCRIPT_DIR/oauth.js \
>> +        $SCRIPT_DIR/couch.js \
>> +        $SCRIPT_DIR/couch_test_runner.js \
>> +        $JS_TEST_DIR/couch_http.js \
>> +        $JS_TEST_DIR/test_setup.js \
>> +        $1 \
>> +        $JS_TEST_DIR/cli_runner.js | process_response
>> +
>> +    if [ -z $RESULT ]; then
>> +        RESULT=$?
>> +    elif [ "$?" -eq 1 ]; then
>> +        RESULT=$?
>> +    fi
>> +
>> +}
>> +
>> +# start CouchDB
>> +if [ -z $COUCHDB_NO_START ]; then
>> +    $MAKE dev
>> +    start
>> +fi
>> +
>> +echo "Running javascript tests ..."
>> +
>> if [ "$#" -eq 0 ];
>> then
>> -    TEST_SRC="$SCRIPT_DIR/test/*.js"
>> +    COUNTER=1
>> +    FILES=($SCRIPT_DIR/test/*.js)
>> +    for TEST_SRC in "${FILES[@]}"
>> +    do
>> +        echo -n "$COUNTER/${#FILES[@]} "
>> +        let COUNTER=COUNTER+1
>> +        run $TEST_SRC
>> +    done
>> else
>>      TEST_SRC="$1"
>>      if [ ! -f $TEST_SRC ]; then
>> @@ -40,46 +113,10 @@ else
>>                  echo "file $1 does not exist"
>>                  exit 1
>>              fi
>> +            run $TEST_SRC
>>          fi
>>      fi
>> fi
>>
>> -# stop CouchDB on exit from various signals
>> -abort() {
>> -    trap - 0
>> -    ./utils/run -d
>> -    exit 2
>> -}
>> -
>> -# start CouchDB
>> -if [ -z $COUCHDB_NO_START ]; then
>> -    $MAKE dev
>> -    trap 'abort' EXIT INT
>> -	./utils/run -b -r 1 -n \
>> -		-a $BUILD_DIR/etc/couchdb/default_dev.ini \
>> -		-a $SRC_DIR/test/random_port.ini \
>> -		-a $BUILD_DIR/etc/couchdb/local_dev.ini
>> -	sleep 1 # give it a sec
>> -fi
>> -
>> -# start the tests
>> -$COUCHJS -H -u $COUCH_URI_FILE \
>> -	$SCRIPT_DIR/json2.js \
>> -	$SCRIPT_DIR/sha1.js \
>> -	$SCRIPT_DIR/oauth.js \
>> -	$SCRIPT_DIR/couch.js \
>> -	$SCRIPT_DIR/couch_test_runner.js \
>> -	$SCRIPT_DIR/couch_tests.js \
>> -	$TEST_SRC \
>> -	$JS_TEST_DIR/couch_http.js \
>> -	$JS_TEST_DIR/cli_runner.js
>> -
>> -RESULT=$?
>> -
>> -if [ -z $COUCHDB_NO_START ]; then
>> -    # stop CouchDB
>> -    ./utils/run -d
>> -    trap - 0
>> -fi
>> -
>> +trap - 0
>> exit $RESULT
>>


Re: [4/6] git commit: updated refs/heads/1.3.x to 5e64395

Posted by Dave Cottlehuber <dc...@jsonified.com>.
On 15 April 2013 20:30, Jan Lehnardt <ja...@apache.org> wrote:
>
> On Apr 10, 2013, at 02:52 , wendallc@apache.org wrote:
>
>> Refactor javascript runner script to handle couchdb restarts. Single interpreter per test.
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/9838eef7
>> Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/9838eef7
>> Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/9838eef7
>>
>> Branch: refs/heads/1.3.x
>
> Can you update NEWS & CHANGES with the test suite updates in all the relevant branches?
>
> Thanks! :)
> Jan
> --
> PS: We should really address not having to do this manually anymore. Noah, would now be
> a good time rethinking all this?

Now is a good time. Alex has some nice refactoring work that *hint*
could be pushed to an asf branch Real Soon Now, and we can roll this
into it.

In principle what we would need are 2 things:

- discplined workflow (oh noes) to ensure that all CHANGES-worthy work
has a corresponding update in .rst files, with a suitable
`version-added` tag.
- some nifty python to pull those version-added tags into a section in
the generated docs

I can write up the first part, but I'm not comfortable with the 2nd
bit, assuming its the right approach. Any takers?

A+
Dave

Re: [4/6] git commit: updated refs/heads/1.3.x to 5e64395

Posted by Jan Lehnardt <ja...@apache.org>.
On Apr 10, 2013, at 02:52 , wendallc@apache.org wrote:

> Refactor javascript runner script to handle couchdb restarts. Single interpreter per test.
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
> Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/9838eef7
> Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/9838eef7
> Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/9838eef7
> 
> Branch: refs/heads/1.3.x

Can you update NEWS & CHANGES with the test suite updates in all the relevant branches?

Thanks! :)
Jan
--
PS: We should really address not having to do this manually anymore. Noah, would now be
a good time rethinking all this? 


> Commit: 9838eef739b1522cb60399e4a15024213f18a5b9
> Parents: 0208778
> Author: Wendall Cada <we...@apache.org>
> Authored: Tue Apr 9 18:45:16 2013 -0700
> Committer: Wendall Cada <we...@apache.org>
> Committed: Tue Apr 9 18:45:16 2013 -0700
> 
> ----------------------------------------------------------------------
> test/javascript/run.tpl |  115 +++++++++++++++++++++++++++--------------
> 1 files changed, 76 insertions(+), 39 deletions(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/couchdb/blob/9838eef7/test/javascript/run.tpl
> ----------------------------------------------------------------------
> diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl
> index 647a29a..5b1e075 100644
> --- a/test/javascript/run.tpl
> +++ b/test/javascript/run.tpl
> @@ -27,9 +27,82 @@ if [ -z "$MAKE" ]; then
>     MAKE=make
> fi
> 
> +trap 'abort' EXIT INT
> +
> +start() {
> +	./utils/run -b -r 0 -n \
> +		-a $BUILD_DIR/etc/couchdb/default_dev.ini \
> +		-a $SRC_DIR/test/random_port.ini \
> +		-a $BUILD_DIR/etc/couchdb/local_dev.ini 1>/dev/null
> +}
> +
> +stop() {
> +    ./utils/run -d 1>/dev/null
> +}
> +
> +restart() {
> +    stop
> +    start
> +}
> +
> +abort() {
> +    trap - 0
> +    stop
> +    exit 2
> +}
> +
> +process_response() {
> +    while read data
> +    do
> +        if [ $data = 'restart' ];
> +        then
> +            restart
> +        else
> +            echo "$data"
> +        fi
> +    done
> +}
> +
> +run() {
> +    # start the tests
> +    echo -n "$1 ... "
> +    $COUCHJS -H -u $COUCH_URI_FILE \
> +        $SCRIPT_DIR/json2.js \
> +        $SCRIPT_DIR/sha1.js \
> +        $SCRIPT_DIR/oauth.js \
> +        $SCRIPT_DIR/couch.js \
> +        $SCRIPT_DIR/couch_test_runner.js \
> +        $JS_TEST_DIR/couch_http.js \
> +        $JS_TEST_DIR/test_setup.js \
> +        $1 \
> +        $JS_TEST_DIR/cli_runner.js | process_response
> +
> +    if [ -z $RESULT ]; then
> +        RESULT=$?
> +    elif [ "$?" -eq 1 ]; then
> +        RESULT=$?
> +    fi
> +
> +}
> +
> +# start CouchDB
> +if [ -z $COUCHDB_NO_START ]; then
> +    $MAKE dev
> +    start
> +fi
> +
> +echo "Running javascript tests ..."
> +
> if [ "$#" -eq 0 ];
> then
> -    TEST_SRC="$SCRIPT_DIR/test/*.js"
> +    COUNTER=1
> +    FILES=($SCRIPT_DIR/test/*.js)
> +    for TEST_SRC in "${FILES[@]}"
> +    do
> +        echo -n "$COUNTER/${#FILES[@]} " 
> +        let COUNTER=COUNTER+1
> +        run $TEST_SRC
> +    done
> else
>     TEST_SRC="$1"
>     if [ ! -f $TEST_SRC ]; then
> @@ -40,46 +113,10 @@ else
>                 echo "file $1 does not exist"
>                 exit 1
>             fi
> +            run $TEST_SRC
>         fi
>     fi
> fi
> 
> -# stop CouchDB on exit from various signals
> -abort() {
> -    trap - 0
> -    ./utils/run -d
> -    exit 2
> -}
> -
> -# start CouchDB
> -if [ -z $COUCHDB_NO_START ]; then
> -    $MAKE dev
> -    trap 'abort' EXIT INT
> -	./utils/run -b -r 1 -n \
> -		-a $BUILD_DIR/etc/couchdb/default_dev.ini \
> -		-a $SRC_DIR/test/random_port.ini \
> -		-a $BUILD_DIR/etc/couchdb/local_dev.ini
> -	sleep 1 # give it a sec
> -fi
> -
> -# start the tests
> -$COUCHJS -H -u $COUCH_URI_FILE \
> -	$SCRIPT_DIR/json2.js \
> -	$SCRIPT_DIR/sha1.js \
> -	$SCRIPT_DIR/oauth.js \
> -	$SCRIPT_DIR/couch.js \
> -	$SCRIPT_DIR/couch_test_runner.js \
> -	$SCRIPT_DIR/couch_tests.js \
> -	$TEST_SRC \
> -	$JS_TEST_DIR/couch_http.js \
> -	$JS_TEST_DIR/cli_runner.js
> -
> -RESULT=$?
> -
> -if [ -z $COUCHDB_NO_START ]; then
> -    # stop CouchDB
> -    ./utils/run -d
> -    trap - 0
> -fi
> -
> +trap - 0
> exit $RESULT
>