This is an automated email from the ASF dual-hosted git repository.

wohali pushed a commit to branch mango-harness-windows
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 30d6471f776093550cff2673bcac3515924774bf
Author: Joan Touzet <[email protected]>
AuthorDate: Tue Nov 13 01:49:48 2018 -0500

    Improve Mango test harness, add Windows compat
---
 .gitignore                             |  2 ++
 Makefile                               |  5 +--
 Makefile.win                           | 61 ++++++++++++++++++++++++++--------
 test/build/test-run-couch-for-mango.sh | 37 ---------------------
 4 files changed, 50 insertions(+), 55 deletions(-)

diff --git a/.gitignore b/.gitignore
index 00d1b93..d6a766b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,8 @@
 *.snap
 *.so
 *.pyc
+*.swp
+*~
 .DS_Store
 .rebar/
 .eunit/
diff --git a/Makefile b/Makefile
index 4107c84..a59aabc 100644
--- a/Makefile
+++ b/Makefile
@@ -191,7 +191,6 @@ endif
             'test/javascript/run --suites "$(suites)" \
             --ignore "$(ignore_js_suites)"'
 
-# TODO: port to Makefile.win
 .PHONY: test-cluster-with-quorum
 test-cluster-with-quorum: devclean
        @mkdir -p share/www/script/test
@@ -208,7 +207,6 @@ endif
             --ignore "$(ignore_js_suites)" \
            --path test/javascript/tests-cluster/with-quorum'
 
-# TODO: port to Makefile.win
 .PHONY: test-cluster-without-quorum
 test-cluster-without-quorum: devclean
        @mkdir -p share/www/script/test
@@ -281,8 +279,7 @@ build-test:
 .PHONY: mango-test
 # target: mango-test - Run Mango tests
 mango-test: devclean all
-       ./test/build/test-run-couch-for-mango.sh \
-
+       @cd src/mango && ../../dev/run -n 1 --admin=testuser:testpass nosetests
 
 
################################################################################
 # Developing
diff --git a/Makefile.win b/Makefile.win
index e4c96b7..d0305e2 100644
--- a/Makefile.win
+++ b/Makefile.win
@@ -40,15 +40,15 @@ else
 COUCHDB_GIT_SHA=$(shell git rev-parse --short --verify HEAD)
 # IN_RC contains the -RCx suffix in the name if present
 IN_RC = $(shell git describe --tags --always --first-parent \
-        | grep -Eo -- '-RC[0-9]+' 2>/dev/null)
+        | grep -Eo -- '-RC[0-9]+' 2>nul)
 # ON_TAG matches *ONLY* if we are on a release or RC tag
 ON_TAG = $(shell git describe --tags --always --first-parent \
-        | grep -Eo -- '^[0-9]+\.[0-9]\.[0-9]+(-RC[0-9]+)?$$' 2>/dev/null)
+        | grep -Eo -- '^[0-9]+\.[0-9]\.[0-9]+(-RC[0-9]+)?$$' 2>nul)
 # RELTAG contains the #.#.# from git describe, which might be used
 RELTAG = $(shell git describe --tags --always --first-parent \
-        | grep -Eo -- '^[0-9]+\.[0-9]\.[0-9]+' 2>/dev/null)
+        | grep -Eo -- '^[0-9]+\.[0-9]\.[0-9]+' 2>nul)
 # DIRTY identifies if we're not on a commit
-DIRTY = $(shell git describe --dirty | grep -Eo -- '-dirty' 2>/dev/null)
+DIRTY = $(shell git describe --dirty | grep -Eo -- '-dirty' 2>nul)
 
 ifeq ($(ON_TAG),)
 # 4. Not on a tag.
@@ -115,27 +115,24 @@ fauxton: share\www
 .PHONY: check
 # target: check - Test everything
 check: all
+       @$(MAKE) -f Makefile.win test-cluster-with-quorum
+       @$(MAKE) -f Makefile.win test-cluster-without-quorum
        @$(MAKE) -f Makefile.win eunit
        @$(MAKE) -f Makefile.win javascript
 
 
 .PHONY: eunit
 # target: eunit - Run EUnit tests, use EUNIT_OPTS to provide custom options
-eunit: export ERL_AFLAGS = $(shell echo "-config rel/files/eunit.config")
-eunit: export BUILDDIR = $(shell echo %cd%)
 eunit: couch
-       @$(REBAR) setup_eunit 2> nul
-       @$(REBAR) -r eunit $(EUNIT_OPTS)
+       @set ERL_AFLAGS="-config rel/files/eunit.config" && set BUILDDIR = 
$(shell echo %cd%) && $(REBAR) setup_eunit 2> nul
+       @set ERL_AFLAGS="-config rel/files/eunit.config" && set BUILDDIR = 
$(shell echo %cd%) && $(REBAR) -r eunit $(EUNIT_OPTS)
 
-setup-eunit: export BUILDDIR = $(shell pwd)
-setup-eunit: export ERL_AFLAGS = $(shell echo "-config rel/files/eunit.config")
 setup-eunit:
-       @$(REBAR) setup_eunit 2> nul
+       @set ERL_AFLAGS="-config rel/files/eunit.config" && set BUILDDIR = 
$(shell echo %cd%) && $(REBAR) setup_eunit 2> nul
 
-just-eunit: export BUILDDIR = $(shell pwd)
-just-eunit: export ERL_AFLAGS = $(shell echo "-config rel/files/eunit.config")
 just-eunit:
-       @$(REBAR) -r eunit $(EUNIT_OPTS)
+       @set ERL_AFLAGS="-config rel/files/eunit.config" && set BUILDDIR = 
$(shell echo %cd%) && $(REBAR) -r eunit $(EUNIT_OPTS)
+
 
 .PHONY: elixir
 elixir:
@@ -143,6 +140,37 @@ elixir:
        @dev\run -a adm:pass --no-eval test\elixir\run.cmd
 
 
+.PHONY: test-cluster-with-quorum
+test-cluster-with-quorum: devclean
+       -@mkdir share\www\script\test
+ifeq ($(IN_RELEASE), true)
+       @copy test\javascript\tests\lorem*.txt share\www\script\test
+else
+       -@mkdir src\fauxton\dist\release\test
+       @copy test\javascript\tests\lorem*.txt src\fauxton\dist\release\test
+endif
+       @dev\run -n 3 -q --with-admin-party-please \
+               --enable-erlang-views --degrade-cluster 1 \
+               -c "startup_jitter=0" \
+               "python test\javascript\run --suites \"$(suites)\" \
+               --ignore \"$(ignore_js_suites)\" \
+               --path test\javascript\tests-cluster\with-quorum"
+
+.PHONY: test-cluster-without-quorum
+test-cluster-without-quorum: devclean
+       -@mkdir share\www\script\test
+ifeq ($(IN_RELEASE), true)
+       @copy test\javascript\tests\lorem*.txt share\www\script\test
+else
+       -@mkdir src\fauxton\dist\release\test
+       @copy test\javascript\tests\lorem*.txt src\fauxton\dist\release\test
+endif
+       @dev\run -n 3 -q --with-admin-party-please \
+               --enable-erlang-views --degrade-cluster 2 \
+               -c "startup_jitter=0" \
+               "python test\javascript\run --suites \"$(suites)\" \
+               --ignore \"$(ignore_js_suites)\" \
+               --path test\javascript\tests-cluster\without-quorum"
 
 
 .PHONY: javascript
@@ -162,6 +190,11 @@ endif
                python test\javascript\run $(suites)
 
 
+.PHONY: mango-test
+mango-test: devclean all
+       @cd src\mango && ..\..\dev\run -n 1 --admin=testuser:testpass nosetests
+
+
 .PHONY: check-qs
 # target: check-qs - Run query server tests (ruby and rspec required!)
 check-qs:
diff --git a/test/build/test-run-couch-for-mango.sh 
b/test/build/test-run-couch-for-mango.sh
deleted file mode 100755
index 472b19b..0000000
--- a/test/build/test-run-couch-for-mango.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-# 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
-# the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-
-./dev/run -n 1 --admin=testuser:testpass &
-export SERVER_PID=$!
-
-COUCH_STARTED=-1
-while ( [ $COUCH_STARTED -ne 0 ] ); do
-  curl -s http://127.0.0.1:15984
-  COUCH_STARTED=$?
-  if [ $COUCH_STARTED -ne 0 ]; then
-    # do not wait another 5 seconds if couch started now
-    sleep 5
-  fi
-done
-
-# wait for cluster setup to complete
-sleep 5
-
-cd src/mango/
-nosetests
-
-EXIT_STATUS=$?
-if [ ! -z "$SERVER_PID" ]; then
-  kill $SERVER_PID
-fi
-exit $EXIT_STATUS

Reply via email to