MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / Run

Function Run

OpenCppCoverage/OpenCppCoverage.cpp:151–203  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

149
150 //-----------------------------------------------------------------------------
151 int Run(const cov::Options& options,
152 const Exporter::ExporterPluginManager& exporterPluginManager,
153 std::shared_ptr<Tools::WarningManager> warningManager)
154 {
155 InitLogger(options);
156
157 auto coveraDatas = LoadInputCoverageDatas(options);
158 const auto* startInfo = options.GetStartInfo();
159
160 std::wostringstream ostr;
161 ostr << std::endl << options;
162 LOG_INFO << L"Start Program:" << ostr.str();
163
164 cov::CodeCoverageRunner codeCoverageRunner{ warningManager };
165 cov::CoverageFilterSettings coverageFilterSettings{ options.GetModulePatterns(), options.GetSourcePatterns() };
166 auto exitCode = 0;
167
168 if (startInfo)
169 {
170 size_t maxUnmatchPathsForWarning = (options.GetLogLevel() == cov::LogLevel::Verbose)
171 ? std::numeric_limits<size_t>::max() : 30;
172
173 cov::RunCoverageSettings runCoverageSettings(
174 *startInfo,
175 coverageFilterSettings,
176 options.GetUnifiedDiffSettingsCollection(),
177 options.GetExcludedLineRegexes(),
178 options.GetSubstitutePdbSourcePaths());
179
180 runCoverageSettings.SetCoverChildren(options.IsCoverChildrenModeEnabled());
181 runCoverageSettings.SetContinueAfterCppException(options.IsContinueAfterCppExceptionModeEnabled());
182 runCoverageSettings.SetStopOnAssert(options.IsStopOnAssertModeEnabled());
183 runCoverageSettings.SetMaxUnmatchPathsForWarning(maxUnmatchPathsForWarning);
184 runCoverageSettings.SetOptimizedBuildSupport(options.IsOptimizedBuildSupportEnabled());
185 auto coverageData = codeCoverageRunner.RunCoverage(runCoverageSettings);
186 exitCode = coverageData.GetExitCode();
187 coveraDatas.push_back(std::move(coverageData));
188 }
189 cov::CoverageDataMerger coverageDataMerger;
190
191 auto coverageData = coverageDataMerger.Merge(coveraDatas);
192
193 if (options.IsAggregateByFileModeEnabled())
194 coverageDataMerger.MergeFileCoverage(coverageData);
195
196 Export(options, exporterPluginManager, coverageData);
197 LOG_INFO << L"The code coverage report is not what you expect? See the FAQ "
198 L"https://github.com/OpenCppCoverage/OpenCppCoverage/wiki/FAQ.";
199
200 if (exitCode)
201 LOG_ERROR << L"Your program stop with error code: " << exitCode;
202 return exitCode;
203 }
204 }
205
206 //-----------------------------------------------------------------------------

Callers 2

TEST_FFunction · 0.85
RunMethod · 0.85

Calls 15

InitLoggerFunction · 0.85
LoadInputCoverageDatasFunction · 0.85
ExportFunction · 0.85
GetStartInfoMethod · 0.80
GetLogLevelMethod · 0.80
SetCoverChildrenMethod · 0.80
SetStopOnAssertMethod · 0.80

Tested by 1

TEST_FFunction · 0.68