Skip to content
forked from facebook/buck2

Commit d6273ee

Browse files
jcpetruzzameta-codesync[bot]
authored andcommitted
Avoid long stdout lines being truncated in Erlang tests
Summary: # Context We recently change the way Erlang tests run, so that the test-executor node running the CT suite has its stdout piped to the test-binary node, who logs for later processing The port opened on the test-binary is using the `{line, N.}` option, which means that lines of size at most `N` are sent in a single `{eol, L}` message, but longer lines are split in one or more `{noeol, Ln}`, and a final `{eol, L}`. # Problem The logic handling messages from the port is only handling `{eol, L}` messages, so we'd be missing the prefix of very long lines. In practice, N = 1Kb, so in practice this had little impact # This diff Handle the `noeol` message as well Reviewed By: michalmuskala Differential Revision: D88007158 fbshipit-source-id: 1584edbd9bbd9b374cd3f3f6cbf2c8b4d3d3ef5c
1 parent 421a472 commit d6273ee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

prelude/erlang/common_test/test_exec/src/ct_runner.erl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,14 @@ handle_info(
155155
test_runner:mark_failure(ErrorMsg)
156156
end,
157157
{stop, {ct_run_finished, ExitStatus}, State};
158-
handle_info({_Port, {data, {eol, Data}}}, State) ->
158+
handle_info({Port, {data, {eol, Data}}}, State = #{port := Port}) ->
159159
Handle = maps:get(stdout_file_handle, State),
160160
file:write(Handle, [Data, "\n"]),
161161
{noreply, State};
162+
handle_info({Port, {data, {noeol, Data}}}, State = #{port := Port}) ->
163+
Handle = maps:get(stdout_file_handle, State),
164+
file:write(Handle, Data),
165+
{noreply, State};
162166
handle_info({Port, closed}, #{port := Port} = State) ->
163167
{stop, ct_port_closed, State};
164168
handle_info({'EXIT', Port, Reason}, #{port := Port} = State) ->

0 commit comments

Comments
 (0)