Commits

Anonymous committed 446d8dd

Still stuck trying to get recursive EUnit tests to work from "riak" packaging.

Checking in because it's the weekend and because I'm fed up with
troubleshooting. If I'm lucky, someone else will pick this up and finish
the fix. If I'm unlucky, it'll fall back to me again next week.

% cd rebar
% rebar compile
...
% rebar eunit
=PROGRESS REPORT==== 25-Feb-2011::18:37:22 ===
application: riak_kv
started_at: 'eunit@127.0.0.1'
Line luwak_checksum_tests 7 {18,37,22}
Line luwak_checksum_tests 9 {18,37,22}
*timed out*
undefined
=======================================================
Failed: 0. Skipped: 0. Passed: 0.
One or more tests were cancelled.

  • Participants
  • Parent commits 0fc90e1

Comments (0)

Files changed (2)

File test/luwak_checksum_tests.erl

 
 one_off_checksum_test() ->
   test_helper:riak_test(fun(Riak) ->
+io:format(user, "Line ~p ~p ~p\n", [?MODULE, ?LINE, time()]),
       Sha = crypto:sha(<<"chilled monkey brains">>),
+io:format(user, "Line ~p ~p ~p\n", [?MODULE, ?LINE, time()]),
       {ok, File} = luwak_file:create(Riak, <<"file1">>, [{tree_order,2},{block_size,2}], dict:new()),
+io:format(user, "Line ~p ~p ~p\n", [?MODULE, ?LINE, time()]),
       {ok, _, File1} = luwak_io:put_range(Riak, File, 0, <<"chilled monkey brains">>),
+io:format(user, "Line ~p ~p ~p\n", [?MODULE, ?LINE, time()]),
       timer:sleep(100),
       Checksum = luwak_checksum:sha1(Riak, File1),
+io:format(user, "Line ~p ~p ~p\n", [?MODULE, ?LINE, time()]),
       ?assertEqual(Sha, Checksum)
     end).
 

File test/test_helper.erl

         {ok,_} -> ok;
         {error,{already_started,_}} -> ok
     end,
-  % Dir = "/tmp/ring-" ++ os:getpid(),
-  % filelib:ensure_dir(Dir ++ "/"),
-  % application:set_env(riak_core, ring_state_dir, Dir),
-  application:set_env(riak_kv, storage_backend, riak_kv_cache_backend),
-  error_logger:delete_report_handler(error_logger_tty_h),
-  application:start(sasl),
-  error_logger:delete_report_handler(sasl_report_tty_h),
-  load_and_start_apps([crypto,
-                       os_mon,
-                       runtime_tools,
-                       mochiweb,
-                       webmachine,
-                       riak_sysmon,
-                       riak_core,
-                       luke,
-                       erlang_js,
-                       skerl,
-                       bitcask,
-                       riak_kv]).
+%    error_logger:delete_report_handler(error_logger_tty_h),%%SLF:
+    application:start(sasl),
+%    error_logger:delete_report_handler(sasl_report_tty_h),%%SLF:
+    Apps = [crypto, os_mon, runtime_tools, mochiweb, webmachine, riak_sysmon,
+            riak_core, luke, erlang_js, skerl, bitcask, riak_kv],
+    [begin
+         application:stop(A),
+         [application:unset_env(A, Key) ||
+             {Key, _} <- application:get_all_env(A)],
+         FName = atom_to_list(A) ++ ".app",
+         FullName = code:where_is_file(FName),
+         {ok, [{_, _, Ps}]} = file:consult(FullName),
+         Es = proplists:get_value(env, Ps, []),
+         [application:set_env(A, K, V) || {K, V} <- Es]
+     end || A <- Apps],
+    %% Started independently by other eunit tests
+    [catch exit(whereis(Name), kill) ||
+        Name <- [riak_core_ring_manager, riak_kv_vnode_master]],
+    timer:sleep(100),
+
+    % Dir = "/tmp/ring-" ++ os:getpid(),
+    % filelib:ensure_dir(Dir ++ "/"),
+    % application:set_env(riak_core, ring_state_dir, Dir),
+    application:set_env(riak_kv, storage_backend, riak_kv_ets_backend),
+    
+io:format(user, "SLF temp: ~w\n", [lists:sort(registered())]),
+[io:format(user, "SLF temp: ~p ~p\n", [A, application:get_all_env(A)]) || A <- Apps],
+    load_and_start_apps(Apps),
+    timer:sleep(150).
     
 stop_riak() ->
   application:stop(riak_kv).