Skip to content

Commit b568496

Browse files
authored
Improve Mango test harness, add Windows compat (#1733)
1 parent f12f4c5 commit b568496

File tree

4 files changed

+50
-55
lines changed

4 files changed

+50
-55
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*.snap
55
*.so
66
*.pyc
7+
*.swp
8+
*~
79
.DS_Store
810
.rebar/
911
.eunit/

Makefile

+1-4
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ endif
191191
'test/javascript/run --suites "$(suites)" \
192192
--ignore "$(ignore_js_suites)"'
193193

194-
# TODO: port to Makefile.win
195194
.PHONY: test-cluster-with-quorum
196195
test-cluster-with-quorum: devclean
197196
@mkdir -p share/www/script/test
@@ -208,7 +207,6 @@ endif
208207
--ignore "$(ignore_js_suites)" \
209208
--path test/javascript/tests-cluster/with-quorum'
210209

211-
# TODO: port to Makefile.win
212210
.PHONY: test-cluster-without-quorum
213211
test-cluster-without-quorum: devclean
214212
@mkdir -p share/www/script/test
@@ -281,8 +279,7 @@ build-test:
281279
.PHONY: mango-test
282280
# target: mango-test - Run Mango tests
283281
mango-test: devclean all
284-
./test/build/test-run-couch-for-mango.sh \
285-
282+
@cd src/mango && ../../dev/run -n 1 --admin=testuser:testpass nosetests
286283

287284
################################################################################
288285
# Developing

Makefile.win

+47-14
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ else
4040
COUCHDB_GIT_SHA=$(shell git rev-parse --short --verify HEAD)
4141
# IN_RC contains the -RCx suffix in the name if present
4242
IN_RC = $(shell git describe --tags --always --first-parent \
43-
| grep -Eo -- '-RC[0-9]+' 2>/dev/null)
43+
| grep -Eo -- '-RC[0-9]+' 2>nul)
4444
# ON_TAG matches *ONLY* if we are on a release or RC tag
4545
ON_TAG = $(shell git describe --tags --always --first-parent \
46-
| grep -Eo -- '^[0-9]+\.[0-9]\.[0-9]+(-RC[0-9]+)?$$' 2>/dev/null)
46+
| grep -Eo -- '^[0-9]+\.[0-9]\.[0-9]+(-RC[0-9]+)?$$' 2>nul)
4747
# RELTAG contains the #.#.# from git describe, which might be used
4848
RELTAG = $(shell git describe --tags --always --first-parent \
49-
| grep -Eo -- '^[0-9]+\.[0-9]\.[0-9]+' 2>/dev/null)
49+
| grep -Eo -- '^[0-9]+\.[0-9]\.[0-9]+' 2>nul)
5050
# DIRTY identifies if we're not on a commit
51-
DIRTY = $(shell git describe --dirty | grep -Eo -- '-dirty' 2>/dev/null)
51+
DIRTY = $(shell git describe --dirty | grep -Eo -- '-dirty' 2>nul)
5252

5353
ifeq ($(ON_TAG),)
5454
# 4. Not on a tag.
@@ -115,34 +115,62 @@ fauxton: share\www
115115
.PHONY: check
116116
# target: check - Test everything
117117
check: all
118+
@$(MAKE) -f Makefile.win test-cluster-with-quorum
119+
@$(MAKE) -f Makefile.win test-cluster-without-quorum
118120
@$(MAKE) -f Makefile.win eunit
119121
@$(MAKE) -f Makefile.win javascript
120122

121123

122124
.PHONY: eunit
123125
# target: eunit - Run EUnit tests, use EUNIT_OPTS to provide custom options
124-
eunit: export ERL_AFLAGS = $(shell echo "-config rel/files/eunit.config")
125-
eunit: export BUILDDIR = $(shell echo %cd%)
126126
eunit: couch
127-
@$(REBAR) setup_eunit 2> nul
128-
@$(REBAR) -r eunit $(EUNIT_OPTS)
127+
@set ERL_AFLAGS="-config rel/files/eunit.config" && set BUILDDIR = $(shell echo %cd%) && $(REBAR) setup_eunit 2> nul
128+
@set ERL_AFLAGS="-config rel/files/eunit.config" && set BUILDDIR = $(shell echo %cd%) && $(REBAR) -r eunit $(EUNIT_OPTS)
129129

130-
setup-eunit: export BUILDDIR = $(shell pwd)
131-
setup-eunit: export ERL_AFLAGS = $(shell echo "-config rel/files/eunit.config")
132130
setup-eunit:
133-
@$(REBAR) setup_eunit 2> nul
131+
@set ERL_AFLAGS="-config rel/files/eunit.config" && set BUILDDIR = $(shell echo %cd%) && $(REBAR) setup_eunit 2> nul
134132

135-
just-eunit: export BUILDDIR = $(shell pwd)
136-
just-eunit: export ERL_AFLAGS = $(shell echo "-config rel/files/eunit.config")
137133
just-eunit:
138-
@$(REBAR) -r eunit $(EUNIT_OPTS)
134+
@set ERL_AFLAGS="-config rel/files/eunit.config" && set BUILDDIR = $(shell echo %cd%) && $(REBAR) -r eunit $(EUNIT_OPTS)
135+
139136

140137
.PHONY: elixir
141138
elixir:
142139
@del /s/q dev\lib 2> nul
143140
@dev\run -a adm:pass --no-eval test\elixir\run.cmd
144141

145142

143+
.PHONY: test-cluster-with-quorum
144+
test-cluster-with-quorum: devclean
145+
-@mkdir share\www\script\test
146+
ifeq ($(IN_RELEASE), true)
147+
@copy test\javascript\tests\lorem*.txt share\www\script\test
148+
else
149+
-@mkdir src\fauxton\dist\release\test
150+
@copy test\javascript\tests\lorem*.txt src\fauxton\dist\release\test
151+
endif
152+
@dev\run -n 3 -q --with-admin-party-please \
153+
--enable-erlang-views --degrade-cluster 1 \
154+
-c "startup_jitter=0" \
155+
"python test\javascript\run --suites \"$(suites)\" \
156+
--ignore \"$(ignore_js_suites)\" \
157+
--path test\javascript\tests-cluster\with-quorum"
158+
159+
.PHONY: test-cluster-without-quorum
160+
test-cluster-without-quorum: devclean
161+
-@mkdir share\www\script\test
162+
ifeq ($(IN_RELEASE), true)
163+
@copy test\javascript\tests\lorem*.txt share\www\script\test
164+
else
165+
-@mkdir src\fauxton\dist\release\test
166+
@copy test\javascript\tests\lorem*.txt src\fauxton\dist\release\test
167+
endif
168+
@dev\run -n 3 -q --with-admin-party-please \
169+
--enable-erlang-views --degrade-cluster 2 \
170+
-c "startup_jitter=0" \
171+
"python test\javascript\run --suites \"$(suites)\" \
172+
--ignore \"$(ignore_js_suites)\" \
173+
--path test\javascript\tests-cluster\without-quorum"
146174

147175

148176
.PHONY: javascript
@@ -162,6 +190,11 @@ endif
162190
python test\javascript\run $(suites)
163191

164192

193+
.PHONY: mango-test
194+
mango-test: devclean all
195+
@cd src\mango && ..\..\dev\run -n 1 --admin=testuser:testpass nosetests
196+
197+
165198
.PHONY: check-qs
166199
# target: check-qs - Run query server tests (ruby and rspec required!)
167200
check-qs:

test/build/test-run-couch-for-mango.sh

-37
This file was deleted.

0 commit comments

Comments
 (0)