mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-21 05:38:24 -05:00
CTest: Report more detail about system exceptions in tests
This passes the system exception string up to CDash and to the command line instead of just printing "other".
This commit is contained in:
@@ -237,6 +237,8 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
|
|||||||
} else if (res == cmsysProcess_State_Exception) {
|
} else if (res == cmsysProcess_State_Exception) {
|
||||||
outputTestErrorsToConsole = this->CTest->OutputTestOutputOnTestFailure;
|
outputTestErrorsToConsole = this->CTest->OutputTestOutputOnTestFailure;
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Exception: ");
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Exception: ");
|
||||||
|
this->TestResult.ExceptionStatus =
|
||||||
|
this->TestProcess->GetExitExceptionString();
|
||||||
switch (this->TestProcess->GetExitException()) {
|
switch (this->TestProcess->GetExitException()) {
|
||||||
case cmsysProcess_Exception_Fault:
|
case cmsysProcess_Exception_Fault:
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, "SegFault");
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, "SegFault");
|
||||||
@@ -255,7 +257,8 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
|
|||||||
this->TestResult.Status = cmCTestTestHandler::NUMERICAL;
|
this->TestResult.Status = cmCTestTestHandler::NUMERICAL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Other");
|
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
||||||
|
this->TestResult.ExceptionStatus);
|
||||||
this->TestResult.Status = cmCTestTestHandler::OTHER_FAULT;
|
this->TestResult.Status = cmCTestTestHandler::OTHER_FAULT;
|
||||||
}
|
}
|
||||||
} else if ("Disabled" == this->TestResult.CompletionStatus) {
|
} else if ("Disabled" == this->TestResult.CompletionStatus) {
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||||
#include "cmCTestTestHandler.h"
|
#include "cmCTestTestHandler.h"
|
||||||
|
|
||||||
#include "cmsys/Base64.h"
|
|
||||||
#include "cmsys/Directory.hxx"
|
|
||||||
#include "cmsys/FStream.hxx"
|
|
||||||
#include "cmsys/RegularExpression.hxx"
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cmsys/Base64.h>
|
||||||
|
#include <cmsys/Directory.hxx>
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
@@ -33,6 +31,7 @@
|
|||||||
#include "cm_auto_ptr.hxx"
|
#include "cm_auto_ptr.hxx"
|
||||||
#include "cm_utf8.h"
|
#include "cm_utf8.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
|
#include "cmsys/FStream.hxx"
|
||||||
|
|
||||||
class cmExecutionStatus;
|
class cmExecutionStatus;
|
||||||
|
|
||||||
@@ -549,10 +548,10 @@ int cmCTestTestHandler::ProcessHandler()
|
|||||||
!cmHasLiteralPrefix(ftit->CompletionStatus, "SKIP_RETURN_CODE=") &&
|
!cmHasLiteralPrefix(ftit->CompletionStatus, "SKIP_RETURN_CODE=") &&
|
||||||
ftit->CompletionStatus != "Disabled") {
|
ftit->CompletionStatus != "Disabled") {
|
||||||
ofs << ftit->TestCount << ":" << ftit->Name << std::endl;
|
ofs << ftit->TestCount << ":" << ftit->Name << std::endl;
|
||||||
cmCTestLog(
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t"
|
||||||
this->CTest, HANDLER_OUTPUT, "\t"
|
<< std::setw(3) << ftit->TestCount << " - "
|
||||||
<< std::setw(3) << ftit->TestCount << " - " << ftit->Name << " ("
|
<< ftit->Name << " (" << this->GetTestStatus(&*ftit)
|
||||||
<< this->GetTestStatus(ftit->Status) << ")" << std::endl);
|
<< ")" << std::endl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1299,7 +1298,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml)
|
|||||||
xml.StartElement("NamedMeasurement");
|
xml.StartElement("NamedMeasurement");
|
||||||
xml.Attribute("type", "text/string");
|
xml.Attribute("type", "text/string");
|
||||||
xml.Attribute("name", "Exit Code");
|
xml.Attribute("name", "Exit Code");
|
||||||
xml.Element("Value", this->GetTestStatus(result->Status));
|
xml.Element("Value", this->GetTestStatus(result));
|
||||||
xml.EndElement(); // NamedMeasurement
|
xml.EndElement(); // NamedMeasurement
|
||||||
|
|
||||||
xml.StartElement("NamedMeasurement");
|
xml.StartElement("NamedMeasurement");
|
||||||
@@ -1693,17 +1692,20 @@ void cmCTestTestHandler::UseExcludeRegExp()
|
|||||||
this->UseExcludeRegExpFirst = !this->UseIncludeRegExpFlag;
|
this->UseExcludeRegExpFirst = !this->UseIncludeRegExpFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* cmCTestTestHandler::GetTestStatus(int status)
|
const char* cmCTestTestHandler::GetTestStatus(const cmCTestTestResult* result)
|
||||||
{
|
{
|
||||||
static const char* statuses[] = { "Not Run", "Timeout", "SEGFAULT",
|
static const char* statuses[] = { "Not Run", "Timeout", "SEGFAULT",
|
||||||
"ILLEGAL", "INTERRUPT", "NUMERICAL",
|
"ILLEGAL", "INTERRUPT", "NUMERICAL",
|
||||||
"OTHER_FAULT", "Failed", "BAD_COMMAND",
|
"OTHER_FAULT", "Failed", "BAD_COMMAND",
|
||||||
"Completed" };
|
"Completed" };
|
||||||
|
int status = result->Status;
|
||||||
if (status < cmCTestTestHandler::NOT_RUN ||
|
if (status < cmCTestTestHandler::NOT_RUN ||
|
||||||
status > cmCTestTestHandler::COMPLETED) {
|
status > cmCTestTestHandler::COMPLETED) {
|
||||||
return "No Status";
|
return "No Status";
|
||||||
}
|
}
|
||||||
|
if (status == cmCTestTestHandler::OTHER_FAULT) {
|
||||||
|
return result->ExceptionStatus.c_str();
|
||||||
|
}
|
||||||
return statuses[status];
|
return statuses[status];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ public:
|
|||||||
double ExecutionTime;
|
double ExecutionTime;
|
||||||
int ReturnValue;
|
int ReturnValue;
|
||||||
int Status;
|
int Status;
|
||||||
|
std::string ExceptionStatus;
|
||||||
bool CompressOutput;
|
bool CompressOutput;
|
||||||
std::string CompletionStatus;
|
std::string CompletionStatus;
|
||||||
std::string Output;
|
std::string Output;
|
||||||
@@ -262,7 +263,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
std::string FindTheExecutable(const char* exe);
|
std::string FindTheExecutable(const char* exe);
|
||||||
|
|
||||||
const char* GetTestStatus(int status);
|
const char* GetTestStatus(const cmCTestTestResult*);
|
||||||
void ExpandTestsToRunInformation(size_t numPossibleTests);
|
void ExpandTestsToRunInformation(size_t numPossibleTests);
|
||||||
void ExpandTestsToRunInformationForRerunFailed();
|
void ExpandTestsToRunInformationForRerunFailed();
|
||||||
|
|
||||||
|
|||||||
@@ -240,3 +240,8 @@ int cmProcess::GetExitException()
|
|||||||
{
|
{
|
||||||
return cmsysProcess_GetExitException(this->Process);
|
return cmsysProcess_GetExitException(this->Process);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string cmProcess::GetExitExceptionString()
|
||||||
|
{
|
||||||
|
return cmsysProcess_GetExceptionString(this->Process);
|
||||||
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public:
|
|||||||
int GetExitValue() { return this->ExitValue; }
|
int GetExitValue() { return this->ExitValue; }
|
||||||
double GetTotalTime() { return this->TotalTime; }
|
double GetTotalTime() { return this->TotalTime; }
|
||||||
int GetExitException();
|
int GetExitException();
|
||||||
|
std::string GetExitExceptionString();
|
||||||
/**
|
/**
|
||||||
* Read one line of output but block for no more than timeout.
|
* Read one line of output but block for no more than timeout.
|
||||||
* Returns:
|
* Returns:
|
||||||
|
|||||||
Reference in New Issue
Block a user