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 Travis CI failure of multiple_merges_during_fold_test #74

Merged
merged 3 commits into from Mar 5, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/bitcask_merge_delete.erl
Expand Up @@ -138,7 +138,7 @@ delete_files(Files) ->
-ifdef(TEST). -ifdef(TEST).


multiple_merges_during_fold_test_() -> multiple_merges_during_fold_test_() ->
{timeout, 10, fun multiple_merges_during_fold_test_body/0}. {timeout, 60, fun multiple_merges_during_fold_test_body/0}.


multiple_merges_during_fold_test_body() -> multiple_merges_during_fold_test_body() ->
Dir = "/tmp/bc.multiple-merges-fold", Dir = "/tmp/bc.multiple-merges-fold",
Expand Down Expand Up @@ -166,15 +166,11 @@ multiple_merges_during_fold_test_body() ->
bitcask:has_setuid_bit(F)]) bitcask:has_setuid_bit(F)])
end, end,
PutSome(), PutSome(),
bitcask:merge(Dir), Count1 = merge_until(Dir, 0, CountSetuids),
Count1 = CountSetuids(),
true = (Count1 > 0),
PutSome(), PutSome(),
bitcask:merge(Dir), bitcask:merge(Dir),
PutSome(), PutSome(),
bitcask:merge(Dir), merge_until(Dir, Count1, CountSetuids),
Count2 = CountSetuids(),
true = (Count2 > Count1),


SlowPid ! go_ahead, SlowPid ! go_ahead,
timer:sleep(500), timer:sleep(500),
Expand All @@ -183,4 +179,14 @@ multiple_merges_during_fold_test_body() ->


ok. ok.


merge_until(Dir, MinCount, CountSetuids) ->
bitcask:merge(Dir),
Count = CountSetuids(),
if (Count > MinCount) ->
Count;
true ->
timer:sleep(100),
merge_until(Dir, MinCount, CountSetuids)
end.

-endif. %% TEST -endif. %% TEST
7 changes: 4 additions & 3 deletions test/bitcask_qc_fsm.erl
Expand Up @@ -108,10 +108,11 @@ postcondition(_From,_To,_S,{call,_,_,_},_Res) ->
true. true.


qc_test_() -> qc_test_() ->
{timeout, 120, TestTime = 45,
{timeout, TestTime*2,
{setup, fun prepare/0, fun cleanup/1, {setup, fun prepare/0, fun cleanup/1,
[{timeout, 120, ?_assertEqual(true, [{timeout, TestTime*2, ?_assertEqual(true,
eqc:quickcheck(?QC_OUT(prop_bitcask())))}]}}. eqc:quickcheck(eqc:testing_time(TestTime, ?QC_OUT(prop_bitcask()))))}]}}.


prepare() -> prepare() ->
application:load(bitcask), application:load(bitcask),
Expand Down