CTest combines stdout and stderr, change to allow them to be treated differently

WilliamGLYork
Mon, 15 Jan 2024 14:11:34 +0000
Development

cmake/Source/CTest/cmProcess.cxx*

//starts line 93
  uv_pipe_open(pipe_reader, fds[0]);
  uv_pipe_open(pipe_writer, fds[1]);

  uv_stdio_container_t stdio[3];
  stdio[0].flags = UV_INHERIT_FD;
  stdio[0].data.fd = 0;
  stdio[1].flags = UV_INHERIT_STREAM;
  stdio[1].data.stream = pipe_writer;
  stdio[2] = stdio[1];

  uv_process_options_t options = uv_process_options_t();
  options.file = this->Command.data();
  options.args = const_cast<char**>(this->ProcessArgs.data());
  options.stdio_count = 3; // in, out and err
  options.exit_cb = &cmProcess::OnExitCB;
  options.stdio = stdio;

Problem
The above initialises all 3 file descriptors; “in out and err” but stderr is not used as it is just run through stdout stdio[2] = stdio[1] . I wish to use the outputof these two separate file descriptors separately.

Changes
A new property for tests add_test() called MERGE_OUTPUTS should be introduced. Default set to true, which would keep the same behavior as current.
But when set to false, --output-log and --output-junit would have seperate output fields for stdout and stderr.

Conflicts
Regex properties, (ie PASS_ FAIL_ SKIP_) would not be affected and run the same as before.
I have been informed that this may affect DartMeasurement but this is not an area I have knowledge of so would appreciate any advice on this.

Extension
This could also be introduced as a flag when running ctest --merge-output that would override the test’s properties.

7 posts - 4 participants