fix(bpapi): Add 5.5 dump
This commit is contained in:
parent
5ed20e15cd
commit
4b3c29ded8
|
@ -59,7 +59,8 @@
|
||||||
-define(FORCE_DELETED_APIS, [
|
-define(FORCE_DELETED_APIS, [
|
||||||
{emqx_statsd, 1},
|
{emqx_statsd, 1},
|
||||||
{emqx_plugin_libs, 1},
|
{emqx_plugin_libs, 1},
|
||||||
{emqx_persistent_session, 1}
|
{emqx_persistent_session, 1},
|
||||||
|
{emqx_ds, 3}
|
||||||
]).
|
]).
|
||||||
%% List of known RPC backend modules:
|
%% List of known RPC backend modules:
|
||||||
-define(RPC_MODULES, "gen_rpc, erpc, rpc, emqx_rpc").
|
-define(RPC_MODULES, "gen_rpc, erpc, rpc, emqx_rpc").
|
||||||
|
@ -119,17 +120,16 @@ check_compat(DumpFilenames) ->
|
||||||
|
|
||||||
%% Note: sets nok flag
|
%% Note: sets nok flag
|
||||||
-spec check_compat(fulldump(), fulldump()) -> ok.
|
-spec check_compat(fulldump(), fulldump()) -> ok.
|
||||||
check_compat(Dump1 = #{release := Rel1}, Dump2 = #{release := Rel2}) ->
|
check_compat(Dump1 = #{release := Rel1}, Dump2 = #{release := Rel2}) when Rel2 >= Rel1 ->
|
||||||
check_api_immutability(Dump1, Dump2),
|
check_api_immutability(Dump1, Dump2),
|
||||||
Rel2 >= Rel1 andalso
|
typecheck_apis(Dump1, Dump2);
|
||||||
typecheck_apis(Dump1, Dump2).
|
check_compat(_, _) ->
|
||||||
|
ok.
|
||||||
|
|
||||||
%% It's not allowed to change BPAPI modules. Check that no changes
|
%% It's not allowed to change BPAPI modules. Check that no changes
|
||||||
%% have been made. (sets nok flag)
|
%% have been made. (sets nok flag)
|
||||||
-spec check_api_immutability(fulldump(), fulldump()) -> ok.
|
-spec check_api_immutability(fulldump(), fulldump()) -> ok.
|
||||||
check_api_immutability(#{release := Rel1, api := APIs1}, #{release := Rel2, api := APIs2}) when
|
check_api_immutability(#{release := Rel1, api := APIs1}, #{release := Rel2, api := APIs2}) ->
|
||||||
Rel2 >= Rel1
|
|
||||||
->
|
|
||||||
%% TODO: Handle API deprecation
|
%% TODO: Handle API deprecation
|
||||||
_ = maps:map(
|
_ = maps:map(
|
||||||
fun(Key = {API, Version}, Val) ->
|
fun(Key = {API, Version}, Val) ->
|
||||||
|
@ -137,14 +137,15 @@ check_api_immutability(#{release := Rel1, api := APIs1}, #{release := Rel2, api
|
||||||
Val ->
|
Val ->
|
||||||
ok;
|
ok;
|
||||||
undefined ->
|
undefined ->
|
||||||
case lists:member({API, Version}, ?FORCE_DELETED_APIS) of
|
case lists:member(Key, ?FORCE_DELETED_APIS) of
|
||||||
true ->
|
true ->
|
||||||
ok;
|
ok;
|
||||||
false ->
|
false ->
|
||||||
setnok(),
|
setnok(),
|
||||||
logger:error(
|
logger:error(
|
||||||
"API ~p v~p was removed in release ~p without being deprecated.",
|
"API ~p v~p was removed in release ~p without being deprecated. "
|
||||||
[API, Version, Rel2]
|
"Old release: ~p",
|
||||||
|
[API, Version, Rel2, Rel1]
|
||||||
)
|
)
|
||||||
end;
|
end;
|
||||||
_Val ->
|
_Val ->
|
||||||
|
@ -157,8 +158,6 @@ check_api_immutability(#{release := Rel1, api := APIs1}, #{release := Rel2, api
|
||||||
end,
|
end,
|
||||||
APIs1
|
APIs1
|
||||||
),
|
),
|
||||||
ok;
|
|
||||||
check_api_immutability(_, _) ->
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
filter_calls(Calls) ->
|
filter_calls(Calls) ->
|
||||||
|
@ -181,8 +180,8 @@ typecheck_apis(
|
||||||
AllCalls = filter_calls(AllCalls0),
|
AllCalls = filter_calls(AllCalls0),
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun({From, To}) ->
|
fun({From, To}) ->
|
||||||
Caller = get_param_types(CallerSigs, From),
|
Caller = get_param_types(CallerSigs, From, From),
|
||||||
Callee = get_param_types(CalleeSigs, To),
|
Callee = get_param_types(CalleeSigs, From, To),
|
||||||
%% TODO: check return types
|
%% TODO: check return types
|
||||||
case typecheck_rpc(Caller, Callee) of
|
case typecheck_rpc(Caller, Callee) of
|
||||||
[] ->
|
[] ->
|
||||||
|
@ -226,8 +225,8 @@ typecheck_rpc(Caller, Callee) ->
|
||||||
Callee
|
Callee
|
||||||
).
|
).
|
||||||
|
|
||||||
-spec get_param_types(dialyzer_dump(), emqx_bpapi:call()) -> param_types().
|
%%-spec get_param_types(dialyzer_dump(), emqx_bpapi:call()) -> param_types().
|
||||||
get_param_types(Signatures, {M, F, A}) ->
|
get_param_types(Signatures, From, {M, F, A}) ->
|
||||||
Arity = length(A),
|
Arity = length(A),
|
||||||
case Signatures of
|
case Signatures of
|
||||||
#{{M, F, Arity} := {_RetType, AttrTypes}} ->
|
#{{M, F, Arity} := {_RetType, AttrTypes}} ->
|
||||||
|
@ -235,7 +234,7 @@ get_param_types(Signatures, {M, F, A}) ->
|
||||||
Arity = length(AttrTypes),
|
Arity = length(AttrTypes),
|
||||||
maps:from_list(lists:zip(A, AttrTypes));
|
maps:from_list(lists:zip(A, AttrTypes));
|
||||||
_ ->
|
_ ->
|
||||||
logger:critical("Call ~p:~p/~p is not found in PLT~n", [M, F, Arity]),
|
logger:critical("Call ~p:~p/~p from ~p is not found in PLT~n", [M, F, Arity, From]),
|
||||||
error({badkey, {M, F, A}})
|
error({badkey, {M, F, A}})
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue