Skip to content

Commit

Permalink
Support Erlang 27.0
Browse files Browse the repository at this point in the history
Removes no-longer supported OTP version 24. Migrates from 'slave' to
'peer' in test code.
  • Loading branch information
eproxus committed Feb 15, 2024
1 parent aa278c1 commit b62eee8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/erlang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Erlang ${{matrix.otp}} / rebar ${{matrix.rebar3}}
strategy:
matrix:
otp: ['24', '25', '26']
otp: ['25', '26', '27.0-rc1']
rebar3: ['3']
steps:

Expand Down
24 changes: 10 additions & 14 deletions test/meck_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1347,32 +1347,28 @@ remote_meck_test_() ->
fun remote_meck_cover_/1]]}.

remote_setup() ->
[] = os:cmd("epmd -daemon"),
Hostname = case node() of
'nonode@nohost' -> "localhost";
_ -> test_server_sup:hoststr()
end,
Myself = list_to_atom("meck_eunit_test@" ++ Hostname),
net_kernel:start([Myself, shortnames]),
{ok, Node} = slave:start_link(list_to_atom(Hostname), meck_remote_test,
"-pa \"" ++ test_dir() ++ "\""),
net_kernel:start([meck_eunit_test]),
{ok, Pid, Node} = peer:start_link(#{
name => meck_remote_test,
args => ["-pa", test_dir()]
}),
{Mod, Bin, File} = code:get_object_code(meck),
true = rpc:call(Node, code, add_path, [filename:dirname(File)]),
{module, Mod} = rpc:call(Node, code, load_binary, [Mod, File, Bin]),
{module, meck_test_module} =
rpc:call(Node, code, load_file, [meck_test_module]),
{Node, meck_test_module}.
{Pid, Node, meck_test_module}.

remote_teardown({Node, _Mod}) ->
ok = slave:stop(Node),
remote_teardown({Pid, _Node, _Mod}) ->
ok = peer:stop(Pid),
ok = net_kernel:stop().

remote_meck_({Node, Mod}) ->
remote_meck_({_Pid, Node, Mod}) ->
?assertEqual(ok, rpc:call(Node, meck, new, [Mod, [no_link, non_strict]])),
?assertEqual(ok, rpc:call(Node, meck, expect, [Mod, test, 0, true])),
?assertEqual(true, rpc:call(Node, Mod, test, [])).

remote_meck_cover_({Node, Mod}) ->
remote_meck_cover_({_Pid, Node, Mod}) ->
{ok, Mod} = cover:compile(test_file(Mod, ".erl")),
{ok, _Nodes} = cover:start([Node]),
?assertEqual(ok, rpc:call(Node, meck, new, [Mod])).
Expand Down

0 comments on commit b62eee8

Please sign in to comment.