Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation errors in EQC tests. #481

Merged
merged 4 commits into from
Dec 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ ebin/*.beam
ebin/*.app
deps
.eunit
.eqc-info
.qc/
current_counterexample.eqc
erl_crash.dump
repl_leader_eqc_data/
2 changes: 1 addition & 1 deletion test/riak_core_cluster_mgr_sup_tests.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-module(riak_core_cluster_mgr_sup_tests).
-compile(export_all).
-ifdef(EQC).
-include_lib("riak_core/include/riak_core_connection.hrl").
-include("riak_core_connection.hrl").
-include_lib("eunit/include/eunit.hrl").

murdering_test_() ->
Expand Down
2 changes: 1 addition & 1 deletion test/riak_core_cluster_mgr_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
-compile(export_all).

-include("riak_core_cluster.hrl").
-include_lib("riak_core/include/riak_core_connection.hrl").
-include("riak_core_connection.hrl").
-include_lib("eunit/include/eunit.hrl").

-define(TRACE(Stmt),Stmt).
Expand Down
16 changes: 8 additions & 8 deletions test/rt_sink_eqc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ precondition(S, {call, _, push_object, _Args}) ->
S#state.sources /= [];
precondition(S, {call, _, Connect, [Remote]}) when Connect == connect_from_v1; Connect == connect_from_v2 ->
lists:member(Remote, S#state.remotes_available);
precondition(S, {call, _, Connect, [#src_state{done_fun_queue = []}, _]}) ->
precondition(_S, {call, _, _Connect, [#src_state{done_fun_queue = []}, _]}) ->
false;
precondition(_S, _Call) ->
true.
Expand Down Expand Up @@ -256,7 +256,7 @@ postcondition(_S, {call, _, push_object, [{_Remote, #src_state{version = 1} = Sr
_QWhat ->
false
end;
postcondition(S, {call, _, push_object, [{Remote, #src_state{version = 2} = SrcState}, RiakObj, AlreadyRouted]}, Res) ->
postcondition(_S, {call, _, push_object, [{Remote, #src_state{version = 2} = _SrcState}, _RiakObj, _AlreadyRouted]}, Res) ->
RTQRes = Res#push_result.rtq_res,
HelperRes = Res#push_result.donefun,
Routed = lists:member(Remote, Res#push_result.already_routed),
Expand Down Expand Up @@ -304,7 +304,7 @@ postcondition(_S, {call, _, call_donefun, [{Remote, SrcState}, NthDoneFun]}, Res
case riak_repl2_rtframe:decode(TCPBin) of
{ok, {ack, _SomeSeq}, <<>>} ->
true;
FrameDecode ->
_FrameDecode ->
false
end;
{1, {{error, timeout}, {error, timeout}}} ->
Expand Down Expand Up @@ -483,7 +483,7 @@ start_service_manager() ->

abstract_fake_source() ->
riak_repl_test_util:reset_meck(fake_source, [no_link, non_strict]),
meck:expect(fake_source, connected, fun(Socket, Transport, Endpoint, Proto, Pid, Props) ->
meck:expect(fake_source, connected, fun(Socket, Transport, Endpoint, Proto, Pid, _Props) ->
Transport:controlling_process(Socket, Pid),
gen_server:call(Pid, {connected, Socket, Endpoint, Proto})
end).
Expand All @@ -508,7 +508,7 @@ fake_rtq(Bug, Queue) ->
Bug ! Got,
Queue2 = [{NumItems, Bin, Meta} | Queue],
fake_rtq(Bug, Queue2);
Else ->
_Else ->
ok
end.

Expand Down Expand Up @@ -537,7 +537,7 @@ connect_source(Version, Remote) ->
{active, false}],
ClientSpec = {{realtime, [Version]}, {TcpOptions, fake_source, Pid}},
IpPort = {{127,0,0,1}, ?SINK_PORT},
ConnRes = riak_core_connection:sync_connect(IpPort, ClientSpec),
riak_core_connection:sync_connect(IpPort, ClientSpec),
{ok, Pid}.

fake_source_push_obj(Source, Binary, AlreadyRouted) ->
Expand Down Expand Up @@ -565,7 +565,7 @@ fake_source_loop(#fake_source{socket = undefined} = State) ->
{'$gen_call', From, Aroo} ->
gen_server:reply(From, {error, badcall}),
exit({badcall, Aroo});
What ->
_ ->
fake_source_loop(State)
end;
fake_source_loop(State) ->
Expand Down Expand Up @@ -618,7 +618,7 @@ fake_source_loop(State) ->
fake_source_loop(State#fake_source{tcp_bug = NewBug});
{tcp_closed, Socket} when Socket == State#fake_source.socket ->
ok;
What ->
_ ->
fake_source_loop(State)
end.

Expand Down
16 changes: 8 additions & 8 deletions test/rt_source_eqc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ initial_state() ->
{ok, _FakeSinkPid} = start_fake_sink(),
#state{}.

next_state(S, Res, {call, _, connect_to_v1, [Remote, MQ]}) ->
next_state(S, Res, {call, _, connect_to_v1, [Remote, _MQ]}) ->
SrcState = #src_state{pids = Res, version = 1},
next_state_connect(Remote, SrcState, S);

next_state(S, Res, {call, _, connect_to_v2, [Remote, MQ]}) ->
next_state(S, Res, {call, _, connect_to_v2, [Remote, _MQ]}) ->
SrcState = #src_state{pids = Res, version = 2},
next_state_connect(Remote, SrcState, S);

Expand Down Expand Up @@ -205,11 +205,11 @@ generate_unacked_from_master(State, Remote) ->

generate_unacked_from_master([], _UpRemotes, _Remote, Skips, Offset, Acc) ->
{Acc, Skips, Offset};
generate_unacked_from_master([{Seq, tombstone} | Tail], UpRemotes, Remote, undefined, Offset, Acc) ->
generate_unacked_from_master([{_Seq, tombstone} | Tail], UpRemotes, Remote, undefined, Offset, Acc) ->
generate_unacked_from_master(Tail, UpRemotes, Remote, undefined, Offset, Acc);
generate_unacked_from_master([{Seq, tombstone} | Tail], UpRemotes, Remote, Skips, Offset, Acc) ->
generate_unacked_from_master([{_Seq, tombstone} | Tail], UpRemotes, Remote, Skips, Offset, Acc) ->
generate_unacked_from_master(Tail, UpRemotes, Remote, Skips + 1, Offset, Acc);
generate_unacked_from_master([{Seq, Remotes, Binary, Res} | Tail], UpRemotes, Remote, Skips, Offset, Acc) ->
generate_unacked_from_master([{Seq, Remotes, _Binary, Res} | Tail], UpRemotes, Remote, Skips, Offset, Acc) ->
case {lists:member(Remote, Remotes), Skips} of
{true, undefined} ->
% on start up, we don't worry about skips until we've sent at least
Expand Down Expand Up @@ -474,9 +474,9 @@ connect_to_v1(RemoteName, MasterQueue) ->
connect_to_v2(RemoteName, MasterQueue) ->
stateful:set(version, {realtime, {2,0}, {2,0}}),
stateful:set(remote, RemoteName),
Before = now(),
now(),
{ok, SourcePid} = riak_repl2_rtsource_conn:start_link(RemoteName),
After = now(),
now(),
receive
{sink_started, SinkPid} ->
erlang:monitor(process, SinkPid),
Expand Down Expand Up @@ -648,7 +648,7 @@ fake_sink(Socket, Version, Bug, History) ->
fake_sink(Socket, Version, Bug, History);
{'$gen_call', From, {block_until, HistoryLength}} ->
fake_sink(Socket, Version, {block_until, From, HistoryLength}, History);
{'$gen_call', From, Msg} ->
{'$gen_call', From, _Msg} ->
gen_server:reply(From, {error, badcall}),
fake_sink(Socket, Version, Bug, History);
{tcp, Socket, Bin} ->
Expand Down