| 18 | : SourceReport(SourceReport) {} |
| 19 | |
| 20 | bool 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 | } |
nothing calls this directly
no test coverage detected