aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2016-05-30 14:35:53 +0200
committerPaweł Chmielowski <pchmielowski@process-one.net>2016-05-30 14:35:53 +0200
commit1d3959b5a2a91364ce81f1a46b35f1f6804d30cf (patch)
tree891f58a44469e1dd208a3a8eb68760e90a32cdc0 /test
parentAllow @ inside acl user{,_glob,_regexp} to pass both user and server in singl... (diff)
Make tests run correctly even when ejabberd src in not in ejabberd-xxx dir
Diffstat (limited to 'test')
-rw-r--r--test/elixir_SUITE.erl11
-rw-r--r--test/suite.erl8
2 files changed, 15 insertions, 4 deletions
diff --git a/test/elixir_SUITE.erl b/test/elixir_SUITE.erl
index 48cc94f8e..835c81052 100644
--- a/test/elixir_SUITE.erl
+++ b/test/elixir_SUITE.erl
@@ -18,6 +18,17 @@
-compile(export_all).
init_per_suite(Config) ->
+ case code:lib_dir(ejabberd) of
+ {error, _} ->
+ DataDir = proplists:get_value(data_dir, Config),
+ {ok, CWD} = file:get_cwd(),
+ NewEjPath = filename:join([CWD, "ejabberd-0.0.1"]),
+ TopDir = filename:dirname(filename:dirname(filename:dirname(DataDir))),
+ ok = file:make_symlink(TopDir, NewEjPath),
+ code:replace_path(ejabberd, NewEjPath);
+ _ ->
+ ok
+ end,
check_meck(),
code:add_pathz(filename:join(test_dir(), "../include")),
Config.
diff --git a/test/suite.erl b/test/suite.erl
index 22e328fe9..bcd54bef3 100644
--- a/test/suite.erl
+++ b/test/suite.erl
@@ -47,10 +47,10 @@ init_config(Config) ->
]),
ConfigPath = filename:join([CWD, "ejabberd.yml"]),
ok = file:write_file(ConfigPath, CfgContent),
- ok = file:make_dir(filename:join([CWD, "priv"])),
- ok = file:make_dir(filename:join([CWD, "priv", "sql"])),
- {ok, _} = file:copy(filename:join([DataDir, "..", "..", "sql", "lite.sql"]),
- filename:join([CWD, "priv", "sql", "lite.sql"])),
+ NewEjPath = filename:join([CWD, "ejabberd-0.0.1"]),
+ TopDir = filename:dirname(filename:dirname(DataDir)),
+ ok = file:make_symlink(TopDir, NewEjPath),
+ code:replace_path(ejabberd, NewEjPath),
ok = application:load(sasl),
ok = application:load(mnesia),
ok = application:load(ejabberd),