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

QuickCheck improvements #962

Merged
merged 4 commits into from
May 12, 2020
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
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: compile rel cover test dialyzer
.PHONY: compile rel cover test dialyzer eqc
REBAR=./rebar3

compile:
Expand All @@ -7,16 +7,21 @@ compile:
clean:
$(REBAR) clean

cover: test
cover:
$(REBAR) eunit --cover
$(REBAR) cover

test: compile
$(REBAR) as test do eunit
$(REBAR) eunit

dialyzer:
$(REBAR) dialyzer

xref:
$(REBAR) xref

eqc:
$(REBAR) as test eqc --testing_budget 120
$(REBAR) as eqc eunit

check: test dialyzer xref
2 changes: 0 additions & 2 deletions eqc/bg_manager_eqc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

-module(bg_manager_eqc).

-ifdef(TEST).
-ifdef(EQC).

-include("include/riak_core_bg_manager.hrl").
Expand Down Expand Up @@ -858,4 +857,3 @@ prop_bgmgr_parallel() ->
end))).

-endif.
-endif.
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@

{profiles, [
{test, [{deps, [meck]}, {erl_opts, [nowarn_export_all]}]},
{eqc, [{deps, [meck]}, {erl_opts, [nowarn_export_all]}]}
{eqc, [{deps, [meck]}, {erl_opts, [{d, 'EQC'}, nowarn_export_all]}]}
]}.
6 changes: 3 additions & 3 deletions src/hashtree.erl
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,14 @@
run_multiple/2,
run_remote/0,
run_remote/1]).
-endif. % TEST

-ifdef(EQC).
-export([prop_correct/0, prop_sha/0, prop_est/0]).
-include_lib("eqc/include/eqc.hrl").
-endif.

-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-endif.
-endif. %% TEST

-define(NUM_SEGMENTS, (1024*1024)).
-define(WIDTH, 1024).
Expand Down Expand Up @@ -1584,6 +1582,7 @@ opened_closed_test() ->
%%% EQC
%%%===================================================================

-ifdef(TEST).
-ifdef(EQC).
prop_sha() ->
%% NOTE: Generating 1MB (1024 * 1024) size binaries is incredibly slow
Expand Down Expand Up @@ -1692,3 +1691,4 @@ prop_est() ->
true
end).
-endif.
-endif.
3 changes: 3 additions & 0 deletions test/riak_core_claim_statem.erl
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ weight(_, _, _, _) ->
-define(QC_OUT(P),
eqc:on_output(fun(Str, Args) -> io:format(user, Str, Args) end, P)).

claim_test() ->
eqc:quickcheck(?QC_OUT(prop_claim(with_ring_size(5)))).

eqc_check(File, Prop) ->
{ok, Bytes} = file:read_file(File),
CE = binary_to_term(Bytes),
Expand Down