MCPcopy Create free account
hub / github.com/Samsung/UTopia / generate

Method generate

lib/generation/FuzzerSrcGenerator.cpp:20–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18 : SourceReport(SourceReport) {}
19
20bool FuzzerSrcGenerator::generate(Fuzzer &F, const std::string &SrcDir,
21 const std::string &OutDir) {
22 if (F.getStatus() != FUZZABLE)
23 return false;
24
25 auto FuzzerSrcPath = fs::path(OutDir) / F.getName();
26 util::copy(SrcDir, FuzzerSrcPath, true);
27
28 auto ProjectDir = SourceReport.getSrcBaseDir();
29 auto UTSrcDirRelPath = util::getParentPath(
30 util::getRelativePath(F.getUT().getFilePath(), ProjectDir));
31 auto Signature = SrcGenerator::genSignature(F.getUT().getName());
32
33 // Creation should be fixed if other mutator added
34 std::unique_ptr<InputMutator> Mutator = std::make_unique<ProtobufMutator>();
35 Mutator->initFromFuzzer(F, SourceReport);
36 Mutator->genEntry(FuzzerSrcPath / UTSrcDirRelPath,
37 InputMutator::DefaultEntryName, Signature);
38
39 UTModify Modify(F, SourceReport);
40 Modify.genModifiedSrcs(ProjectDir, FuzzerSrcPath, Signature);
41
42 // update FTG build paths
43 F.setRelativeUTDir(UTSrcDirRelPath);
44
45 F.setStatus(FUZZABLE_SRC_GENERATED);
46 return true;
47}

Callers

nothing calls this directly

Calls 12

copyFunction · 0.85
getParentPathFunction · 0.85
getRelativePathFunction · 0.85
getStatusMethod · 0.80
getSrcBaseDirMethod · 0.80
initFromFuzzerMethod · 0.80
genEntryMethod · 0.80
genModifiedSrcsMethod · 0.80
setRelativeUTDirMethod · 0.80
setStatusMethod · 0.80
getNameMethod · 0.45
getFilePathMethod · 0.45

Tested by

no test coverage detected