Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added no_side_effect on erlang:now()

also use erlang:now() instead of pulse:seed() to make
quickcheck pick a fresh seed in every shrinking step
  • Loading branch information...
commit 3c8a58177e91f967d4af00243ef8d9b761fc52c4 1 parent 154c5bb
Ulf Norell UlfNorell authored

Showing 2 changed files with 6 additions and 9 deletions. Show diff stats Hide diff stats

  1. +6 6 test/pulse/bitcask_eqc.erl
  2. +0 3  test/pulse/utils.erl
12 test/pulse/bitcask_eqc.erl
@@ -22,7 +22,7 @@
22 22 %% The following functions contains side_effects but are run outside
23 23 %% PULSE, i.e. PULSE needs to leave them alone
24 24 -compile({pulse_skip,[{prop_pulse_test_,0},{really_delete_bitcask,0},{copy_bitcask_app,0}]}).
25   --compile({pulse_no_side_effect,[{file,'_','_'}]}).
  25 +-compile({pulse_no_side_effect,[{file,'_','_'}, {erlang, now, 0}]}).
26 26
27 27 %% The token module keeps track of the currently used directory for
28 28 %% bitcask. Each test uses a fresh directory!
@@ -228,7 +228,7 @@ host() ->
228 228
229 229 %% Generate a most likely unique node name
230 230 unique_name() ->
231   - {A, B, C} = utils:now(),
  231 + {A, B, C} = erlang:now(),
232 232 list_to_atom(lists:concat([integer_to_list(A), "-",
233 233 integer_to_list(B), "-",
234 234 integer_to_list(C)])).
@@ -300,8 +300,8 @@ prop_pulse() ->
300 300 prop_pulse(false).
301 301
302 302 prop_pulse(Verbose) ->
303   - ?FORALL(Cmds, ?LET(Cmds, more_commands(10, commands(?MODULE)), shrink_commands(Cmds)),
304   - ?FORALL(Seed, pulse:seed(),
  303 + ?FORALL(Cmds, ?LET(Cmds, more_commands(2, commands(?MODULE)), shrink_commands(Cmds)),
  304 + ?FORALL(Seed, ?LAZY(erlang:now()), %pulse:seed(),
305 305 begin
306 306 case run_on_node(Verbose, ?MODULE, run_commands_on_node, [Cmds, Seed, Verbose]) of
307 307 {'EXIT', Err} ->
@@ -822,7 +822,7 @@ custom_shrink(CE=[_,Seed|_], [C|Cs], Repeat) ->
822 822 end.
823 823
824 824 check_many(C, N) ->
825   - check_many(utils:now(), C, N).
  825 + check_many(erlang:now(), C, N).
826 826
827 827 check_many(_, _, 0) -> true;
828 828 check_many(Seed, C0, N) ->
@@ -838,7 +838,7 @@ mk_counterexample(CE = [Cmds, _Seed]) when is_list(Cmds) ->
838 838 CE;
839 839 mk_counterexample(Cmds) ->
840 840 S = state_after(?MODULE, Cmds),
841   - [Cmds, utils:now(),
  841 + [Cmds, erlang:now(),
842 842 [ {0, []} | [ {I, []}
843 843 || I <- lists:seq(1, length(S#state.readers)) ] ]
844 844 ++ [ {errors, []}, {events, []} ] ].
3  test/pulse/utils.erl
@@ -7,9 +7,6 @@
7 7
8 8 -compile(export_all).
9 9
10   -now() ->
11   - erlang:now().
12   -
13 10 whereis(Name) ->
14 11 erlang:whereis(Name).
15 12

0 comments on commit 3c8a581

Please sign in to comment.
Something went wrong with that request. Please try again.