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,15 +77,6 @@ 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
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 case lists:member(Group, Backends) of
true -> true ->
do_init_per_group(Group, Config); do_init_per_group(Group, Config);
@ -93,7 +84,6 @@ init_per_group(Group, Config) ->
{skip, {disabled_backend, Group}} {skip, {disabled_backend, Group}}
end end
end end
end
end. end.
do_init_per_group(no_db, Config) -> do_init_per_group(no_db, Config) ->

View File

@ -139,23 +139,13 @@ 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) ->
io:format("copying ~p", [Src]),
File = filename:basename(Src), File = filename:basename(Src),
case string:tokens(File, ".") of case string:tokens(File, ".") of
["ejabberd", SBackend, "yml"] -> ["ejabberd", SBackend, "yml"] ->
Backend = list_to_atom(SBackend), Backend = list_to_atom(SBackend),
Macro = list_to_atom(string:to_upper(SBackend) ++ "_CONFIG"), Macro = list_to_atom(string:to_upper(SBackend) ++ "_CONFIG"),
Dst = filename:join([CWD, File]), 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 case lists:member(Backend, Backends) of
true -> true ->
{ok, _} = file:copy(Src, Dst); {ok, _} = file:copy(Src, Dst);
@ -163,7 +153,6 @@ copy_backend_configs(DataDir, CWD, Backends) ->
ok = file:write_file( ok = file:write_file(
Dst, fast_yaml:encode( Dst, fast_yaml:encode(
[{define_macro, [{Macro, []}]}])) [{define_macro, [{Macro, []}]}]))
end
end; end;
_ -> _ ->
ok ok