WIP: wip wip a doowip

This commit is contained in:
Scott Lystig Fritchie 2015-06-02 22:13:15 +09:00
parent 2207151eba
commit c1318d3bbb
10 changed files with 38 additions and 11 deletions

View file

@ -29,7 +29,7 @@ edoc-clean:
pulse: compile
env USE_PULSE=1 $(REBAR_BIN) skip_deps=true clean compile
env USE_PULSE=1 $(REBAR_BIN) skip_deps=true -D PULSE eunit
env USE_PULSE=1 $(REBAR_BIN) skip_deps=true -D PULSE eunit -v
APPS = kernel stdlib sasl erts ssl compiler eunit crypto
PLT = $(HOME)/.machi_dialyzer_plt

View file

@ -22,6 +22,7 @@
-compile(export_all).
-ifdef(TEST).
-ifndef(PULSE).
-include_lib("eunit/include/eunit.hrl").
@ -72,5 +73,6 @@ verify_file_checksums_test() ->
ok = ?FLU:stop(FLU1)
end.
-endif. % !PULSE
-endif. % TEST

View file

@ -34,6 +34,7 @@
-compile(export_all).
-ifdef(TEST).
-ifndef(PULSE).
-ifdef(EQC).
-include_lib("eqc/include/eqc.hrl").
@ -391,4 +392,5 @@ get_latest_inner_proj_summ(FLU) ->
machi_chain_manager1:inner_projection_or_self(Proj),
{E, UPI, Repairing, Down}.
-endif. % !PULSE
-endif. % TEST

View file

@ -26,6 +26,7 @@
-compile(export_all).
-include("machi_projection.hrl").
-include_lib("eqc/include/eqc.hrl").
-include_lib("eqc/include/eqc_statem.hrl").
@ -100,9 +101,19 @@ next_state2(S, _Res, {call, _, _Func, _Args}) ->
postcondition(_S, {call, _, _Func, _Args}, _Res) ->
true.
all_list_extra() ->
[ {a, 7400, "./data.pulse.a"}
, {b, 7401, "./data.pulse.b"}
, {c, 7402, "./data.pulse.c"}
%% , {d, 7403, "./data.pulse.d"}
%% , {e, 7404, "./data.pulse.e"}
%% , {f, 7405, "./data.pulse.f"}
%% , {g, 7405, "./data.pulse.g"}
%% , {h, 7406, "./data.pulse.h"}
].
all_list() ->
[a,b,c].
%% [a,b,c,d,e].
[Name || {Name, _Port, _Dir} <- all_list_extra()].
setup(_Num, Seed) ->
?QC_FMT("\nsetup,", []),
@ -111,10 +122,9 @@ setup(_Num, Seed) ->
_Partitions = machi_partition_simulator:get(All_list),
FLU_pids = [begin
{ok, FLUPid} = machi_flu0:start_link(Name),
_ = machi_flu0:get_epoch(FLUPid),
{ok, FLUPid} = machi_flu1:start_link([StartTuple]),
FLUPid
end || Name <- All_list],
end || StartTuple <- all_list_extra()],
Namez = lists:zip(All_list, FLU_pids),
Mgr_pids = [begin
{ok, Mgr} = ?MGR:start_link(Name, All_list, FLU_pid),
@ -122,7 +132,7 @@ setup(_Num, Seed) ->
end || {Name, FLU_pid} <- Namez],
timer:sleep(1),
{ok, P1} = ?MGR:test_calc_projection(hd(Mgr_pids), false),
P1Epoch = P1#projection.epoch_number,
P1Epoch = P1#projection_v1.epoch_number,
[ok = machi_flu0:proj_write(FLU, P1Epoch, public, P1) || FLU <- FLU_pids],
[?MGR:test_react_to_env(Mgr) || Mgr <- Mgr_pids],
@ -185,7 +195,7 @@ dump_state() ->
Diag1 = [begin
Ps = machi_flu0:proj_get_all(FLU, Type),
[io_lib:format("~p ~p ~p: ~w\n", [FLUName, Type, P#projection.epoch_number, ?MGR:make_projection_summary(P)]) || P <- Ps]
[io_lib:format("~p ~p ~p: ~w\n", [FLUName, Type, P#projection_v1.epoch_number, ?MGR:make_projection_summary(P)]) || P <- Ps]
end || {FLUName, FLU} <- Namez,
Type <- [public] ],
@ -198,7 +208,7 @@ dump_state() ->
P_lists = [{FLUName, Type, P} || {FLUName, Type, Ps} <- P_lists0,
P <- Ps],
AllDict = lists:foldl(fun({FLU, Type, P}, D) ->
K = {FLU, Type, P#projection.epoch_number},
K = {FLU, Type, P#projection_v1.epoch_number},
dict:store(K, P, D)
end, dict:new(), lists:flatten(P_lists)),
DumbFinderBackward =
@ -262,6 +272,7 @@ prop_pulse() ->
{strategy, unfair}]),
ok = shutdown_hard(),
?QC_FMT("S2 ~p\n", [S2]),
{Report, Diag} = S2#state.dump_state,
%% Report is ordered by Epoch. For each private projection

View file

@ -256,5 +256,5 @@ nonunanimous_setup_and_fix_test() ->
ok = machi_partition_simulator:stop()
end.
-endif. % not PULSE
-endif. % !PULSE
-endif. % TEST

View file

@ -24,8 +24,9 @@
-include("machi_projection.hrl").
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-ifndef(PULSE).
-include_lib("eunit/include/eunit.hrl").
smoke_test_() -> {timeout, 1*60, fun() -> smoke_test2() end}.
@ -141,4 +142,5 @@ smoke_test2() ->
exit(SupPid, normal)
end.
-endif. % !PULSE
-endif. % TEST.

View file

@ -22,6 +22,8 @@
-compile(export_all).
-ifdef(TEST).
-ifndef(PULSE).
-include("machi.hrl").
-include("machi_projection.hrl").
-include_lib("eunit/include/eunit.hrl").
@ -207,4 +209,5 @@ clean_up_data_dir(DataDir) ->
_ = file:del_dir(DataDir),
ok.
-endif. % !PULSE
-endif. % TEST

View file

@ -21,6 +21,7 @@
-module(machi_flu_psup_test).
-ifdef(TEST).
-ifndef(PULSE).
-include_lib("eunit/include/eunit.hrl").
@ -158,6 +159,7 @@ partial_stop_restart2() ->
ok
end.
-endif. % !PULSE
-endif. % TEST

View file

@ -21,6 +21,8 @@
-module(machi_projection_test).
-ifdef(TEST).
-ifndef(PULSE).
-compile(export_all).
-include("machi_projection.hrl").
@ -83,4 +85,5 @@ try_it(MyName, All_list, UPI_list, Down_list, Repairing_list, Ps) ->
false
end.
-endif. % !PULSE
-endif. % TEST

View file

@ -28,6 +28,7 @@
-define(MUT, machi_proxy_flu1_client).
-ifdef(TEST).
-ifndef(PULSE).
api_smoke_test() ->
RegName = api_smoke_flu,
@ -279,4 +280,5 @@ flu_restart_test() ->
[catch machi_flu1:stop(Pid) || Pid <- get(flu_pid)]
end.
-endif. % !PULSE
-endif. % TEST