Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nouveau/**/* text eol=lf
nouveau/**/*.bat text eol=crlf
nouveau/**/*.jar binary
extra/nouveau/**/* text eol=lf
extra/nouveau/**/*.bat text eol=crlf
extra/nouveau/**/*.jar binary
78 changes: 42 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include version.mk
REBAR?=$(CURDIR)/bin/rebar
REBAR3?=$(CURDIR)/bin/rebar3
ERLFMT?=$(CURDIR)/bin/erlfmt
GRADLE?=$(CURDIR)/nouveau/gradlew
GRADLE?=$(CURDIR)/extra/nouveau/gradlew

# Handle the following scenarios:
# 1. When building from a tarball, use version.mk.
Expand Down Expand Up @@ -106,7 +106,7 @@ endif

.PHONY: all
# target: all - Build everything
all: couch fauxton docs escriptize nouveau
all: couch-core fauxton docs escriptize extra/nouveau


.PHONY: help
Expand All @@ -123,9 +123,9 @@ help:
################################################################################


.PHONY: couch
# target: couch - Build CouchDB core, use ERL_COMPILER_OPTIONS to provide custom compiler's options
couch: config.erl
.PHONY: couch-core
# target: couch-core - Build CouchDB core, use ERL_COMPILER_OPTIONS to provide custom compiler's options
couch-core: config.erl
@COUCHDB_VERSION=$(COUCHDB_VERSION) COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) $(REBAR) compile $(COMPILE_OPTS)
ifeq ($(with_spidermonkey), true)
@cp src/couch/priv/couchjs bin/
Expand All @@ -146,7 +146,7 @@ fauxton: share/www

.PHONY: escriptize
# target: escriptize - Build CLI tools
escriptize: couch
escriptize: couch-core
@$(REBAR) -r escriptize apps=weatherreport
@cp src/weatherreport/weatherreport bin/weatherreport

Expand All @@ -155,36 +155,42 @@ escriptize: couch
# Testing
################################################################################


.PHONY: check
CHECKS="xref elixir eunit elixir-search weatherreport-test nouveau-test"
.PHONY: check $(CHECKS)
# target: check - Test everything
check: all
@$(MAKE) xref
@$(MAKE) eunit
@$(MAKE) mango-test
@$(MAKE) elixir
@$(MAKE) elixir-search
@$(MAKE) weatherreport-test
@$(MAKE) nouveau-test
check: all $(CHECKS)
@${MAKE} mango-test
@${MAKE} nouveau-test

ifdef apps
subdirs = $(apps)
SUBDIRS = $(apps)
else
subdirs=$(shell ls src)
SUBDIRS=$(shell ls src)
endif

.PHONY: eunit
# Used for comparing behaviour against he new `eunit` target, delete once we
# are happy with the new `eunit`.
.PHONY: old-eunit
old-eunit: export BUILDDIR = $(CURDIR)
old-eunit: export ERL_AFLAGS = -config $(CURDIR)/rel/files/eunit.config
old-eunit: export COUCHDB_QUERY_SERVER_JAVASCRIPT = $(CURDIR)/bin/couchjs $(CURDIR)/share/server/main.js
old-eunit: export COUCHDB_TEST_ADMIN_PARTY_OVERRIDE=1
old-eunit:
@COUCHDB_VERSION=$(COUCHDB_VERSION) COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) $(REBAR) setup_eunit 2> /dev/null
@for dir in $(SUBDIRS); do \
COUCHDB_VERSION=$(COUCHDB_VERSION) COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) $(REBAR) -r eunit $(EUNIT_OPTS) apps=$$dir || exit 1; \
done

# target: eunit - Run EUnit tests, use EUNIT_OPTS to provide custom options
.PHONY: eunit $(SUBDIRS)
eunit: export BUILDDIR = $(CURDIR)
eunit: export ERL_AFLAGS = -config $(CURDIR)/rel/files/eunit.config
eunit: export COUCHDB_QUERY_SERVER_JAVASCRIPT = $(CURDIR)/bin/couchjs $(CURDIR)/share/server/main.js
eunit: export COUCHDB_TEST_ADMIN_PARTY_OVERRIDE=1
eunit: couch
@COUCHDB_VERSION=$(COUCHDB_VERSION) COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) $(REBAR) setup_eunit 2> /dev/null
@for dir in $(subdirs); do \
COUCHDB_VERSION=$(COUCHDB_VERSION) COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) $(REBAR) -r eunit $(EUNIT_OPTS) apps=$$dir || exit 1; \
done
eunit: ${SUBDIRS}

$(SUBDIRS): setup-eunit
@COUCHDB_VERSION=$(COUCHDB_VERSION) COUCHDB_GIT_SHA=$(COUCHDB_GIT_SHA) $(REBAR) -r eunit $(EUNIT_OPTS) apps=$@ #|| exit 1

setup-eunit: export BUILDDIR = $(CURDIR)
setup-eunit: export ERL_AFLAGS = -config $(CURDIR)/rel/files/eunit.config
Expand All @@ -199,7 +205,7 @@ just-eunit:
.PHONY: soak-eunit
soak-eunit: export BUILDDIR = $(CURDIR)
soak-eunit: export ERL_AFLAGS = -config $(CURDIR)/rel/files/eunit.config
soak-eunit: couch
soak-eunit: couch-core
@$(REBAR) setup_eunit 2> /dev/null
while [ $$? -eq 0 ] ; do $(REBAR) -r eunit $(EUNIT_OPTS) ; done

Expand Down Expand Up @@ -356,7 +362,7 @@ weatherreport-test: devclean escriptize

.PHONY: quickjs-test262
# target: quickjs-javascript-tests - Run QuickJS JS conformance tests
quickjs-test262: couch
quickjs-test262: couch-core
make -C src/couch_quickjs/quickjs test2-bootstrap
make -C src/couch_quickjs/quickjs test2

Expand Down Expand Up @@ -450,8 +456,8 @@ endif

ifeq ($(with_nouveau), true)
@mkdir rel/couchdb/nouveau
@cd nouveau && $(GRADLE) installDist
@cp -R nouveau/build/install/nouveau rel/couchdb
@cd extra/nouveau && $(GRADLE) installDist
@cp -R extra/nouveau/build/install/nouveau rel/couchdb
endif

@echo "... done"
Expand Down Expand Up @@ -500,7 +506,7 @@ clean:
@rm -rf src/couch_dist/certs/out
@rm -rf src/docs/build src/docs/.venv
ifeq ($(with_nouveau), true)
@cd nouveau && $(GRADLE) clean
@cd extra/nouveau && $(GRADLE) clean
endif


Expand Down Expand Up @@ -565,28 +571,28 @@ derived:
# Nouveau
################################################################################

.PHONY: nouveau
.PHONY: extra/nouveau
# target: nouveau - Build nouveau
nouveau:
extra/nouveau:
ifeq ($(with_nouveau), true)
@cd nouveau && $(GRADLE) spotlessApply
@cd nouveau && $(GRADLE) build -x test
@cd extra/nouveau && $(GRADLE) spotlessApply
@cd extra/nouveau && $(GRADLE) build -x test
endif

.PHONY: nouveau-test
# target: nouveau-test - Run nouveau tests
nouveau-test: nouveau-test-gradle nouveau-test-elixir

.PHONY: nouveau-test-gradle
nouveau-test-gradle: couch nouveau
nouveau-test-gradle: couch-core extra/nouveau
ifeq ($(with_nouveau), true)
@cd nouveau && $(GRADLE) test --info --rerun
@cd extra/nouveau && $(GRADLE) test --info --rerun
endif

.PHONY: nouveau-test-elixir
nouveau-test-elixir: export MIX_ENV=integration
nouveau-test-elixir: elixir-init devclean
nouveau-test-elixir: couch nouveau
nouveau-test-elixir: couch-core extra/nouveau
ifeq ($(with_nouveau), true)
@dev/run "$(TEST_OPTS)" -n 1 -q -a adm:pass --with-nouveau \
--locald-config test/config/test-config.ini \
Expand Down
16 changes: 16 additions & 0 deletions README-DEV.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,22 @@ to specify exact ``rebar eunit`` options::

make eunit EUNIT_OPTS="apps=couch,chttpd"

Running Erlang tests in Parallel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you have GNU make (`gmake`) installed, you can supply a `-jN` parameter to
run as many jobs in parallel. To avoid clobbering output, use the
`--output-sync` option.

gmake eunit -j2 --output-sync=target

This runs two test modules in parallel at a time. On a machine with two or more
CPUs, this should reduce the total wall clock time of testing to up to one half.

Higher `N` might also work, but the test suite is still undergoing hardening to
support full parallelism, so spurious errors that do not occur with `-j1` might
show up.

Elixir Integration Tests
~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
4 changes: 2 additions & 2 deletions dev/run
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def boot_nouveau(ctx):
config = os.path.join(ctx["devdir"], "lib", "nouveau.yaml")
gradle = "gradlew.bat" if os.name == "nt" else "gradlew"
cmd = [
os.path.join(ctx["rootdir"], "nouveau", gradle),
os.path.join(ctx["rootdir"], "extra", "nouveau", gradle),
"run",
"--args",
f"server '{config}'",
Expand All @@ -555,7 +555,7 @@ def boot_nouveau(ctx):
log = open(logfname, "w")
return sp.Popen(
cmd,
cwd=os.path.join(ctx["rootdir"], "nouveau"),
cwd=os.path.join(ctx["rootdir"], "extra", "nouveau"),
stdin=sp.PIPE,
stdout=log,
stderr=sp.STDOUT,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading