Permalink
Browse files

Add env vars PULSE_TIME and PULSE_SHRINK_TIME for more testing flexib…

…ility
  • Loading branch information...
1 parent 206127d commit a2d683a57c73bd0873b8adb0042de8bcebfd54ec @slfritchie slfritchie committed Dec 12, 2013
Showing with 26 additions and 3 deletions.
  1. +14 −1 Makefile
  2. +12 −2 test/bitcask_pulse.erl
View
15 Makefile
@@ -31,10 +31,23 @@ eunit_erlang:
eunit_nif:
IOMODE="nif" $(REBAR_BIN) skip_deps=true eunit
+NOW = $(shell date +%s)
+COUNTER = $(PWD)/$(NOW).current_counterexample.eqc
+EQCINFO = $(PWD)/$(NOW).eqc-info
+
pulse:
@rm -rf $(BASE_DIR)/.eunit
BITCASK_PULSE=1 $(REBAR_BIN) clean compile
- BITCASK_PULSE=1 $(REBAR_BIN) -D PULSE eunit skip_deps=true suites=$(PULSE_TESTS)
+ env BITCASK_PULSE=1 $(REBAR_BIN) -D PULSE eunit skip_deps=true suites=$(PULSE_TESTS) ; \
+ if [ $$? -ne 0 ]; then \
+ echo PULSE test FAILED; \
+ cp ./.eunit/current_counterexample.eqc $(COUNTER); \
+ cp ./.eunit/.eqc-info $(EQCINFO); \
+ echo See files $(COUNTER) and $(EQCINFO); \
+ exit 1; \
+ else \
+ exit 0; \
+ fi
# Release tarball creation
# Generates a tarball that includes all the deps sources so no checkouts are necessary
View
14 test/bitcask_pulse.erl
@@ -355,10 +355,20 @@ prop_pulse(LocalOrSlave, Verbose) ->
%% A EUnit wrapper for the QuickCheck property
prop_pulse_test_() ->
- {timeout, 1000000,
+ Timeout = case os:getenv("PULSE_TIME") of
+ false -> 60;
+ Val -> list_to_integer(Val)
+ end,
+ ExtraTO = case os:getenv("PULSE_SHRINK_TIME") of
+ false -> 0;
+ Val2 -> list_to_integer(Val2)
+ end,
+ io:format(user, "prop_pulse_test time: ~p + ~p seconds\n",
+ [Timeout, ExtraTO]),
+ {timeout, (Timeout*1000) + 30,
fun() ->
copy_bitcask_app(),
- ?assert(eqc:quickcheck(eqc:testing_time(60,?QC_OUT(prop_pulse()))))
+ ?assert(eqc:quickcheck(eqc:testing_time(Timeout,?QC_OUT(prop_pulse()))))
end}.
%% Needed since rebar fails miserably in setting up the .eunit test directory

0 comments on commit a2d683a

Please sign in to comment.