Skip to content

Commit

Permalink
Starting Erlang Web in the interactive mode as a port works for EWTS
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Ptaszek committed Oct 13, 2009
1 parent 8280984 commit d4658da
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions bin/test.erl 100644 → 100755
Expand Up @@ -24,29 +24,31 @@
%%%------------------------------------------------------------------- %%%-------------------------------------------------------------------


main([]) -> main([]) ->
run_tests("ewts_reports"); run_tests("doc/ewts_report");
main(_) -> main(_) ->
print_usage(). print_usage().


run_tests() -> run_tests(Dir) ->
start_interactive_mode_node(). start_interactive_mode_node(Dir).


start_interactive_mode_node(ReportDir) -> start_interactive_mode_node(ReportDir) ->
Port = open_port({spawn, "bin/start_interactive -run ewts start_tests" ++ ReportDir}, Port = open_port({spawn, "bin/start_interactive inets single_node -run ewts start_tests " ++ ReportDir},
[use_stdio, stderr_to_stdout, stream, {line, 1024}]), [use_stdio, stderr_to_stdout, stream, {line, 1024}]),
print_output(Port). print_output(Port).


print_output(Port) -> print_output(Port) ->
receive receive
{Port, {data, {eol, "EWTS: " ++ Line}}} -> {Port, {data, {eol, "1> EWTS: " ++ Line}}} ->
io:format(Line); io:format("~s~n", [Line]),
print_output(Port);
{Port, {data, _Data}} -> {Port, {data, _Data}} ->
print_output(Port) print_output(Port)
after 1000 -> after 1000 ->
port_close(Port),
ok ok
end. end.


print_usage() -> print_usage() ->
io:format("Usage:~n" io:format("Usage:~n"
"bin/test.erl [run] - run the tests~n" "bin/test.erl [run [ReportDir]] - run the tests~n"
"bin/test.erl compile - compile the tests - do not run them~n"). "bin/test.erl compile - compile the tests - do not run them~n").

0 comments on commit d4658da

Please sign in to comment.