From f7b977d919d3b02f23c0ab0cd6728160055ce84b Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 17 Jun 2021 21:01:06 +0200 Subject: [PATCH] Fix SyncthingTestInstance --- testhelper/syncthingtestinstance.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/testhelper/syncthingtestinstance.cpp b/testhelper/syncthingtestinstance.cpp index 9d47809..155ce47 100644 --- a/testhelper/syncthingtestinstance.cpp +++ b/testhelper/syncthingtestinstance.cpp @@ -101,21 +101,16 @@ void SyncthingTestInstance::stop() } if (m_syncthingProcess.isOpen()) { cerr << "\n - Syncthing terminated with exit code " << m_syncthingProcess.exitCode() << ".\n"; - /* - const auto stdOut(m_syncthingProcess.readAllStandardOutput()); - if (!stdOut.isEmpty()) { - cerr << "\n - Syncthing stdout during the testrun:\n" << stdOut.data(); + const auto output = m_syncthingProcess.readAll(); + if (!output.isEmpty()) { + cerr << "\n - Syncthing output (merged stdout/stderr) during the testrun:\n" + << std::string_view(output.data(), static_cast(output.size())); } - const auto stdErr(m_syncthingProcess.readAllStandardError()); - if (!stdErr.isEmpty()) { - cerr << "\n - Syncthing stderr during the testrun:\n" << stdErr.data(); + if (!output.isEmpty()) { + cerr << "\n - Syncthing (re)started: " << output.count("INFO: Starting syncthing") << " times"; + cerr << "\n - Syncthing exited: " << output.count("INFO: Syncthing exited: exit status") << " times"; + cerr << "\n - Syncthing panicked: " << output.count("WARNING: Panic detected") << " times"; } - if (!stdOut.isEmpty()) { - cerr << "\n - Syncthing (re)started: " << stdOut.count("INFO: Starting syncthing") << " times"; - cerr << "\n - Syncthing exited: " << stdOut.count("INFO: Syncthing exited: exit status") << " times"; - cerr << "\n - Syncthing panicked: " << stdOut.count("WARNING: Panic detected") << " times"; - } - */ } } @@ -128,7 +123,7 @@ void SyncthingTestInstance::setInterleavedOutputEnabled(bool interleavedOutputEn return; } m_interleavedOutput = interleavedOutputEnabled; - //m_syncthingProcess.setProcessChannelMode(interleavedOutputEnabled ? QProcess::ForwardedChannels : QProcess::SeparateChannels); + m_syncthingProcess.setProcessChannelMode(interleavedOutputEnabled ? QProcess::ForwardedChannels : QProcess::MergedChannels); } /*!