25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-24 17:29:28 +01:00

Make tests run correctly even when ejabberd src in not in ejabberd-xxx dir

This commit is contained in:
Paweł Chmielowski 2016-05-30 14:35:53 +02:00
parent e81302dc79
commit 1d3959b5a2
2 changed files with 15 additions and 4 deletions

View File

@ -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.

View File

@ -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),