@@ -153,8 +153,10 @@ KleeGenerator::getCompileCommandForKlee(const fs::path &hintPath,
153
153
}
154
154
command.setSourcePath (srcFilePath);
155
155
156
- auto outFilePath = (forStub ? testGen->getProjectBuildDatabase ()->getBitcodeFile (compilationUnitInfo->getOutputFile ())
157
- : testGen->getTargetBuildDatabase ()->getBitcodeFile (compilationUnitInfo->getOutputFile ()));
156
+ auto outFilePath = (forStub ? testGen->getProjectBuildDatabase ()->getBitcodeFile (
157
+ compilationUnitInfo->getOutputFile ())
158
+ : testGen->getTargetBuildDatabase ()->getBitcodeFile (
159
+ compilationUnitInfo->getOutputFile ()));
158
160
fs::create_directories (outFilePath.parent_path ());
159
161
command.setOutput (outFilePath);
160
162
command.setOptimizationLevel (" -O0" );
@@ -227,7 +229,7 @@ Result<fs::path> KleeGenerator::defaultBuild(const fs::path &hintPath,
227
229
228
230
auto makefileCommand = MakefileUtils::MakefileCommand (testGen->projectContext , makefile,
229
231
printer::DefaultMakefilePrinter::TARGET_BUILD);
230
- auto [out, status, _] = makefileCommand.run ();
232
+ auto [out, status, _] = makefileCommand.run ();
231
233
if (status != 0 ) {
232
234
LOG_S (ERROR) << " Compilation for " << sourceFilePath << " failed.\n "
233
235
<< " Command: \" " << commandWithChangingDirectory.toString () << " \"\n "
@@ -264,7 +266,8 @@ std::vector<fs::path> KleeGenerator::buildKleeFiles(const tests::TestsMap &tests
264
266
const std::shared_ptr<LineInfo> &lineInfo) {
265
267
std::vector<fs::path> outFiles;
266
268
LOG_S (DEBUG) << " Building generated klee files..." ;
267
- printer::KleePrinter kleePrinter (&typesHandler, testGen->getTargetBuildDatabase (), utbot::Language::UNKNOWN, testGen);
269
+ printer::KleePrinter kleePrinter (&typesHandler, testGen->getTargetBuildDatabase (), utbot::Language::UNKNOWN,
270
+ testGen);
268
271
ExecUtils::doWorkWithProgress (
269
272
testsMap, testGen->progressWriter , " Building generated klee files" ,
270
273
[&](auto const &it) {
@@ -344,14 +347,14 @@ std::vector<fs::path> KleeGenerator::buildKleeFiles(const tests::TestsMap &tests
344
347
}
345
348
346
349
void KleeGenerator::parseKTestsToFinalCode (
347
- const utbot::ProjectContext &projectContext,
348
- tests::Tests &tests,
349
- const std::unordered_map<std::string, types::Type> &methodNameToReturnTypeMap,
350
- const std::vector<MethodKtests> &kleeOutput,
351
- const std::shared_ptr<LineInfo> &lineInfo,
352
- bool verbose,
353
- ErrorMode errorMode) {
354
- for (const auto &batch : kleeOutput) {
350
+ const utbot::ProjectContext &projectContext,
351
+ tests::Tests &tests,
352
+ const std::unordered_map<std::string, types::Type> &methodNameToReturnTypeMap,
353
+ const std::vector<MethodKtests> &kleeOutput,
354
+ const std::shared_ptr<LineInfo> &lineInfo,
355
+ bool verbose,
356
+ ErrorMode errorMode) {
357
+ for (const auto &batch: kleeOutput) {
355
358
bool filterByFlag = (lineInfo != nullptr && !lineInfo->forMethod && !lineInfo->forClass &&
356
359
!lineInfo->predicateInfo .has_value ());
357
360
tests::KTestObjectParser KTestObjectParser (typesHandler);
@@ -375,12 +378,12 @@ void KleeGenerator::parseKTestsToFinalCode(
375
378
continue ;
376
379
}
377
380
auto predicate =
378
- lineInfo ? lineInfo->predicateInfo : std::optional<LineInfo::PredicateInfo>{};
381
+ lineInfo ? lineInfo->predicateInfo : std::optional<LineInfo::PredicateInfo>{};
379
382
testsPrinter.genCode (methodDescription, predicate, verbose, errorMode);
380
383
}
381
384
382
385
printer::HeaderPrinter (Paths::getSourceLanguage (tests.sourceFilePath ))
383
- .print (tests.testHeaderFilePath , tests.sourceFilePath , tests.headerCode );
386
+ .print (tests.testHeaderFilePath , tests.sourceFilePath , tests.headerCode );
384
387
testsPrinter.joinToFinalCode (tests, tests.testHeaderFilePath );
385
388
LOG_S (DEBUG) << " Generated code for " << tests.methods .size () << " tests" ;
386
389
}
0 commit comments