summaryrefslogtreecommitdiff
path: root/test/etap
diff options
context:
space:
mode:
authorPaul Joseph Davis <davisp@apache.org>2009-11-09 00:39:16 +0000
committerPaul Joseph Davis <davisp@apache.org>2009-11-09 00:39:16 +0000
commite29a1924afe9e6051369f7bcbf44ccdf53de536a (patch)
treee9511858c1ca8faf7b051c38b712982cb051caba /test/etap
parentc114565bff170785c1352142dc1a28557a91dd97 (diff)
Fixes 'make distcheck' to run the test suite.
Quite a few changes to the build system to handle VPATH builds appropriately as well as make the test suite know about them. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@833951 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/etap')
-rwxr-xr-xtest/etap/001-load.t4
-rw-r--r--test/etap/002-erl-driver.t3
-rwxr-xr-xtest/etap/010-file-basics.t5
-rwxr-xr-xtest/etap/011-file-headers.t5
-rwxr-xr-xtest/etap/020-btree-basics.t5
-rwxr-xr-xtest/etap/021-btree-reductions.t3
-rwxr-xr-xtest/etap/030-doc-from-json.t3
-rwxr-xr-xtest/etap/031-doc-to-json.t3
-rwxr-xr-xtest/etap/040-util.t3
-rwxr-xr-xtest/etap/041-uuid-gen.t9
-rwxr-xr-xtest/etap/050-stream.t3
-rwxr-xr-xtest/etap/060-kt-merging.t3
-rwxr-xr-xtest/etap/061-kt-missing-leaves.t3
-rwxr-xr-xtest/etap/062-kt-remove-leaves.t3
-rwxr-xr-xtest/etap/063-kt-get-leaves.t3
-rwxr-xr-xtest/etap/064-kt-counting.t3
-rwxr-xr-xtest/etap/065-kt-stemming.t3
-rwxr-xr-xtest/etap/070-couch-db.t4
-rwxr-xr-xtest/etap/080-config-get-set.t5
-rwxr-xr-xtest/etap/081-config-override.t11
-rwxr-xr-xtest/etap/082-config-register.t5
-rwxr-xr-xtest/etap/083-config-no-files.t5
-rwxr-xr-xtest/etap/090-task-status.t3
-rwxr-xr-xtest/etap/100-ref-counter.t3
-rwxr-xr-xtest/etap/110-replication-httpc.t16
-rwxr-xr-xtest/etap/111-replication-changes-feed.t17
-rwxr-xr-xtest/etap/112-replication-missing-revs.t16
-rwxr-xr-xtest/etap/120-stats-collect.t3
-rwxr-xr-xtest/etap/121-stats-aggregates.t13
-rw-r--r--test/etap/Makefile.am64
-rw-r--r--test/etap/run.tpl27
-rw-r--r--test/etap/test_util.erl.in35
32 files changed, 198 insertions, 93 deletions
diff --git a/test/etap/001-load.t b/test/etap/001-load.t
index f42ab3db..6f49e1ba 100755
--- a/test/etap/001-load.t
+++ b/test/etap/001-load.t
@@ -1,6 +1,5 @@
#!/usr/bin/env escript
%% -*- erlang -*-
-%%! -pa src/couchdb -sasl errlog_type error -boot start_sasl -noshell
% 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
@@ -17,8 +16,7 @@
% Test that we can load each module.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(37),
Modules = [
couch_btree,
diff --git a/test/etap/002-erl-driver.t b/test/etap/002-erl-driver.t
index 4a2a40da..f353eda4 100644
--- a/test/etap/002-erl-driver.t
+++ b/test/etap/002-erl-driver.t
@@ -13,8 +13,7 @@
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(3),
etap:is(
couch_util:start_driver("src/couchdb/.libs"),
diff --git a/test/etap/010-file-basics.t b/test/etap/010-file-basics.t
index b6c95a6f..09b2f2b1 100755
--- a/test/etap/010-file-basics.t
+++ b/test/etap/010-file-basics.t
@@ -12,11 +12,10 @@
% License for the specific language governing permissions and limitations under
% the License.
-filename() -> "./test/etap/temp.010".
+filename() -> test_util:build_file("test/etap/temp.010").
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(16),
case (catch test()) of
ok ->
diff --git a/test/etap/011-file-headers.t b/test/etap/011-file-headers.t
index d26629c0..4705f629 100755
--- a/test/etap/011-file-headers.t
+++ b/test/etap/011-file-headers.t
@@ -14,12 +14,11 @@
% License for the specific language governing permissions and limitations under
% the License.
-filename() -> "./test/etap/temp.011".
+filename() -> test_util:build_file("test/etap/temp.011").
sizeblock() -> 4096. % Need to keep this in sync with couch_file.erl
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
{S1, S2, S3} = now(),
random:seed(S1, S2, S3),
diff --git a/test/etap/020-btree-basics.t b/test/etap/020-btree-basics.t
index 93a139fb..18c4a836 100755
--- a/test/etap/020-btree-basics.t
+++ b/test/etap/020-btree-basics.t
@@ -14,14 +14,13 @@
% License for the specific language governing permissions and limitations under
% the License.
-filename() -> "./test/etap/temp.020".
+filename() -> test_util:build_file("test/etap/temp.020").
rows() -> 250.
-record(btree, {fd, root, extract_kv, assemble_kv, less, reduce}).
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(48),
case (catch test()) of
ok ->
diff --git a/test/etap/021-btree-reductions.t b/test/etap/021-btree-reductions.t
index 64d390ed..3e19c767 100755
--- a/test/etap/021-btree-reductions.t
+++ b/test/etap/021-btree-reductions.t
@@ -18,8 +18,7 @@ filename() -> "./test/etap/temp.021".
rows() -> 1000.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(8),
case (catch test()) of
ok ->
diff --git a/test/etap/030-doc-from-json.t b/test/etap/030-doc-from-json.t
index 45763173..dc3327aa 100755
--- a/test/etap/030-doc-from-json.t
+++ b/test/etap/030-doc-from-json.t
@@ -20,8 +20,7 @@
-record(att, {name, type, len, md5= <<>>, revpos=0, data}).
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(26),
case (catch test()) of
ok ->
diff --git a/test/etap/031-doc-to-json.t b/test/etap/031-doc-to-json.t
index 00440abe..4e0c3f74 100755
--- a/test/etap/031-doc-to-json.t
+++ b/test/etap/031-doc-to-json.t
@@ -20,8 +20,7 @@
-record(att, {name, type, len, md5= <<>>, revpos=0, data}).
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(12),
case (catch test()) of
ok ->
diff --git a/test/etap/040-util.t b/test/etap/040-util.t
index c4dffc4d..6d6da2c1 100755
--- a/test/etap/040-util.t
+++ b/test/etap/040-util.t
@@ -14,8 +14,7 @@
% the License.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
application:start(crypto),
etap:plan(11),
diff --git a/test/etap/041-uuid-gen.t b/test/etap/041-uuid-gen.t
index b61141fc..1e6aa9ee 100755
--- a/test/etap/041-uuid-gen.t
+++ b/test/etap/041-uuid-gen.t
@@ -14,13 +14,13 @@
% the License.
default_config() ->
- "etc/couchdb/default_dev.ini".
+ test_util:build_file("etc/couchdb/default_dev.ini").
seq_alg_config() ->
- "test/etap/041-uuid-gen-seq.ini".
+ test_util:source_file("test/etap/041-uuid-gen-seq.ini").
utc_alg_config() ->
- "test/etap/041-uuid-gen-utc.ini".
+ test_util:source_file("test/etap/041-uuid-gen-utc.ini").
% Run tests and wait for the gen_servers to shutdown
run_test(IniFiles, Test) ->
@@ -38,8 +38,7 @@ run_test(IniFiles, Test) ->
end.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
application:start(crypto),
etap:plan(6),
diff --git a/test/etap/050-stream.t b/test/etap/050-stream.t
index b3bce45f..9324916c 100755
--- a/test/etap/050-stream.t
+++ b/test/etap/050-stream.t
@@ -14,8 +14,7 @@
% the License.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(13),
case (catch test()) of
ok ->
diff --git a/test/etap/060-kt-merging.t b/test/etap/060-kt-merging.t
index 17f77e3d..d6b13d6d 100755
--- a/test/etap/060-kt-merging.t
+++ b/test/etap/060-kt-merging.t
@@ -14,8 +14,7 @@
% the License.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(16),
case (catch test()) of
ok ->
diff --git a/test/etap/061-kt-missing-leaves.t b/test/etap/061-kt-missing-leaves.t
index d1dc3fd7..d60b4db8 100755
--- a/test/etap/061-kt-missing-leaves.t
+++ b/test/etap/061-kt-missing-leaves.t
@@ -14,8 +14,7 @@
% the License.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(4),
case (catch test()) of
ok ->
diff --git a/test/etap/062-kt-remove-leaves.t b/test/etap/062-kt-remove-leaves.t
index 9c33475b..745a00be 100755
--- a/test/etap/062-kt-remove-leaves.t
+++ b/test/etap/062-kt-remove-leaves.t
@@ -14,8 +14,7 @@
% the License.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(6),
case (catch test()) of
ok ->
diff --git a/test/etap/063-kt-get-leaves.t b/test/etap/063-kt-get-leaves.t
index a8fa3e94..6d4e8007 100755
--- a/test/etap/063-kt-get-leaves.t
+++ b/test/etap/063-kt-get-leaves.t
@@ -14,8 +14,7 @@
% the License.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(11),
case (catch test()) of
ok ->
diff --git a/test/etap/064-kt-counting.t b/test/etap/064-kt-counting.t
index b68215b5..f182d287 100755
--- a/test/etap/064-kt-counting.t
+++ b/test/etap/064-kt-counting.t
@@ -14,8 +14,7 @@
% the License.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(4),
case (catch test()) of
ok ->
diff --git a/test/etap/065-kt-stemming.t b/test/etap/065-kt-stemming.t
index 6dfe9380..6e781c1d 100755
--- a/test/etap/065-kt-stemming.t
+++ b/test/etap/065-kt-stemming.t
@@ -14,8 +14,7 @@
% the License.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(3),
case (catch test()) of
ok ->
diff --git a/test/etap/070-couch-db.t b/test/etap/070-couch-db.t
index ba381277..bf20dc0a 100755
--- a/test/etap/070-couch-db.t
+++ b/test/etap/070-couch-db.t
@@ -14,9 +14,7 @@
% the License.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
- code:add_pathz("src/mochiweb"),
+ test_util:init_code_path(),
etap:plan(4),
case (catch test()) of
diff --git a/test/etap/080-config-get-set.t b/test/etap/080-config-get-set.t
index 7702fb07..a4a8577a 100755
--- a/test/etap/080-config-get-set.t
+++ b/test/etap/080-config-get-set.t
@@ -14,11 +14,10 @@
% the License.
default_config() ->
- "etc/couchdb/default_dev.ini".
+ test_util:build_file("etc/couchdb/default_dev.ini").
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(12),
case (catch test()) of
ok ->
diff --git a/test/etap/081-config-override.t b/test/etap/081-config-override.t
index e96e3c23..01f8b4c2 100755
--- a/test/etap/081-config-override.t
+++ b/test/etap/081-config-override.t
@@ -14,16 +14,16 @@
% the License.
default_config() ->
- "etc/couchdb/default_dev.ini".
+ test_util:build_file("etc/couchdb/default_dev.ini").
local_config_1() ->
- "test/etap/081-config-override.1.ini".
+ test_util:source_file("test/etap/081-config-override.1.ini").
local_config_2() ->
- "test/etap/081-config-override.2.ini".
+ test_util:source_file("test/etap/081-config-override.2.ini").
local_config_write() ->
- "test/etap/temp.081".
+ test_util:build_file("test/etap/temp.081").
% Run tests and wait for the config gen_server to shutdown.
run_tests(IniFiles, Tests) ->
@@ -39,8 +39,7 @@ run_tests(IniFiles, Tests) ->
end.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(17),
case (catch test()) of
diff --git a/test/etap/082-config-register.t b/test/etap/082-config-register.t
index d484db11..191ba8f8 100755
--- a/test/etap/082-config-register.t
+++ b/test/etap/082-config-register.t
@@ -14,11 +14,10 @@
% the License.
default_config() ->
- "etc/couchdb/default_dev.ini".
+ test_util:build_file("etc/couchdb/default_dev.ini").
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(5),
case (catch test()) of
ok ->
diff --git a/test/etap/083-config-no-files.t b/test/etap/083-config-no-files.t
index 0d513cef..675feb59 100755
--- a/test/etap/083-config-no-files.t
+++ b/test/etap/083-config-no-files.t
@@ -14,11 +14,10 @@
% the License.
default_config() ->
- "etc/couchdb/default_dev.ini".
+ test_util:build_file("etc/couchdb/default_dev.ini").
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(3),
case (catch test()) of
ok ->
diff --git a/test/etap/090-task-status.t b/test/etap/090-task-status.t
index 26cff33a..b6ebbe4c 100755
--- a/test/etap/090-task-status.t
+++ b/test/etap/090-task-status.t
@@ -14,8 +14,7 @@
% the License.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(16),
case (catch test()) of
ok ->
diff --git a/test/etap/100-ref-counter.t b/test/etap/100-ref-counter.t
index c2c233e1..6f18d828 100755
--- a/test/etap/100-ref-counter.t
+++ b/test/etap/100-ref-counter.t
@@ -14,8 +14,7 @@
% the License.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(8),
case (catch test()) of
ok ->
diff --git a/test/etap/110-replication-httpc.t b/test/etap/110-replication-httpc.t
index a84491f1..492732bc 100755
--- a/test/etap/110-replication-httpc.t
+++ b/test/etap/110-replication-httpc.t
@@ -38,12 +38,14 @@
server() -> "http://127.0.0.1:5984/".
dbname() -> "etap-test-db".
+config_files() ->
+ lists:map(fun test_util:build_file/1, [
+ "etc/couchdb/default_dev.ini",
+ "etc/couchdb/local_dev.ini"
+ ]).
+
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
- code:add_pathz("src/ibrowse"),
- code:add_pathz("src/mochiweb"),
- code:add_pathz("src/erlang-oauth"),
+ test_util:init_code_path(),
etap:plan(6),
case (catch test()) of
@@ -56,9 +58,7 @@ main(_) ->
ok.
test() ->
- couch_server_sup:start_link(
- ["etc/couchdb/default_dev.ini", "etc/couchdb/local_dev.ini"]
- ),
+ couch_server_sup:start_link(config_files()),
ibrowse:start(),
crypto:start(),
diff --git a/test/etap/111-replication-changes-feed.t b/test/etap/111-replication-changes-feed.t
index 10cea201..b03c1ac7 100755
--- a/test/etap/111-replication-changes-feed.t
+++ b/test/etap/111-replication-changes-feed.t
@@ -37,12 +37,15 @@
pause = 1,
conn = nil
}).
+
+config_files() ->
+ lists:map(fun test_util:build_file/1, [
+ "etc/couchdb/default_dev.ini",
+ "etc/couchdb/local_dev.ini"
+ ]).
+
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
- code:add_pathz("src/ibrowse"),
- code:add_pathz("src/mochiweb"),
- code:add_pathz("src/erlang-oauth"),
+ test_util:init_code_path(),
etap:plan(13),
case (catch test()) of
@@ -55,9 +58,7 @@ main(_) ->
ok.
test() ->
- couch_server_sup:start_link(
- ["etc/couchdb/default_dev.ini", "etc/couchdb/local_dev.ini"]
- ),
+ couch_server_sup:start_link(config_files()),
ibrowse:start(),
crypto:start(),
diff --git a/test/etap/112-replication-missing-revs.t b/test/etap/112-replication-missing-revs.t
index cfb11f35..8aabfd37 100755
--- a/test/etap/112-replication-missing-revs.t
+++ b/test/etap/112-replication-missing-revs.t
@@ -39,12 +39,14 @@
conn = nil
}).
+config_files() ->
+ lists:map(fun test_util:build_file/1, [
+ "etc/couchdb/default_dev.ini",
+ "etc/couchdb/local_dev.ini"
+ ]).
+
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
- code:add_pathz("src/ibrowse"),
- code:add_pathz("src/mochiweb"),
- code:add_pathz("src/erlang-oauth"),
+ test_util:init_code_path(),
etap:plan(12),
case (catch test()) of
@@ -57,9 +59,7 @@ main(_) ->
ok.
test() ->
- couch_server_sup:start_link(
- ["etc/couchdb/default_dev.ini", "etc/couchdb/local_dev.ini"]
- ),
+ couch_server_sup:start_link(config_files()),
ibrowse:start(),
crypto:start(),
diff --git a/test/etap/120-stats-collect.t b/test/etap/120-stats-collect.t
index a870bfef..dee88765 100755
--- a/test/etap/120-stats-collect.t
+++ b/test/etap/120-stats-collect.t
@@ -14,8 +14,7 @@
% the License.
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(11),
case (catch test()) of
ok ->
diff --git a/test/etap/121-stats-aggregates.t b/test/etap/121-stats-aggregates.t
index 9caa36ff..cd6b1430 100755
--- a/test/etap/121-stats-aggregates.t
+++ b/test/etap/121-stats-aggregates.t
@@ -13,9 +13,14 @@
% License for the specific language governing permissions and limitations under
% the License.
+ini_file() ->
+ test_util:source_file("test/etap/121-stats-aggregates.ini").
+
+cfg_file() ->
+ test_util:source_file("test/etap/121-stats-aggregates.cfg").
+
main(_) ->
- code:add_patha("src/etap"),
- code:add_pathz("src/couchdb"),
+ test_util:init_code_path(),
etap:plan(17),
case (catch test()) of
ok ->
@@ -27,9 +32,9 @@ main(_) ->
ok.
test() ->
- couch_config:start_link(["test/etap/121-stats-aggregates.ini"]),
+ couch_config:start_link([ini_file()]),
couch_stats_collector:start(),
- couch_stats_aggregator:start("test/etap/121-stats-aggregates.cfg"),
+ couch_stats_aggregator:start(cfg_file()),
ok = test_all_empty(),
ok = test_get_empty(),
ok = test_count_stats(),
diff --git a/test/etap/Makefile.am b/test/etap/Makefile.am
new file mode 100644
index 00000000..03685d0e
--- /dev/null
+++ b/test/etap/Makefile.am
@@ -0,0 +1,64 @@
+## 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.
+
+check_SCRIPTS = run
+noinst_DATA = test_util.beam
+
+%.beam: %.erl
+ erlc $<
+
+run: run.tpl
+ sed -e "s|%abs_top_srcdir%|@abs_top_srcdir@|g" \
+ -e "s|%abs_top_builddir%|@abs_top_builddir@|g" > \
+ $@ < $<
+ chmod +x $@
+
+CLEANFILES = run *.beam
+DISTCLEANFILES = temp.*
+
+EXTRA_DIST = \
+ run.tpl \
+ 001-load.t \
+ 002-erl-driver.t \
+ 010-file-basics.t \
+ 011-file-headers.t \
+ 020-btree-basics.t \
+ 021-btree-reductions.t \
+ 030-doc-from-json.t \
+ 031-doc-to-json.t \
+ 040-util.t \
+ 041-uuid-gen-seq.ini \
+ 041-uuid-gen-utc.ini \
+ 041-uuid-gen.t \
+ 050-stream.t \
+ 060-kt-merging.t \
+ 061-kt-missing-leaves.t \
+ 062-kt-remove-leaves.t \
+ 063-kt-get-leaves.t \
+ 064-kt-counting.t \
+ 065-kt-stemming.t \
+ 070-couch-db.t \
+ 080-config-get-set.t \
+ 081-config-override.1.ini \
+ 081-config-override.2.ini \
+ 081-config-override.t \
+ 082-config-register.t \
+ 083-config-no-files.t \
+ 090-task-status.t \
+ 100-ref-counter.t \
+ 110-replication-httpc.t \
+ 111-replication-changes-feed.t \
+ 112-replication-missing-revs.t \
+ 120-stats-collect.t \
+ 121-stats-aggregates.cfg \
+ 121-stats-aggregates.ini \
+ 121-stats-aggregates.t
diff --git a/test/etap/run.tpl b/test/etap/run.tpl
new file mode 100644
index 00000000..faf0f456
--- /dev/null
+++ b/test/etap/run.tpl
@@ -0,0 +1,27 @@
+#!/bin/sh -e
+
+# 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.
+
+SRCDIR="%abs_top_srcdir%"
+BUILDIR="%abs_top_builddir%"
+
+export ERL_FLAGS="$ERL_FLAGS -pa $BUILDIR/test/etap/"
+
+if test $# -gt 0; then
+ while [ $# -gt 0 ]; do
+ $1
+ shift
+ done
+else
+ prove $SRCDIR/test/etap/*.t
+fi
diff --git a/test/etap/test_util.erl.in b/test/etap/test_util.erl.in
new file mode 100644
index 00000000..4c42edb1
--- /dev/null
+++ b/test/etap/test_util.erl.in
@@ -0,0 +1,35 @@
+% 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(test_util).
+
+-export([init_code_path/0]).
+-export([source_file/1, build_file/1]).
+
+srcdir() ->
+ "@abs_top_srcdir@".
+
+builddir() ->
+ "@abs_top_builddir@".
+
+init_code_path() ->
+ Paths = ["etap", "couchdb", "erlang-oauth", "ibrowse", "mochiweb"],
+ lists:foreach(fun(Name) ->
+ code:add_pathz(filename:join([builddir(), "src", Name]))
+ end, Paths).
+
+source_file(Name) ->
+ filename:join([srcdir(), Name]).
+
+build_file(Name) ->
+ filename:join([builddir(), Name]).
+