mirror of
https://github.com/google/googletest.git
synced 2024-12-28 19:15:24 +08:00
Removed flush scopes around GTEST_LOG(FATAL) and exit call since FATAL is expected to abort()
This commit is contained in:
parent
ee53b281ba
commit
f6dde80e94
@ -3449,12 +3449,8 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener {
|
|||||||
XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)
|
XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)
|
||||||
: output_file_(output_file) {
|
: output_file_(output_file) {
|
||||||
if (output_file_.c_str() == NULL || output_file_.empty()) {
|
if (output_file_.c_str() == NULL || output_file_.empty()) {
|
||||||
{
|
|
||||||
// scoped to make sure the log is flushed before we exit
|
|
||||||
GTEST_LOG_(FATAL) << "XML output file may not be null";
|
GTEST_LOG_(FATAL) << "XML output file may not be null";
|
||||||
}
|
}
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called after the unit test ends.
|
// Called after the unit test ends.
|
||||||
@ -3478,12 +3474,9 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
|
|||||||
// 3. To interpret the meaning of errno in a thread-safe way,
|
// 3. To interpret the meaning of errno in a thread-safe way,
|
||||||
// we need the strerror_r() function, which is not available on
|
// we need the strerror_r() function, which is not available on
|
||||||
// Windows.
|
// Windows.
|
||||||
{ // scoped to ensure the log is flushed before we exit
|
|
||||||
GTEST_LOG_(FATAL) << "Unable to open file \""
|
GTEST_LOG_(FATAL) << "Unable to open file \""
|
||||||
<< output_file_ << "\"";
|
<< output_file_ << "\"";
|
||||||
}
|
}
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
PrintXmlUnitTest(&stream, unit_test);
|
PrintXmlUnitTest(&stream, unit_test);
|
||||||
fprintf(xmlout, "%s", StringStreamToString(&stream).c_str());
|
fprintf(xmlout, "%s", StringStreamToString(&stream).c_str());
|
||||||
@ -5283,13 +5276,10 @@ bool ParseGoogleTestFlag(const char* const arg) {
|
|||||||
void LoadFlagsFromFile(const std::string& path) {
|
void LoadFlagsFromFile(const std::string& path) {
|
||||||
FILE* flagfile = posix::FOpen(path.c_str(), "r");
|
FILE* flagfile = posix::FOpen(path.c_str(), "r");
|
||||||
if (!flagfile) {
|
if (!flagfile) {
|
||||||
{ // scoped to ensure the log is flushed before we exit
|
|
||||||
GTEST_LOG_(FATAL) << "Unable to open file \""
|
GTEST_LOG_(FATAL) << "Unable to open file \""
|
||||||
<< GTEST_FLAG(flagfile)
|
<< GTEST_FLAG(flagfile)
|
||||||
<< "\"";
|
<< "\"";
|
||||||
}
|
}
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
std::string contents(ReadEntireFile(flagfile));
|
std::string contents(ReadEntireFile(flagfile));
|
||||||
posix::FClose(flagfile);
|
posix::FClose(flagfile);
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user