summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2024-08-01 21:31:09 (GMT)
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2024-08-01 22:14:57 (GMT)
commit29db283ba76605de7a19d504cfeeb25d9e75cf90 (patch)
treeaf3963fe6cf40813b521cc70085fbc5f96432588
parent98d86fdc62e84df82536ad73978e4b73a0fafde7 (diff)
downloadCMake-29db283ba76605de7a19d504cfeeb25d9e75cf90.zip
CMake-29db283ba76605de7a19d504cfeeb25d9e75cf90.tar.gz
CMake-29db283ba76605de7a19d504cfeeb25d9e75cf90.tar.bz2
CTest: remove cmCTestLogWrite helper
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx5
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx13
-rw-r--r--Source/cmCTest.cxx16
-rw-r--r--Source/cmCTest.h23
4 files changed, 16 insertions, 41 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 859798e..e962cc7 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -8,6 +8,7 @@
#include <set>
#include <utility>
+#include <cm/string_view>
#include <cmext/algorithm>
#include <cm3p/uv.h>
@@ -1121,10 +1122,10 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length,
// And if this is verbose output, display the content of the chunk
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- cmCTestLogWrite(data, length));
+ cm::string_view(data, length));
// Always store the chunk to the file
- ofs << cmCTestLogWrite(data, length);
+ ofs << cm::string_view(data, length);
}
int cmCTestBuildHandler::ProcessSingleLine(const char* data)
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 85c77be..b0f07e5 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -9,6 +9,7 @@
#include <cm/iomanip>
#include <cm/optional>
+#include <cm/string_view>
#include <cmext/algorithm>
#include <cm3p/curl/curl.h>
@@ -360,7 +361,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
if (!chunk.empty()) {
cmCTestOptionalLog(this->CTest, DEBUG,
"CURL output: ["
- << cmCTestLogWrite(chunk.data(), chunk.size())
+ << cm::string_view(chunk.data(), chunk.size())
<< "]" << std::endl,
this->Quiet);
this->ParseResponse(chunk);
@@ -369,7 +370,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
cmCTestOptionalLog(
this->CTest, DEBUG,
"CURL debug output: ["
- << cmCTestLogWrite(chunkDebug.data(), chunkDebug.size()) << "]"
+ << cm::string_view(chunkDebug.data(), chunkDebug.size()) << "]"
<< std::endl,
this->Quiet);
}
@@ -423,7 +424,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
if (!chunk.empty()) {
cmCTestOptionalLog(this->CTest, DEBUG,
"CURL output: ["
- << cmCTestLogWrite(chunk.data(), chunk.size())
+ << cm::string_view(chunk.data(), chunk.size())
<< "]" << std::endl,
this->Quiet);
this->ParseResponse(chunk);
@@ -451,11 +452,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
// avoid deref of begin for zero size array
if (!chunk.empty()) {
*this->LogFile << " Curl output was: "
- << cmCTestLogWrite(chunk.data(), chunk.size())
+ << cm::string_view(chunk.data(), chunk.size())
<< std::endl;
cmCTestLog(this->CTest, ERROR_MESSAGE,
"CURL output: ["
- << cmCTestLogWrite(chunk.data(), chunk.size()) << "]"
+ << cm::string_view(chunk.data(), chunk.size()) << "]"
<< std::endl);
}
::curl_easy_cleanup(curl);
@@ -504,7 +505,7 @@ void cmCTestSubmitHandler::ParseResponse(
if (this->HasWarnings || this->HasErrors) {
cmCTestLog(this->CTest, HANDLER_OUTPUT,
" Server Response:\n"
- << cmCTestLogWrite(chunk.data(), chunk.size()) << "\n");
+ << cm::string_view(chunk.data(), chunk.size()) << "\n");
}
}
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index e1aefd9..f42d7f6 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1140,10 +1140,9 @@ bool cmCTest::RunMakeCommand(const std::string& command, std::string& output,
<< "K\n " << std::flush);
}
}
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT,
- cmCTestLogWrite(strdata.c_str(), strdata.size()));
+ cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, strdata);
if (ofs) {
- ofs << cmCTestLogWrite(strdata.c_str(), strdata.size());
+ ofs << strdata;
}
},
[this, &processOutput, &output, &ofs]() {
@@ -1151,10 +1150,9 @@ bool cmCTest::RunMakeCommand(const std::string& command, std::string& output,
processOutput.DecodeText(std::string(), strdata);
if (!strdata.empty()) {
output.append(strdata);
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT,
- cmCTestLogWrite(strdata.c_str(), strdata.size()));
+ cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, strdata);
if (ofs) {
- ofs << cmCTestLogWrite(strdata.c_str(), strdata.size());
+ ofs << strdata;
}
}
});
@@ -1306,8 +1304,7 @@ bool cmCTest::RunTest(const std::vector<std::string>& argv,
if (output) {
cm::append(tempOutput, data.data(), data.data() + data.size());
}
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT,
- cmCTestLogWrite(strdata.c_str(), strdata.size()));
+ cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, strdata);
if (log) {
log->write(strdata.c_str(), strdata.size());
}
@@ -1316,8 +1313,7 @@ bool cmCTest::RunTest(const std::vector<std::string>& argv,
std::string strdata;
processOutput.DecodeText(std::string(), strdata);
if (!strdata.empty()) {
- cmCTestLog(this, HANDLER_VERBOSE_OUTPUT,
- cmCTestLogWrite(strdata.c_str(), strdata.size()));
+ cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, strdata);
if (log) {
log->write(strdata.c_str(), strdata.size());
}
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index ae2431c..85f75fd 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -549,29 +549,6 @@ private:
std::unique_ptr<Private> Impl;
};
-class cmCTestLogWrite
-{
-public:
- cmCTestLogWrite(const char* data, size_t length)
- : Data(data)
- , Length(length)
- {
- }
-
- const char* Data;
- size_t Length;
-};
-
-inline std::ostream& operator<<(std::ostream& os, const cmCTestLogWrite& c)
-{
- if (!c.Length) {
- return os;
- }
- os.write(c.Data, c.Length);
- os.flush();
- return os;
-}
-
#define cmCTestLog(ctSelf, logType, msg) \
do { \
std::ostringstream cmCTestLog_msg; \