Commits

Anonymous committed 11f2186

"test" make target, runs eunit on all modules named in riak.app

output is teed to test.log

Comments (0)

Files changed (5)

 ^client_lib/java/build/*
 ^client_lib/java/dist/*
 ^client_lib/java/javadoc/*
+test\.log
+^test/.*
 dialyzer: erl 
 	@dialyzer -Wno_return -c ebin/ | tee priv/log/dialyzer.log
 
+test: erl
+	scripts/run_tests.escript ebin | tee test.log
+

scripts/run_tests.escript

+#!/usr/bin/env escript
+%% -*- erlang -*-
+%%! -name riak_test@127.0.0.1
+main([Ebin]) ->
+    code:add_path(Ebin),
+    code:add_paths(filelib:wildcard("deps/*/ebin", Ebin)),
+    code:add_paths(filelib:wildcard("deps/*/deps/*/ebin", Ebin)),
+    {ok, [{application, riak, Props}]} =
+        file:consult(filename:join(Ebin,"riak.app")),
+    Modules = proplists:get_value(modules, Props),
+    eunit:test(Modules, [verbose]);
+main(_) ->
+    io:format("usage: run_tests.escript RIAK_EBIN_DIRECTORY~n"),
+    halt(1).

src/riak_dets_backend.erl

 
 % @private
 simple_test() ->
+    application:set_env(riak, riak_dets_backend_root,
+                        "test/dets-backend"),
+    ?assertCmd("rm -rf test/dets-backend"),
     {ok,S} = riak_dets_backend:start(42),
     ok = riak_dets_backend:put(S,<<"k1">>,<<"v1">>),
     ok = riak_dets_backend:put(S,<<"k2">>,<<"v2">>),

src/riak_util.erl

 moment_test() ->
     M1 = riak_util:moment(),
     M2 = riak_util:moment(),
-    M2 >= M1.
+    ?assert(M2 >= M1).
 
 %% @spec moment() -> integer()
 %% @doc Get the current "moment".  Current implementation is the