mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 14:50:10 -06:00
cmProcess: Use explicit enum for process exit exception
Translate the values from KWSys Process.
This commit is contained in:
@@ -225,19 +225,19 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
|
||||
this->TestResult.ExceptionStatus =
|
||||
this->TestProcess->GetExitExceptionString();
|
||||
switch (this->TestProcess->GetExitException()) {
|
||||
case cmsysProcess_Exception_Fault:
|
||||
case cmProcess::Exception::Fault:
|
||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, "SegFault");
|
||||
this->TestResult.Status = cmCTestTestHandler::SEGFAULT;
|
||||
break;
|
||||
case cmsysProcess_Exception_Illegal:
|
||||
case cmProcess::Exception::Illegal:
|
||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Illegal");
|
||||
this->TestResult.Status = cmCTestTestHandler::ILLEGAL;
|
||||
break;
|
||||
case cmsysProcess_Exception_Interrupt:
|
||||
case cmProcess::Exception::Interrupt:
|
||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Interrupt");
|
||||
this->TestResult.Status = cmCTestTestHandler::INTERRUPT;
|
||||
break;
|
||||
case cmsysProcess_Exception_Numerical:
|
||||
case cmProcess::Exception::Numerical:
|
||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Numerical");
|
||||
this->TestResult.Status = cmCTestTestHandler::NUMERICAL;
|
||||
break;
|
||||
|
||||
@@ -193,9 +193,23 @@ void cmProcess::ResetStartTime()
|
||||
this->StartTime = std::chrono::steady_clock::now();
|
||||
}
|
||||
|
||||
int cmProcess::GetExitException()
|
||||
cmProcess::Exception cmProcess::GetExitException()
|
||||
{
|
||||
return cmsysProcess_GetExitException(this->Process);
|
||||
switch (cmsysProcess_GetExitException(this->Process)) {
|
||||
case cmsysProcess_Exception_None:
|
||||
return Exception::None;
|
||||
case cmsysProcess_Exception_Fault:
|
||||
return Exception::Fault;
|
||||
case cmsysProcess_Exception_Illegal:
|
||||
return Exception::Illegal;
|
||||
case cmsysProcess_Exception_Interrupt:
|
||||
return Exception::Interrupt;
|
||||
case cmsysProcess_Exception_Numerical:
|
||||
return Exception::Numerical;
|
||||
default: // case cmsysProcess_Exception_Other:
|
||||
break;
|
||||
}
|
||||
return Exception::Other;
|
||||
}
|
||||
|
||||
std::string cmProcess::GetExitExceptionString()
|
||||
|
||||
@@ -47,8 +47,20 @@ public:
|
||||
void SetId(int id) { this->Id = id; }
|
||||
int GetExitValue() { return this->ExitValue; }
|
||||
std::chrono::duration<double> GetTotalTime() { return this->TotalTime; }
|
||||
int GetExitException();
|
||||
|
||||
enum class Exception
|
||||
{
|
||||
None,
|
||||
Fault,
|
||||
Illegal,
|
||||
Interrupt,
|
||||
Numerical,
|
||||
Other
|
||||
};
|
||||
|
||||
Exception GetExitException();
|
||||
std::string GetExitExceptionString();
|
||||
|
||||
/**
|
||||
* Read one line of output but block for no more than timeout.
|
||||
* Returns:
|
||||
|
||||
Reference in New Issue
Block a user