Permalink
Browse files

Alter the unit tests to be callable from the makefile and for the

defaults to call the unit tests twice, once for each io_mode.
  • Loading branch information...
evanmcc committed Mar 19, 2013
1 parent f6736fe commit 1aa52e158c371089ea5c6c747b7dfa33f8b3c545
Showing with 21 additions and 3 deletions.
  1. +11 −2 Makefile
  2. +10 −1 src/bitcask.erl
View
@@ -12,14 +12,23 @@ endif
all: deps compile
compile:
- $(REBAR_BIN) compile eunit
+ $(REBAR_BIN) compile
deps:
$(REBAR_BIN) get-deps
-clean:
+clean:
$(REBAR_BIN) clean
+eunit: deps compile eunit_erlang eunit_nif
+
+eunit_erlang:
+ IOMODE="erlang" $(REBAR_BIN) skip_deps=true eunit
+
+eunit_nif:
+ IOMODE="nif" $(REBAR_BIN) skip_deps=true eunit
+
+
# Release tarball creation
# Generates a tarball that includes all the deps sources so no checkouts are necessary
archivegit = git archive --format=tar --prefix=$(1)/ HEAD | (cd $(2) && tar xf -)
View
@@ -1304,8 +1304,17 @@ default_dataset() ->
%% HACK: Terrible hack to ensure that the .app file for
%% bitcask is available on the code path. Assumption here
%% is that we're running in .eunit/ as part of rebar.
+%% MORE HACK: init the io mode (nif or erlang) here.
a0_test() ->
- code:add_pathz("../ebin").
+ code:add_pathz("../ebin"),
+ application:start(erlang),
+ Mode0 = case os:getenv("IOMODE") of
+ false -> "erlang";
+ Else -> Else
+ end,
+ Mode = list_to_atom(Mode0),
+ application:set_env(bitcask, io_mode, Mode),
+ error_logger:info_msg("Set IO mode to: ~p", [Mode]).
roundtrip_test() ->
os:cmd("rm -rf /tmp/bc.test.roundtrip"),

0 comments on commit 1aa52e1

Please sign in to comment.