aboutsummaryrefslogtreecommitdiffstats
path: root/test/ws_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-07-22 23:05:49 +0200
committerLoïc Hoguin <[email protected]>2015-07-22 23:05:49 +0200
commitfe5acb20f160aed85dcc3e9cc7236359413134bf (patch)
treed9f4b035e0ec6c766736a2d1007354bc0a3a0dcc /test/ws_SUITE.erl
parent93d1e0c57724e2ab1f680763de6778cdf7822820 (diff)
downloadcowboy-fe5acb20f160aed85dcc3e9cc7236359413134bf.tar.gz
cowboy-fe5acb20f160aed85dcc3e9cc7236359413134bf.tar.bz2
cowboy-fe5acb20f160aed85dcc3e9cc7236359413134bf.zip
Add autobahn test suite output to the console
Diffstat (limited to 'test/ws_SUITE.erl')
-rw-r--r--test/ws_SUITE.erl21
1 files changed, 17 insertions, 4 deletions
diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl
index 9cafd3c..79614ad 100644
--- a/test/ws_SUITE.erl
+++ b/test/ws_SUITE.erl
@@ -86,19 +86,32 @@ init_dispatch() ->
%% Tests.
autobahn_fuzzingclient(Config) ->
- Out = os:cmd("cd " ++ config(priv_dir, Config)
- ++ " && wstest -m fuzzingclient -s "
- ++ config(data_dir, Config) ++ "client.json"),
+ Self = self(),
+ spawn_link(fun() -> start_port(Config, Self) end),
+ receive autobahn_exit -> ok end,
Report = config(priv_dir, Config) ++ "reports/servers/index.html",
ct:log("<h2><a href=\"~s\">Full report</a></h2>~n", [Report]),
ct:print("Autobahn Test Suite report: file://~s~n", [Report]),
- ct:log("~s~n", [Out]),
{ok, HTML} = file:read_file(Report),
case length(binary:matches(HTML, <<"case_failed">>)) > 2 of
true -> error(failed);
false -> ok
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.
ws0(Config) ->
{port, Port} = lists:keyfind(port, 1, Config),