MCPcopy Create free account
hub / github.com/Kitware/CMake / InvokeImpl

Method InvokeImpl

Source/CTest/cmCTestHandlerCommand.cxx:72–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72bool cmCTestHandlerCommand::InvokeImpl(
73 BasicArguments& args, std::vector<std::string> const& unparsed,
74 cmExecutionStatus& status, std::function<bool()> handler) const
75{
76 // save error state and restore it if needed
77 SaveRestoreErrorState errorState;
78 if (!args.CaptureCMakeError.empty()) {
79 errorState.CaptureCMakeError();
80 }
81
82 bool success = [&]() -> bool {
83 if (args.MaybeReportError(status.GetMakefile())) {
84 return true;
85 }
86
87 std::sort(args.ParsedKeywords.begin(), args.ParsedKeywords.end());
88 auto const it = std::adjacent_find(args.ParsedKeywords.begin(),
89 args.ParsedKeywords.end());
90 if (it != args.ParsedKeywords.end()) {
91 status.SetError(cmStrCat("called with more than one value for ", *it));
92 return false;
93 }
94
95 if (!unparsed.empty()) {
96 status.SetError(
97 cmStrCat("called with unknown argument \"", unparsed.front(), "\"."));
98 return false;
99 }
100
101 return handler();
102 }();
103
104 if (args.CaptureCMakeError.empty()) {
105 return success;
106 }
107
108 if (!success) {
109 cmCTestLog(this->CTest, ERROR_MESSAGE,
110 this->GetName() << ' ' << status.GetError() << '\n');
111 }
112
113 cmMakefile& mf = status.GetMakefile();
114 success = success && !cmSystemTools::GetErrorOccurredFlag();
115 mf.AddDefinition(args.CaptureCMakeError, success ? "0" : "-1");
116 return true;
117}
118
119bool cmCTestHandlerCommand::ExecuteHandlerCommand(
120 HandlerArguments& args, cmExecutionStatus& status) const

Callers 1

InvokeMethod · 0.95

Calls 12

CaptureCMakeErrorMethod · 0.80
MaybeReportErrorMethod · 0.80
cmStrCatFunction · 0.50
emptyMethod · 0.45
GetMakefileMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
SetErrorMethod · 0.45
frontMethod · 0.45
GetNameMethod · 0.45
GetErrorMethod · 0.45
AddDefinitionMethod · 0.45

Tested by

no test coverage detected