Permalink
Browse files

Use rebar.config.script file for pulse testing setup instead of uncom…

…menting in rebar.config
  • Loading branch information...
1 parent 7443ad2 commit 206127d50b93373040242752c96da398b54575e2 Kelly McLaughlin committed Dec 10, 2013
Showing with 75 additions and 63 deletions.
  1. +2 −2 Makefile
  2. +1 −61 rebar.config
  3. +72 −0 rebar.config.script
View
@@ -33,8 +33,8 @@ eunit_nif:
pulse:
@rm -rf $(BASE_DIR)/.eunit
- $(REBAR_BIN) -D PULSE clean compile
- $(REBAR_BIN) -D PULSE eunit skip_deps=true suites=$(PULSE_TESTS)
+ BITCASK_PULSE=1 $(REBAR_BIN) clean compile
+ BITCASK_PULSE=1 $(REBAR_BIN) -D PULSE eunit skip_deps=true suites=$(PULSE_TESTS)
# Release tarball creation
# Generates a tarball that includes all the deps sources so no checkouts are necessary
View
@@ -17,66 +17,6 @@
%% OS X Snow Leopard flags for 32-bit
{"darwin10.*-32$", "CFLAGS", "-m32"},
{"darwin10.*-32$", "LDFLAGS", "-arch i386"}
-
- %% Patching the nif(s) to run w. PULSE
- %% , {"CFLAGS", "$CFLAGS -DPULSE"}
- ]}.
-
-{eunit_compile_opts, [
- %% Uncomment the following options to enable pulse testing. Note that
- %% this will (currently) break all tests that do NOT use Pulse. As such,
- %% this is most useful when used w/ rebar like so:
- %% ./rebar compile eunit apps=bitcask suite=bitcask_eqc
- %%
- %% Also uncomment the nif-patching in the port_envs option above!
- %%
- %% NOTE1: You'll have to do a "clean" to ensure everything gets compiled w/
- %% the new flags!
- %% NOTE2: You'll need a recent (1.25.2+) version of PULSE to run the tests
- %% and a copy of the pulsified OTP componentes (pulse_gen, etc...)
- %%
- %% {d, 'PULSE'},
- %%
- %% {pulse_no_side_effect,[{erlang,display,1}]},
- %% {pulse_side_effect,
- %% [ {bitcask_nifs, keydir_new, 0}
- %% , {bitcask_nifs, keydir_new, 1}
- %% , {bitcask_nifs, keydir_mark_ready, 1}
- %% , {bitcask_nifs, keydir_put_int, 8}
- %% , {bitcask_nifs, keydir_get_int, 3}
- %% , {bitcask_nifs, keydir_remove, 2}
- %% , {bitcask_nifs, keydir_remove_int, 5}
- %% , {bitcask_nifs, keydir_copy, 1}
- %% , {bitcask_nifs, keydir_itr_int, 4}
- %% , {bitcask_nifs, keydir_itr_next_int, 1}
- %% , {bitcask_nifs, keydir_itr_release, 1}
- %% , {bitcask_nifs, keydir_info, 1}
- %% , {bitcask_nifs, keydir_release, 1}
- %%
- %% , {bitcask_nifs, lock_acquire, 2}
- %% , {bitcask_nifs, lock_release, 1}
- %% , {bitcask_nifs, lock_readdata, 1}
- %% , {bitcask_nifs, lock_writedata, 2}
- %%
- %% , {bitcask_nifs, file_open, 2}
- %% , {bitcask_nifs, file_close, 1}
- %% , {bitcask_nifs, file_sync, 1}
- %% , {bitcask_nifs, file_pread, 3}
- %% , {bitcask_nifs, file_pwrite, 3}
- %% , {bitcask_nifs, file_read, 2}
- %% , {bitcask_nifs, file_write, 2}
- %% , {bitcask_nifs, file_seekbof, 1}
- %%
- %% , {bitcask_time, tstamp, 0}
- %%
- %% , {file, '_', '_'}
- %% , {filelib, '_', '_'}
- %% , {os, '_', '_'} ]},
- %%
- %% {pulse_replace_module,
- %% [ {gen_server, pulse_gen_server}
- %% , {application, pulse_application}
- %% , {supervisor, pulse_supervisor} ]}
- ]}.
+ ]}.
{eunit_opts, [verbose]}.
View
@@ -0,0 +1,72 @@
+PulseBuild = case os:getenv("BITCASK_PULSE") of
+ false ->
+ false;
+ _ ->
+ true
+ end,
+case PulseBuild of
+ true ->
+ PulseOpts =
+ [{pulse_no_side_effect,[{erlang,display,1}]},
+ {pulse_side_effect,
+ [ {bitcask_nifs, keydir_new, 0}
+ , {bitcask_nifs, keydir_new, 1}
+ , {bitcask_nifs, keydir_mark_ready, 1}
+ , {bitcask_nifs, keydir_put_int, 8}
+ , {bitcask_nifs, keydir_get_int, 2}
+ , {bitcask_nifs, keydir_remove, 2}
+ , {bitcask_nifs, keydir_remove_int, 5}
+ , {bitcask_nifs, keydir_copy, 1}
+ , {bitcask_nifs, keydir_itr_int, 4}
+ , {bitcask_nifs, keydir_itr_next_int, 1}
+ , {bitcask_nifs, keydir_itr_release, 1}
+ , {bitcask_nifs, keydir_info, 1}
+ , {bitcask_nifs, keydir_release, 1}
+
+ , {bitcask_nifs, lock_acquire, 2}
+ , {bitcask_nifs, lock_release, 1}
+ , {bitcask_nifs, lock_readdata, 1}
+ , {bitcask_nifs, lock_writedata, 2}
+
+ , {bitcask_nifs, file_open, 2}
+ , {bitcask_nifs, file_close, 1}
+ , {bitcask_nifs, file_sync, 1}
+ , {bitcask_nifs, file_pread, 3}
+ , {bitcask_nifs, file_pwrite, 3}
+ , {bitcask_nifs, file_read, 2}
+ , {bitcask_nifs, file_write, 2}
+ , {bitcask_nifs, file_seekbof, 1}
+
+ , {bitcask_time, tstamp, 0}
+
+ , {file, '_', '_'}
+ , {filelib, '_', '_'}
+ , {os, '_', '_'} ]},
+
+ {pulse_replace_module,
+ [ {gen_server, pulse_gen_server}
+ , {application, pulse_application}
+ , {supervisor, pulse_supervisor} ]}
+ ],
+ PulseCFlags = [{"CFLAGS", "$CFLAGS -DPULSE"}],
+ UpdConfig = case lists:keysearch(eunit_compile_opts, 1, CONFIG) of
+ {value, {eunit_compile_opts, Opts}} ->
+ lists:keyreplace(eunit_compile_opts,
+ 1,
+ CONFIG,
+ {eunit_compile_opts, Opts ++ PulseOpts});
+ _ ->
+ [{eunit_compile_opts, PulseOpts} | CONFIG]
+ end,
+ case lists:keysearch(port_env, 1, UpdConfig) of
+ {value, {port_env, PortEnv}} ->
+ lists:keyreplace(port_env,
+ 1,
+ UpdConfig,
+ {port_env, PortEnv ++ PulseCFlags});
+ _ ->
+ [{port_env, PulseCFlags} | UpdConfig]
+ end;
+ false ->
+ CONFIG
+end.

0 comments on commit 206127d

Please sign in to comment.