summaryrefslogtreecommitdiff
path: root/Source/CTest/cmCTestTestHandler.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CTest/cmCTestTestHandler.h')
-rw-r--r--Source/CTest/cmCTestTestHandler.h111
1 files changed, 81 insertions, 30 deletions
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 0edcb143a..eab75d0eb 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -3,19 +3,26 @@
#ifndef cmCTestTestHandler_h
#define cmCTestTestHandler_h
-#include "cmConfigure.h"
+#include "cmConfigure.h" // IWYU pragma: keep
-#include "cmCTestGenericHandler.h"
-
-#include "cmsys/RegularExpression.hxx"
+#include <chrono>
+#include <cstdint>
#include <iosfwd>
#include <map>
#include <set>
-#include <stddef.h>
#include <string>
#include <utility>
#include <vector>
+#include <stddef.h>
+
+#include "cmsys/RegularExpression.hxx"
+
+#include "cmCTestGenericHandler.h"
+#include "cmCTestResourceSpec.h"
+#include "cmDuration.h"
+#include "cmListFileCache.h"
+
class cmCTest;
class cmMakefile;
class cmXMLWriter;
@@ -28,18 +35,17 @@ class cmCTestTestHandler : public cmCTestGenericHandler
{
friend class cmCTestRunTest;
friend class cmCTestMultiProcessHandler;
- friend class cmCTestBatchTestHandler;
public:
- typedef cmCTestGenericHandler Superclass;
+ using Superclass = cmCTestGenericHandler;
/**
* The main entry point for this class
*/
- int ProcessHandler() CM_OVERRIDE;
+ int ProcessHandler() override;
/**
- * When both -R and -I are used should te resulting test list be the
+ * When both -R and -I are used should the resulting test list be the
* intersection or the union of the lists. By default it is the
* intersection.
*/
@@ -54,9 +60,9 @@ public:
/**
* This method is called when reading CTest custom file
*/
- void PopulateCustomVectors(cmMakefile* mf) CM_OVERRIDE;
+ void PopulateCustomVectors(cmMakefile* mf) override;
- ///! Control the use of the regular expresisons, call these methods to turn
+ //! Control the use of the regular expresisons, call these methods to turn
/// them on
void UseIncludeRegExp();
void UseExcludeRegExp();
@@ -75,7 +81,7 @@ public:
this->CustomMaximumFailedTestOutputSize = n;
}
- ///! pass the -I argument down
+ //! pass the -I argument down
void SetTestsToRunInformation(const char*);
cmCTestTestHandler();
@@ -90,7 +96,22 @@ public:
*/
bool SetTestsProperties(const std::vector<std::string>& args);
- void Initialize() CM_OVERRIDE;
+ /**
+ * Set directory properties
+ */
+ bool SetDirectoryProperties(const std::vector<std::string>& args);
+
+ void Initialize() override;
+
+ struct cmCTestTestResourceRequirement
+ {
+ std::string ResourceType;
+ int SlotsNeeded;
+ int UnitsNeeded;
+
+ bool operator==(const cmCTestTestResourceRequirement& other) const;
+ bool operator!=(const cmCTestTestResourceRequirement& other) const;
+ };
// NOTE: This struct is Saved/Restored
// in cmCTestTestHandler, if you add to this class
@@ -105,11 +126,13 @@ public:
std::vector<std::string> Depends;
std::vector<std::string> AttachedFiles;
std::vector<std::string> AttachOnFail;
- std::vector<std::pair<cmsys::RegularExpression, std::string> >
+ std::vector<std::pair<cmsys::RegularExpression, std::string>>
ErrorRegularExpressions;
- std::vector<std::pair<cmsys::RegularExpression, std::string> >
+ std::vector<std::pair<cmsys::RegularExpression, std::string>>
RequiredRegularExpressions;
- std::vector<std::pair<cmsys::RegularExpression, std::string> >
+ std::vector<std::pair<cmsys::RegularExpression, std::string>>
+ SkipRegularExpressions;
+ std::vector<std::pair<cmsys::RegularExpression, std::string>>
TimeoutRegularExpressions;
std::map<std::string, std::string> Measurements;
bool IsInBasedOnREOptions;
@@ -118,12 +141,14 @@ public:
float Cost;
int PreviousRuns;
bool RunSerial;
- double Timeout;
+ cmDuration Timeout;
bool ExplicitTimeout;
- double AlternateTimeout;
+ cmDuration AlternateTimeout;
int Index;
// Requested number of process slots
int Processors;
+ bool WantAffinity;
+ std::vector<size_t> Affinity;
// return code of test which will mark test as "not run"
int SkipReturnCode;
std::vector<std::string> Environment;
@@ -133,6 +158,9 @@ public:
std::set<std::string> FixturesCleanup;
std::set<std::string> FixturesRequired;
std::set<std::string> RequireSuccessDepends;
+ std::vector<std::vector<cmCTestTestResourceRequirement>> ResourceGroups;
+ // Private test generator properties used to track backtraces
+ cmListFileBacktrace Backtrace;
};
struct cmCTestTestResult
@@ -141,9 +169,10 @@ public:
std::string Path;
std::string Reason;
std::string FullCommandLine;
- double ExecutionTime;
- int ReturnValue;
+ cmDuration ExecutionTime;
+ std::int64_t ReturnValue;
int Status;
+ std::string ExceptionStatus;
bool CompressOutput;
std::string CompletionStatus;
std::string Output;
@@ -173,33 +202,51 @@ public:
std::vector<std::string>& extraPaths,
std::vector<std::string>& failed);
- typedef std::vector<cmCTestTestProperties> ListOfTests;
+ static bool ParseResourceGroupsProperty(
+ const std::string& val,
+ std::vector<std::vector<cmCTestTestResourceRequirement>>& resourceGroups);
+
+ using ListOfTests = std::vector<cmCTestTestProperties>;
protected:
+ using SetOfTests =
+ std::set<cmCTestTestHandler::cmCTestTestResult, cmCTestTestResultLess>;
+
// compute a final test list
virtual int PreProcessHandler();
virtual int PostProcessHandler();
virtual void GenerateTestCommand(std::vector<std::string>& args, int test);
int ExecuteCommands(std::vector<std::string>& vec);
- void WriteTestResultHeader(cmXMLWriter& xml, cmCTestTestResult* result);
- void WriteTestResultFooter(cmXMLWriter& xml, cmCTestTestResult* result);
+ bool ProcessOptions();
+ void LogTestSummary(const std::vector<std::string>& passed,
+ const std::vector<std::string>& failed,
+ const cmDuration& durationInSecs);
+ void LogDisabledTests(const std::vector<cmCTestTestResult>& disabledTests);
+ void LogFailedTests(const std::vector<std::string>& failed,
+ const SetOfTests& resultsSet);
+ bool GenerateXML();
+
+ void WriteTestResultHeader(cmXMLWriter& xml,
+ cmCTestTestResult const& result);
+ void WriteTestResultFooter(cmXMLWriter& xml,
+ cmCTestTestResult const& result);
// Write attached test files into the xml
- void AttachFiles(cmXMLWriter& xml, cmCTestTestResult* result);
+ void AttachFiles(cmXMLWriter& xml, cmCTestTestResult& result);
//! Clean test output to specified length
bool CleanTestOutput(std::string& output, size_t length);
- double ElapsedTestingTime;
+ cmDuration ElapsedTestingTime;
- typedef std::vector<cmCTestTestResult> TestResultsVector;
+ using TestResultsVector = std::vector<cmCTestTestResult>;
TestResultsVector TestResults;
std::vector<std::string> CustomTestsIgnore;
std::string StartTest;
std::string EndTest;
- unsigned int StartTestTime;
- unsigned int EndTestTime;
+ std::chrono::system_clock::time_point StartTestTime;
+ std::chrono::system_clock::time_point EndTestTime;
bool MemCheck;
int CustomMaximumPassedTestOutputSize;
int CustomMaximumFailedTestOutputSize;
@@ -226,7 +273,8 @@ private:
*/
virtual void GenerateDartOutput(cmXMLWriter& xml);
- void PrintLabelSummary();
+ void PrintLabelOrSubprojectSummary(bool isSubProject);
+
/**
* Run the tests for a directory and any subdirectories
*/
@@ -262,7 +310,7 @@ private:
*/
std::string FindTheExecutable(const char* exe);
- const char* GetTestStatus(int status);
+ std::string GetTestStatus(cmCTestTestResult const&);
void ExpandTestsToRunInformation(size_t numPossibleTests);
void ExpandTestsToRunInformationForRerunFailed();
@@ -288,6 +336,9 @@ private:
cmsys::RegularExpression IncludeTestsRegularExpression;
cmsys::RegularExpression ExcludeTestsRegularExpression;
+ bool UseResourceSpec;
+ cmCTestResourceSpec ResourceSpec;
+
void GenerateRegressionImages(cmXMLWriter& xml, const std::string& dart);
cmsys::RegularExpression DartStuff1;
void CheckLabelFilter(cmCTestTestProperties& it);