mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Add autobahn test suite output to the console
This commit is contained in:
parent
93d1e0c577
commit
fe5acb20f1
2 changed files with 18 additions and 5 deletions
|
@ -1 +1 @@
|
||||||
{application, cowboy, [ {description, "Small, fast, modular HTTP server."}, {vsn, "2.0.0-pre.2"}, {id, "2.0.0-pre.2-2-gd64aba4-dirty"}, {modules, [cowboy,cowboy_app,cowboy_bstr,cowboy_clock,cowboy_constraints,cowboy_handler,cowboy_http2,cowboy_loop,cowboy_middleware,cowboy_protocol,cowboy_req,cowboy_rest,cowboy_router,cowboy_spdy,cowboy_static,cowboy_stream,cowboy_stream_h,cowboy_sub_protocol,cowboy_sup,cowboy_tls,cowboy_websocket]}, {registered, [cowboy_sup,cowboy_clock]}, {applications, [kernel,stdlib,crypto,cowlib,ranch]}, {mod, {cowboy_app, []}}]}.
|
{application, cowboy, [ {description, "Small, fast, modular HTTP server."}, {vsn, "2.0.0-pre.2"}, {id, "2.0.0-pre.2-10-g93d1e0c-dirty"}, {modules, [cowboy,cowboy_app,cowboy_bstr,cowboy_clock,cowboy_constraints,cowboy_handler,cowboy_http2,cowboy_loop,cowboy_middleware,cowboy_protocol,cowboy_req,cowboy_rest,cowboy_router,cowboy_spdy,cowboy_static,cowboy_stream,cowboy_stream_h,cowboy_sub_protocol,cowboy_sup,cowboy_tls,cowboy_websocket]}, {registered, [cowboy_sup,cowboy_clock]}, {applications, [kernel,stdlib,crypto,cowlib,ranch]}, {mod, {cowboy_app, []}}]}.
|
||||||
|
|
|
@ -86,19 +86,32 @@ init_dispatch() ->
|
||||||
%% Tests.
|
%% Tests.
|
||||||
|
|
||||||
autobahn_fuzzingclient(Config) ->
|
autobahn_fuzzingclient(Config) ->
|
||||||
Out = os:cmd("cd " ++ config(priv_dir, Config)
|
Self = self(),
|
||||||
++ " && wstest -m fuzzingclient -s "
|
spawn_link(fun() -> start_port(Config, Self) end),
|
||||||
++ config(data_dir, Config) ++ "client.json"),
|
receive autobahn_exit -> ok end,
|
||||||
Report = config(priv_dir, Config) ++ "reports/servers/index.html",
|
Report = config(priv_dir, Config) ++ "reports/servers/index.html",
|
||||||
ct:log("<h2><a href=\"~s\">Full report</a></h2>~n", [Report]),
|
ct:log("<h2><a href=\"~s\">Full report</a></h2>~n", [Report]),
|
||||||
ct:print("Autobahn Test Suite report: file://~s~n", [Report]),
|
ct:print("Autobahn Test Suite report: file://~s~n", [Report]),
|
||||||
ct:log("~s~n", [Out]),
|
|
||||||
{ok, HTML} = file:read_file(Report),
|
{ok, HTML} = file:read_file(Report),
|
||||||
case length(binary:matches(HTML, <<"case_failed">>)) > 2 of
|
case length(binary:matches(HTML, <<"case_failed">>)) > 2 of
|
||||||
true -> error(failed);
|
true -> error(failed);
|
||||||
false -> ok
|
false -> ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
start_port(Config, Pid) ->
|
||||||
|
Port = open_port({spawn, "wstest -m fuzzingclient -s " ++ config(data_dir, Config) ++ "client.json"},
|
||||||
|
[{line, 10000}, {cd, config(priv_dir, Config)}, binary, eof]),
|
||||||
|
receive_infinity(Port, Pid).
|
||||||
|
|
||||||
|
receive_infinity(Port, Pid) ->
|
||||||
|
receive
|
||||||
|
{Port, {data, {eol, Line}}} ->
|
||||||
|
io:format(user, "~s~n", [Line]),
|
||||||
|
receive_infinity(Port, Pid);
|
||||||
|
{Port, eof} ->
|
||||||
|
Pid ! autobahn_exit
|
||||||
|
end.
|
||||||
|
|
||||||
%% We do not support hixie76 anymore.
|
%% We do not support hixie76 anymore.
|
||||||
ws0(Config) ->
|
ws0(Config) ->
|
||||||
{port, Port} = lists:keyfind(port, 1, Config),
|
{port, Port} = lists:keyfind(port, 1, Config),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue