unbreak js test and display a report

Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/c8753b58
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/c8753b58
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/c8753b58

Branch: refs/heads/1994-merge-rcouch
Commit: c8753b582304954b208bdb3f64885ee861a7481b
Parents: e62a4fc
Author: Benoit Chesneau <[email protected]>
Authored: Sun Jan 12 13:38:25 2014 +0100
Committer: Benoit Chesneau <[email protected]>
Committed: Sun Jan 12 13:38:25 2014 +0100

----------------------------------------------------------------------
 .../src/couch_httpd_misc_handlers.erl            |  1 +
 test/javascript/test_js.escript                  | 19 ++++++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/c8753b58/apps/couch_httpd/src/couch_httpd_misc_handlers.erl
----------------------------------------------------------------------
diff --git a/apps/couch_httpd/src/couch_httpd_misc_handlers.erl 
b/apps/couch_httpd/src/couch_httpd_misc_handlers.erl
index 1999e5e..57cc5ec 100644
--- a/apps/couch_httpd/src/couch_httpd_misc_handlers.erl
+++ b/apps/couch_httpd/src/couch_httpd_misc_handlers.erl
@@ -99,6 +99,7 @@ handle_restart_req(#httpd{method='POST'}=Req) ->
     ok = couch_httpd:verify_is_server_admin(Req),
     Result = send_json(Req, 202, {[{ok, true}]}),
     couch_server_sup:restart_core_server(),
+    couch_httpd_sup:reload_listeners(),
     Result;
 handle_restart_req(Req) ->
     send_method_not_allowed(Req, "POST").

http://git-wip-us.apache.org/repos/asf/couchdb/blob/c8753b58/test/javascript/test_js.escript
----------------------------------------------------------------------
diff --git a/test/javascript/test_js.escript b/test/javascript/test_js.escript
index 0ea7b94..4ee7a8a 100755
--- a/test/javascript/test_js.escript
+++ b/test/javascript/test_js.escript
@@ -161,7 +161,8 @@ exec(Path) ->
                     Acc;
                 ("OK", _Acc) ->
                     ok;
-                (_, Acc) ->
+                (_Else, Acc) ->
+                    io:format("got else ~p~n", [_Else]),
                     Acc
             end, fail, Lines),
     io:format("~s ... ~s~n", [filename:basename(Path), Result]),
@@ -178,25 +179,29 @@ test(TestDir, Files) ->
                 Path = filename:join([TestDir, Name]),
                 Result = exec(Path),
                 case Result of
-                    ok-> {FAILs, [Name | OKs]};
-                    _ -> {[Name | FAILs], OKs}
+                    ok-> {FAILs, [{Name, ok} | OKs]};
+                    _ -> {[{Name, fail} | FAILs], OKs}
                 end
 
         end, {[], []}, Files),
 
+    stop_couch(),
+
     NFailed = length(Failed),
     NSuccess = length(Success),
     Count = NFailed + NSuccess,
 
+    io:format("==> javascript tests results.~n~n", []),
+    lists:foreach(fun({Name, Status}) ->
+                io:format("~s ... ~s~n", [Name, Status])
+        end, lists:usort(Failed ++ Success)),
+
     case NFailed of
         0 ->
             io:format("~nAll tests successful.~nTests: ~p~n", [Count]);
         _ ->
             io:format("~n~p/~p tests failed~n", [NFailed, Count])
-    end,
-
-    stop_couch().
-
+    end.
 main([]) ->
     TestDir = filename:join([scriptdir(), "test"]),
     test(TestDir, filelib:wildcard("*.js", TestDir));

Reply via email to