|
|
@@ -14,6 +14,7 @@
|
|
|
#include "cmsys/RegularExpression.hxx"
|
|
|
#include <chrono>
|
|
|
#include <cmAlgorithms.h>
|
|
|
+#include <cstring>
|
|
|
#include <iomanip>
|
|
|
#include <ratio>
|
|
|
#include <sstream>
|
|
|
@@ -248,11 +249,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
|
|
|
*this->TestHandler->LogFile << "Test time = " << buf << std::endl;
|
|
|
}
|
|
|
|
|
|
- // Set the working directory to the tests directory to process Dart files.
|
|
|
- {
|
|
|
- cmWorkingDirectory workdir(this->TestProperties->Directory);
|
|
|
- this->DartProcessing();
|
|
|
- }
|
|
|
+ this->DartProcessing();
|
|
|
|
|
|
// if this is doing MemCheck then all the output needs to be put into
|
|
|
// Output since that is what is parsed by cmCTestMemCheckHandler
|
|
|
@@ -338,6 +335,13 @@ bool cmCTestRunTest::StartAgain()
|
|
|
this->RunAgain = false; // reset
|
|
|
// change to tests directory
|
|
|
cmWorkingDirectory workdir(this->TestProperties->Directory);
|
|
|
+ if (workdir.Failed()) {
|
|
|
+ this->StartFailure("Failed to change working directory to " +
|
|
|
+ this->TestProperties->Directory + " : " +
|
|
|
+ std::strerror(workdir.GetLastResult()));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
this->StartTest(this->TotalNumberOfTests);
|
|
|
return true;
|
|
|
}
|
|
|
@@ -386,6 +390,37 @@ void cmCTestRunTest::MemCheckPostProcess()
|
|
|
handler->PostProcessTest(this->TestResult, this->Index);
|
|
|
}
|
|
|
|
|
|
+void cmCTestRunTest::StartFailure(std::string const& output)
|
|
|
+{
|
|
|
+ // Still need to log the Start message so the test summary records our
|
|
|
+ // attempt to start this test
|
|
|
+ cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
|
|
+ std::setw(2 * getNumWidth(this->TotalNumberOfTests) + 8)
|
|
|
+ << "Start "
|
|
|
+ << std::setw(getNumWidth(this->TestHandler->GetMaxIndex()))
|
|
|
+ << this->TestProperties->Index << ": "
|
|
|
+ << this->TestProperties->Name << std::endl);
|
|
|
+
|
|
|
+ this->ProcessOutput.clear();
|
|
|
+ if (!output.empty()) {
|
|
|
+ *this->TestHandler->LogFile << output << std::endl;
|
|
|
+ cmCTestLog(this->CTest, ERROR_MESSAGE, output << std::endl);
|
|
|
+ }
|
|
|
+
|
|
|
+ this->TestResult.Properties = this->TestProperties;
|
|
|
+ this->TestResult.ExecutionTime = cmDuration::zero();
|
|
|
+ this->TestResult.CompressOutput = false;
|
|
|
+ this->TestResult.ReturnValue = -1;
|
|
|
+ this->TestResult.CompletionStatus = "Failed to start";
|
|
|
+ this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
|
|
|
+ this->TestResult.TestCount = this->TestProperties->Index;
|
|
|
+ this->TestResult.Name = this->TestProperties->Name;
|
|
|
+ this->TestResult.Path = this->TestProperties->Directory;
|
|
|
+ this->TestResult.Output = output;
|
|
|
+ this->TestResult.FullCommandLine.clear();
|
|
|
+ this->TestProcess = cm::make_unique<cmProcess>(*this);
|
|
|
+}
|
|
|
+
|
|
|
// Starts the execution of a test. Returns once it has started
|
|
|
bool cmCTestRunTest::StartTest(size_t total)
|
|
|
{
|