summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2014-09-05 13:04:11 +0100
committerRobert Newson <rnewson@apache.org>2014-09-05 13:04:11 +0100
commit63d6d6409e8a721961c632075d6e2e80ff34c113 (patch)
treeadbc8f45dfafb5d100949667bba74cc42a79ccd7
parent475591e1960147bbfeacc69fdb05f0914afd4df6 (diff)
parent95da8e13d1ccfdba2f2eaf68bd8bec501aa1280c (diff)
downloadcouchdb-63d6d6409e8a721961c632075d6e2e80ff34c113.tar.gz
Merge remote-tracking branch 'origin/1963-eunit-bigcouch'
-rw-r--r--.gitignore1
-rw-r--r--Makefile4
-rw-r--r--NOTICE8
-rw-r--r--rebar.config.script10
-rw-r--r--rel/overlay/etc/eunit.ini28
-rw-r--r--rel/plugins/eunit_plugin.erl39
-rw-r--r--setup_eunit.template18
7 files changed, 103 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index ad9479d23..d56dc6b9d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@ rel/dev*
rel/tmpdata
src/
/log
+tmp/
*.o
*.so
diff --git a/Makefile b/Makefile
index 71c147e3b..4e376f09c 100644
--- a/Makefile
+++ b/Makefile
@@ -63,8 +63,10 @@ docker-start:
docker-stop:
@docker stop `cat .docker-id`
+eunit: export BUILDDIR = $(shell pwd)
eunit:
- @rebar eunit skip_deps=meck,mochiweb,lager
+ @rebar setup_eunit
+ @rebar -r eunit skip_deps=meck,mochiweb,lager,snappy,couch_replicator,fabric
javascript:
@dev/run test/javascript/run
diff --git a/NOTICE b/NOTICE
index 41c180714..921eebf85 100644
--- a/NOTICE
+++ b/NOTICE
@@ -193,3 +193,11 @@ This product also includes the following third-party components:
* velocity.js (https://github.com/julianshapiro/velocity)
Copyright (c) 2014 Julian Shapiro
+
+* is_base_dir function in eunit_plugin.erl (https://github.com/ChicagoBoss/ChicagoBoss/blob/master/skel/priv/rebar/boss_plugin.erl)
+
+ Copyright (c) 2009-2011 Evan Miller
+
+* ?assertNotMatch in couch_eunit.hrl (https://github.com/richcarl/eunit/blob/master/include/eunit.hrl#L200-L219)
+
+ Copyright (C) 2004-2006 Mickaël Rémond, Richard Carlsson
diff --git a/rebar.config.script b/rebar.config.script
index d58d85f2e..029ce068b 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -20,12 +20,12 @@ DepDescs = [
{b64url, "b64url", {branch, "master"}},
{cassim, "cassim", {branch, "master"}},
{couch_log, "couch-log", {branch, "master"}},
- {config, "config", {branch, "master"}},
+ {config, "config", {branch, "1963-eunit-bigcouch"}},
{chttpd, "chttpd", {branch, "master"}},
- {couch, "couch", {branch, "master"}},
+ {couch, "couch", {branch, "1963-eunit-bigcouch"}},
{couch_index, "couch-index", {branch, "master"}},
- {couch_mrview, "couch-mrview", {branch, "master"}},
- {couch_replicator, "couch-replicator", {branch, "master"}},
+ {couch_mrview, "couch-mrview", {branch, "1963-eunit-bigcouch"}},
+ {couch_replicator, "couch-replicator", {branch, "1963-eunit-bigcouch"}},
{couch_dbupdates, "couch-dbupdates", {branch, "master"}},
{couch_plugins, "couch-plugins", {branch, "master"}},
{couch_event, "couch-event", {branch, "master"}},
@@ -65,6 +65,8 @@ AddConfig = [
{sub_dirs, ["rel"]},
{lib_dirs, ["src/"]},
{erl_opts, [debug_info]},
+ {eunit_opts, [verbose]},
+ {plugins, [eunit_plugin]},
{post_hooks, [{compile, "escript support/build_js.escript"}]}
],
diff --git a/rel/overlay/etc/eunit.ini b/rel/overlay/etc/eunit.ini
new file mode 100644
index 000000000..50024a375
--- /dev/null
+++ b/rel/overlay/etc/eunit.ini
@@ -0,0 +1,28 @@
+; Licensed to the Apache Software Foundation (ASF) under one
+; or more contributor license agreements. See the NOTICE file
+; distributed with this work for additional information
+; regarding copyright ownership. The ASF licenses this file
+; to you 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.
+
+[couchdb]
+; time to relax!
+uuid = 74696d6520746f2072656c617821
+
+[httpd]
+port = 0
+
+[log]
+; logging is disabled to remove unwanted noise in stdout from tests processing
+level = none
+include_sasl = false
diff --git a/rel/plugins/eunit_plugin.erl b/rel/plugins/eunit_plugin.erl
new file mode 100644
index 000000000..bbf83d2ec
--- /dev/null
+++ b/rel/plugins/eunit_plugin.erl
@@ -0,0 +1,39 @@
+% 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.
+
+-module(eunit_plugin).
+
+
+-export([setup_eunit/2]).
+
+
+setup_eunit(Config, AppFile) ->
+ case is_base_dir(Config) of
+ false -> ok;
+ true -> build_eunit_config(Config, AppFile)
+ end.
+
+
+%% from https://github.com/ChicagoBoss/ChicagoBoss/blob/master/skel/priv/rebar/boss_plugin.erl
+is_base_dir(RebarConf) ->
+ filename:absname(rebar_utils:get_cwd()) =:= rebar_config:get_xconf(RebarConf, base_dir, undefined).
+
+
+build_eunit_config(Config0, AppFile) ->
+ Cwd = filename:absname(rebar_utils:get_cwd()),
+ DataDir = Cwd ++ "/tmp/data",
+ ViewIndexDir = Cwd ++ "/tmp/data",
+ Config1 = rebar_config:set_global(Config0, template, "setup_eunit"),
+ Config2 = rebar_config:set_global(Config1, prefix, Cwd),
+ Config3 = rebar_config:set_global(Config2, data_dir, DataDir),
+ Config = rebar_config:set_global(Config3, view_index_dir, ViewIndexDir),
+ rebar_templater:create(Config, AppFile).
diff --git a/setup_eunit.template b/setup_eunit.template
new file mode 100644
index 000000000..13659705e
--- /dev/null
+++ b/setup_eunit.template
@@ -0,0 +1,18 @@
+{variables, [
+ {package_author_name, "The Apache Software Foundation"},
+ {cluster_port, 5984},
+ {backend_port, 5986},
+ {node_name, "-name couchdbtest@127.0.0.1"},
+
+ {data_dir, "/tmp"},
+ {prefix, "/tmp"},
+ {view_index_dir, "/tmp"}
+]}.
+{dir, "tmp"}.
+{dir, "tmp/etc"}.
+{dir, "tmp/data"}.
+{dir, "tmp/tmp_data"}.
+{template, "rel/overlay/etc/default.ini", "tmp/etc/default_eunit.ini"}.
+{template, "rel/overlay/etc/local.ini", "tmp/etc/local_eunit.ini"}.
+{template, "rel/overlay/etc/eunit.ini", "tmp/etc/eunit.ini"}.
+{template, "rel/overlay/etc/vm.args", "tmp/etc/vm.args"}.