Skip to content

Commit

Permalink
Merge pull request #4462 from esl/MIM-2362_warnings
Browse files Browse the repository at this point in the history
Fix compilation warnings
  • Loading branch information
NelsonVides authored Jan 20, 2025
2 parents 5013daf + b73d1a5 commit c9d23ae
Show file tree
Hide file tree
Showing 20 changed files with 28 additions and 685 deletions.
2 changes: 1 addition & 1 deletion big_tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ console: $(PREPARE)
erl $(COMMON_OPTS) $(ADD_OPTS) -s run_common_test init

compile: get-deps deps
$(RUN) $(REBAR) compile
@ERL_LIBS="../_build/prod/lib" $(RUN) $(REBAR) compile

get-deps:
$(RUN) $(REBAR) deps
Expand Down
8 changes: 4 additions & 4 deletions big_tests/src/ct_mongoose_hook.erl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ post_end_per_suite(Suite, Config, Return, State) ->
{Return, State}.

%% @doc Called before each init_per_group.
pre_init_per_group(Group,Config,State) ->
pre_init_per_group(_Group,Config,State) ->
{Config, State}.

%% @doc Called after each init_per_group.
Expand All @@ -78,15 +78,15 @@ pre_end_per_group(_Group,Config,State) ->
{Config, State}.

%% @doc Called after each end_per_group.
post_end_per_group(Group,_Config,Return,State) ->
post_end_per_group(_Group,_Config,Return,State) ->
{Return, State}.

%% @doc Called before each test case.
pre_init_per_testcase(TC,Config,State) ->
pre_init_per_testcase(_TC,Config,State) ->
{Config, State}.

%% @doc Called after each test case.
post_end_per_testcase(TC,_Config,Return,State) ->
post_end_per_testcase(_TC,_Config,Return,State) ->
{Return, State}.

%% @doc Called after post_init_per_suite, post_end_per_suite, post_init_per_group,
Expand Down
4 changes: 2 additions & 2 deletions big_tests/src/ct_mongoose_log_hook.erl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pre_init_per_suite(Suite, Config, State) ->
{Config, State#state{group=no_group, suite=Suite}}.

%% @doc Called before end_per_suite.
post_end_per_suite(_Suite, Config, Return, State = #state{node_name = undefined}) ->
post_end_per_suite(_Suite, Config, _Return, State = #state{node_name = undefined}) ->
{Config, State};
post_end_per_suite(Suite, _Config, Return, State) ->
maybe_print_log_on_mim_node(suite, finishing, Suite, State),
Expand Down Expand Up @@ -334,7 +334,7 @@ maybe_print_log_on_mim_node(Type, Event, Name, #state{log_flags = LogFlags, node
ok
end.

maybe_file_write(State = #state{print_init_and_done_for_testcases = true}, Writer, Message) ->
maybe_file_write(#state{print_init_and_done_for_testcases = true}, Writer, Message) ->
file:write(Writer, Message);
maybe_file_write(_State, _Writer, _Message) ->
ok.
4 changes: 2 additions & 2 deletions big_tests/src/ct_test_hook.erl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-export([pre_init_per_testcase/4, post_init_per_testcase/5,
pre_end_per_testcase/4, post_end_per_testcase/5]).

-record(state,{log = [], ref = make_ref()}).
-record(state,{log = []}).
-define(MFA, {?MODULE, ?FUNCTION_NAME, ?FUNCTION_ARITY}).
% -define(ADD_LOG(State), (State)).
-define(ADD_LOG(State), (State#state{log = [?MFA | State#state.log]})).
Expand Down Expand Up @@ -100,4 +100,4 @@ tracer_fun(Msg, State) ->
stop_tracing() ->
%% this function is idempotent and can be safely called multiple times
timer:sleep(10000),
dbg:stop_clear().
dbg:stop().
2 changes: 1 addition & 1 deletion big_tests/src/ct_tty_hook.erl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ post_end_per_suite(Suite,_Config,Return,State) ->
total = State#state.total + State#state.suite_total } }.

%% @doc Called before each test case.
pre_init_per_testcase(TC,Config,State = #state{suite_total = Total})
pre_init_per_testcase(_TC,Config,State = #state{suite_total = Total})
when is_integer(Total) ->
{Config, State#state{ ts = os:timestamp(), total = Total + 1 } };
pre_init_per_testcase(_TC, Config, State) ->
Expand Down
6 changes: 3 additions & 3 deletions big_tests/tests/cets_disco_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -237,19 +237,19 @@ address_please(_Config) ->
{error, nxdomain} =
rpc(mim(), mongoose_epmd, address_please, ["mongooseim", "badbadhost", inet]).

address_please_returns_ip(Config) ->
address_please_returns_ip(_Config) ->
Res = rpc(mim(), mongoose_epmd, address_please, ["testmim2", "localhost", inet]),
Info = rpc(mim(), cets_discovery, system_info, [mongoose_cets_discovery]),
ct:log("system_info ~p", [Info]),
{ok, {192, 168, 115, 112}} = Res.

address_please_returns_ip_fallbacks_to_resolve_with_file_backend(Config) ->
address_please_returns_ip_fallbacks_to_resolve_with_file_backend(_Config) ->
Res = rpc(mim2(), mongoose_epmd, address_please, ["testmim1", "localhost", inet]),
Info = rpc(mim2(), cets_discovery, system_info, [mongoose_cets_discovery]),
ct:log("system_info ~p", [Info]),
{ok, {127, 0, 0, 1}} = Res.

address_please_returns_ip_127_0_0_1_from_db(Config) ->
address_please_returns_ip_127_0_0_1_from_db(_Config) ->
Res = rpc(mim2(), mongoose_epmd, address_please, ["node1", "localhost", inet]),
Info = rpc(mim2(), cets_discovery, system_info, [mongoose_cets_discovery]),
ct:log("system_info ~p", [Info]),
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/graphql_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ listener_reply_with_validation_error(Config) ->
Ep = ?config(schema_endpoint, Config),
Body = #{<<"query">> => <<"query Q1 { field } query Q1 { field }">>,
<<"operationName">> => <<"Q1">>},
{Status, Data} = execute(Ep, Body, undefined).
{_Status, _Data} = execute(Ep, Body, undefined).

multiple_categories_query_test(Config) ->
Status = execute_auth(user_check_auth_multiple(), Config),
Expand Down
4 changes: 1 addition & 3 deletions big_tests/tests/graphql_mnesia_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,7 @@ mnesia_info_check() ->
<<"dc_dump_limit">> => check_integer,
<<"send_compressed">> => check_integer,
<<"max_transfer_size">> => check_integer,
<<"version">> => check_binary,
<<"db_nodes">> => check_list,
<<"running_db_nodes">> => check_list}.
<<"version">> => check_binary}.

check_list(L) ->
lists:all(fun(Item) -> is_binary(Item) end, L).
Expand Down
5 changes: 2 additions & 3 deletions big_tests/tests/mam_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,8 @@ send_rsm_messages(Config) ->
F = fun(Alice, Bob) ->
%% Alice sends messages to Bob.
[escalus:send(Alice,
escalus_stanza:chat_to(Bob, generate_message_text(N)))
|| N <- lists:seq(1, N)],
escalus_stanza:chat_to(Bob, generate_message_text(K)))
|| K <- lists:seq(1, N)],
assert_list_size(N, escalus:wait_for_stanzas(Bob, N)),
wait_for_archive_size(Alice, N),

Expand Down Expand Up @@ -896,7 +896,6 @@ parse_messages(Messages) ->
end.

bootstrap_archive(Config) ->
random:seed(os:timestamp()),
AliceJID = escalus_users:get_jid(Config, alice),
BobJID = escalus_users:get_jid(Config, bob),
CarolJID = escalus_users:get_jid(Config, carol),
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/mod_global_distrib_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ print_sessions_debug_info(NodeName) ->
PidNodes = [{Pid, node(Pid)} || Pid <- Pids],
ct:log("Pids on nodes ~p", [PidNodes]),

Info = [{Pid, rpc:call(Node, erlang, process_info, [Pid])} || {Pid, Node} <- PidNodes],
Info = [{Pid, rpc:call(N, erlang, process_info, [Pid])} || {Pid, N} <- PidNodes],
ct:log("Processes info ~p", [Info]),
ok.

Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/muc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2506,7 +2506,7 @@ subject(ConfigIn) ->
escalus:wait_for_stanza(Bob),
Stanza = escalus:wait_for_stanza(Bob),
Subject = exml_query:path(Stanza, [{element, <<"subject">>}, cdata]),
Subject == ?SUBJECT,
?assert_equal(?SUBJECT, Subject),
TimeStamp = exml_query:path(Stanza, [{element, <<"delay">>}, {attr, <<"stamp">>}]),
SystemTime = calendar:rfc3339_to_system_time(binary_to_list(TimeStamp), [{unit, second}]),
true = is_integer(SystemTime)
Expand Down
1 change: 0 additions & 1 deletion big_tests/tests/offline_stub_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ init_per_testcase(Name, Config0) ->
escalus:init_per_testcase(Name, Config1).

end_per_testcase(Name, Config) ->
HostType = domain_helper:host_type(),
dynamic_modules:restore_modules(Config),
escalus:end_per_testcase(Name, Config).

Expand Down
1 change: 0 additions & 1 deletion big_tests/tests/pep_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,6 @@ required_modules() ->
pep_mapping => #{},
host => subhost_pattern("pubsub.@HOST@")})}].
required_modules(cache_tests) ->
HostType = domain_helper:host_type(),
[{mod_caps, config_parser_helper:mod_config_with_auto_backend(mod_caps)},
{mod_pubsub, mod_config(mod_pubsub, #{plugins => [<<"dag">>, <<"pep">>],
nodetree => nodetree_dag,
Expand Down
6 changes: 0 additions & 6 deletions big_tests/tests/persistent_cluster_id_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ init_per_group(rdbms, Config) ->
false -> {skip, require_rdbms}
end;
init_per_group(_, Config) ->
case not mongoose_helper:is_rdbms_enabled(host_type()) of
true ->
Config;
false -> {skip, require_no_rdbms}
end;
init_per_group(mnesia, Config) ->
case not mongoose_helper:is_rdbms_enabled(host_type()) of
true -> Config;
false -> {skip, require_no_rdbms}
Expand Down
1 change: 0 additions & 1 deletion big_tests/tests/s2s_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ malformed_jid(Config) ->
end).

dialback_with_wrong_key(_Config) ->
HostType = domain_helper:host_type(mim),
MimDomain = domain_helper:domain(mim),
FedDomain = domain_helper:domain(fed),
FromTo = {MimDomain, FedDomain},
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/start_node_id_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ end_per_testcase(CaseName, Config) ->
%% Test cases
%%--------------------------------------------------------------------

cleaning_works(Config) ->
cleaning_works(_Config) ->
Id = <<"someid139455">>,
Pid = spawn_link(fun() -> receive stop -> ok end end),
ok = rpc(mim(), mongoose_start_node_id, register_on_remote_node_rpc, [node(), Id, Pid]),
Expand Down
6 changes: 1 addition & 5 deletions src/gen_mod.erl
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,7 @@ is_mim_or_ct_running() ->
orelse is_common_test_running().

is_common_test_running() ->
try
is_list(ct:get_status())
catch _:_ ->
false
end.
whereis(ct_util_server) =/= undefined.

-spec is_app_running(_) -> boolean().
is_app_running(AppName) ->
Expand Down
Loading

0 comments on commit c9d23ae

Please sign in to comment.