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

Run tests for mssql only if configured with --enable-mssql

This commit is contained in:
Paweł Chmielowski 2020-04-28 16:52:08 +02:00
parent 56c8f6b280
commit 25597a4326
3 changed files with 29 additions and 50 deletions

View File

@ -103,8 +103,8 @@ esac],[full_xml=false])
AC_ARG_ENABLE(mssql,
[AC_HELP_STRING([--enable-mssql], [use Microsoft SQL Server database (default: no, requires --enable-odbc)])],
[case "${enableval}" in
yes) db_type=mssql ;;
no) db_type=generic ;;
yes) db_type=mssql; mssql=true ;;
no) db_type=generic; mssql=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-mssql) ;;
esac],[db_type=generic])
@ -267,7 +267,7 @@ if test "$sqlite" = "true"; then
fi
enabled_backends=""
for backend in odbc mysql pgsql sqlite redis; do
for backend in odbc mysql pgsql sqlite redis mssql; do
if eval test x\${$backend} = xtrue; then
if test "x$enabled_backends" = "x"; then
enabled_backends=$backend

View File

@ -77,22 +77,12 @@ init_per_group(Group, Config) ->
do_init_per_group(Group, Config);
Backends ->
%% Skipped backends that were not explicitely enabled
case Group of
mssql ->
case lists:member(odbc, Backends) of
true ->
do_init_per_group(Group, Config);
false ->
{skip, {disabled_backend, Group}}
end;
_ ->
case lists:member(Group, Backends) of
true ->
do_init_per_group(Group, Config);
false ->
{skip, {disabled_backend, Group}}
end
end
case lists:member(Group, Backends) of
true ->
do_init_per_group(Group, Config);
false ->
{skip, {disabled_backend, Group}}
end
end
end.

View File

@ -138,37 +138,26 @@ init_config(Config) ->
copy_backend_configs(DataDir, CWD, Backends) ->
Files = filelib:wildcard(filename:join([DataDir, "ejabberd.*.yml"])),
lists:foreach(
fun(Src) ->
File = filename:basename(Src),
case string:tokens(File, ".") of
["ejabberd", SBackend, "yml"] ->
Backend = list_to_atom(SBackend),
Macro = list_to_atom(string:to_upper(SBackend) ++ "_CONFIG"),
Dst = filename:join([CWD, File]),
case Backend of
mssql ->
case lists:member(odbc, Backends) of
true ->
{ok, _} = file:copy(Src, Dst);
false ->
ok = file:write_file(
Dst, fast_yaml:encode(
[{define_macro, [{Macro, []}]}]))
end;
_ ->
case lists:member(Backend, Backends) of
true ->
{ok, _} = file:copy(Src, Dst);
false ->
ok = file:write_file(
Dst, fast_yaml:encode(
[{define_macro, [{Macro, []}]}]))
end
end;
_ ->
ok
end
end, Files).
fun(Src) ->
io:format("copying ~p", [Src]),
File = filename:basename(Src),
case string:tokens(File, ".") of
["ejabberd", SBackend, "yml"] ->
Backend = list_to_atom(SBackend),
Macro = list_to_atom(string:to_upper(SBackend) ++ "_CONFIG"),
Dst = filename:join([CWD, File]),
case lists:member(Backend, Backends) of
true ->
{ok, _} = file:copy(Src, Dst);
false ->
ok = file:write_file(
Dst, fast_yaml:encode(
[{define_macro, [{Macro, []}]}]))
end;
_ ->
ok
end
end, Files).
find_top_dir(Dir) ->
case file:read_file_info(filename:join([Dir, ebin])) of