MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / check

Method check

test/testprocessexecutor.cpp:76–127  ·  view source on GitHub ↗

* Execute check using n jobs for y files which are have * identical data, given within data. */

Source from the content-addressed store, hash-verified

74 * identical data, given within data.
75 */
76 void check(unsigned int jobs, int files, int result, const std::string &data, const CheckOptions& opt = make_default_obj{}) {
77 std::list<FileSettings> fileSettings;
78
79 std::list<FileWithDetails> filelist;
80 if (opt.filesList.empty()) {
81 for (int i = 1; i <= files; ++i) {
82 std::string f_s = fprefix() + "_" + std::to_string(i) + ".c";
83 filelist.emplace_back(f_s, Standards::Language::C, data.size());
84 if (useFS) {
85 fileSettings.emplace_back(std::move(f_s), Standards::Language::C, data.size());
86 }
87 }
88 }
89 else {
90 for (const auto& f : opt.filesList)
91 {
92 filelist.emplace_back(f, Standards::Language::C, data.size());
93 if (useFS) {
94 fileSettings.emplace_back(f, Standards::Language::C, data.size());
95 }
96 }
97 }
98
99 /*const*/ Settings s = settings;
100 s.jobs = jobs;
101 s.showtime = opt.showtime;
102 s.quiet = opt.quiet;
103 if (opt.plistOutput)
104 s.plistOutput = opt.plistOutput;
105 s.templateFormat = "{callstack}: ({severity}) {inconclusive:inconclusive: }{message}";
106 Suppressions supprs;
107 std::unique_ptr<TimerResults> timerResults;
108 if (s.showtime != Settings::ShowTime::NONE)
109 timerResults.reset(new TimerResults);
110
111 // NOLINTNEXTLINE(performance-unnecessary-value-param)
112 auto executeFn = [](std::string,std::vector<std::string>,std::string,std::string&){
113 return EXIT_SUCCESS;
114 };
115
116 std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
117 scopedfiles.reserve(filelist.size());
118 for (auto i = filelist.cbegin(); i != filelist.cend(); ++i)
119 scopedfiles.emplace_back(new ScopedFile(i->path(), data));
120
121 // clear files list so only fileSettings are used
122 if (useFS)
123 filelist.clear();
124
125 ProcessExecutor executor(filelist, fileSettings, s, supprs, *this, timerResults.get(), executeFn);
126 ASSERT_EQUALS(result, executor.check());
127 }
128#endif // HAS_THREADING_MODEL_FORK
129
130 void run() override {

Callers

nothing calls this directly

Calls 5

emptyMethod · 0.45
sizeMethod · 0.45
resetMethod · 0.45
clearMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected