25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +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_ARG_ENABLE(mssql,
[AC_HELP_STRING([--enable-mssql], [use Microsoft SQL Server database (default: no, requires --enable-odbc)])], [AC_HELP_STRING([--enable-mssql], [use Microsoft SQL Server database (default: no, requires --enable-odbc)])],
[case "${enableval}" in [case "${enableval}" in
yes) db_type=mssql ;; yes) db_type=mssql; mssql=true ;;
no) db_type=generic ;; no) db_type=generic; mssql=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-mssql) ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-mssql) ;;
esac],[db_type=generic]) esac],[db_type=generic])
@ -267,7 +267,7 @@ if test "$sqlite" = "true"; then
fi fi
enabled_backends="" 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 eval test x\${$backend} = xtrue; then
if test "x$enabled_backends" = "x"; then if test "x$enabled_backends" = "x"; then
enabled_backends=$backend enabled_backends=$backend

View File

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

View File

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