diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-10-13 13:30:33 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-10-13 13:30:33 (GMT) |
commit | 2f713072c7a5676c89c0a31efa90a67dcb923c90 (patch) | |
tree | e0bf20697ba7cc12d3eb8ef598f977af1060ea4d | |
parent | 052cb7753bfb30436c7996181d5676ca9b24ecce (diff) | |
download | CMake-2f713072c7a5676c89c0a31efa90a67dcb923c90.zip CMake-2f713072c7a5676c89c0a31efa90a67dcb923c90.tar.gz CMake-2f713072c7a5676c89c0a31efa90a67dcb923c90.tar.bz2 |
ENH: Report command line as a measurement and allow user to add custom measurements
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 29 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 30 | ||||
-rw-r--r-- | Source/kwsys/CMakeLists.txt | 1 |
3 files changed, 46 insertions, 14 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index ffa79c3..c1a8dc8 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -608,6 +608,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed, const std::string& testname = it->Name; std::vector<std::string>& args = it->Args; cmCTestTestResult cres; + cres.Properties = &*it; cres.ExecutionTime = 0; cres.ReturnValue = -1; cres.Status = cmCTestTestHandler::NOT_RUN; @@ -1001,6 +1002,20 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os) << result->CompletionStatus << "</Value></NamedMeasurement>\n"; } os + << "\t\t\t<NamedMeasurement type=\"text/string\" " + << "name=\"Command Line\"><Value>" + << result->FullCommandLine << "</Value></NamedMeasurement>\n"; + std::map<cmStdString,cmStdString>::iterator measureIt; + for ( measureIt = result->Properties->Measurements.begin(); + measureIt != result->Properties->Measurements.end(); + ++ measureIt ) + { + os + << "\t\t\t<NamedMeasurement type=\"text/string\" " + << "name=\"" << measureIt->first.c_str() << "\"><Value>" + << measureIt->second.c_str() << "</Value></NamedMeasurement>\n"; + } + os << "\t\t\t<Measurement>\n" << "\t\t\t\t<Value>"; os << cmCTest::MakeXMLSafe(result->Output); @@ -1635,6 +1650,20 @@ bool cmCTestTestHandler::SetTestsProperties( cmsys::RegularExpression(crit->c_str())); } } + if ( key == "MEASUREMENT" ) + { + size_t pos = val.find_first_of("="); + if ( pos != val.npos ) + { + std::string mKey = val.substr(0, pos); + const char* mVal = val.c_str() + pos + 1; + rtit->Measurements[mKey] = mVal; + } + else + { + rtit->Measurements[val] = "1"; + } + } if ( key == "PASS_REGULAR_EXPRESSION" ) { std::vector<std::string> lval; diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index c1d3c8f..1b47e55 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -73,20 +73,6 @@ public: */ bool SetTestsProperties(const std::vector<std::string>& args); - struct cmCTestTestResult - { - std::string Name; - std::string Path; - std::string FullCommandLine; - double ExecutionTime; - int ReturnValue; - int Status; - std::string CompletionStatus; - std::string Output; - std::string RegressionImages; - int TestCount; - }; - void Initialize(); protected: @@ -97,10 +83,26 @@ protected: std::vector<std::string> Args; std::vector<cmsys::RegularExpression> ErrorRegularExpressions; std::vector<cmsys::RegularExpression> RequiredRegularExpressions; + std::map<cmStdString, cmStdString> Measurements; bool IsInBasedOnREOptions; bool WillFail; }; + struct cmCTestTestResult + { + std::string Name; + std::string Path; + std::string FullCommandLine; + double ExecutionTime; + int ReturnValue; + int Status; + std::string CompletionStatus; + std::string Output; + std::string RegressionImages; + int TestCount; + cmCTestTestProperties* Properties; + }; + virtual int PreProcessHandler(); virtual int PostProcessHandler(); diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index e3f8ff2..b3febd2 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -914,6 +914,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) GET_TEST_PROPERTY(kwsys.testFail WILL_FAIL wfv) SET_TESTS_PROPERTIES(kwsys.testRegistry PROPERTIES FAIL_REGULAR_EXPRESSION "ERROR;FAIL;Test failed") SET_TESTS_PROPERTIES(kwsys.testRegistry PROPERTIES PASS_REGULAR_EXPRESSION "Test passed") + SET_TESTS_PROPERTIES(kwsys.testFail PROPERTIES MEASUREMENT "Some Key=Some Value") MESSAGE(STATUS "GET_TEST_PROPERTY returned: ${wfv}") ENDIF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY AND KWSYS_STANDALONE) ENDIF(BUILD_TESTING) |