Skip to content

Commit

Permalink
Add an overload of GenerateSeedCorpusFromConfig accepting the proto d…
Browse files Browse the repository at this point in the history
…irectly.

PiperOrigin-RevId: 647482022
  • Loading branch information
Markus Kusano authored and copybara-github committed Jul 9, 2024
1 parent 3880eda commit 3cb8264
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions centipede/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ proto_library(

cc_proto_library(
name = "seed_corpus_config_cc_proto",
visibility = EXTENDED_API_VISIBILITY,
deps = [":seed_corpus_config_proto"],
)

Expand Down Expand Up @@ -1075,6 +1076,7 @@ cc_library(
name = "seed_corpus_maker_lib",
srcs = ["seed_corpus_maker_lib.cc"],
hdrs = ["seed_corpus_maker_lib.h"],
visibility = EXTENDED_API_VISIBILITY,
deps = [
":corpus_io",
":feature",
Expand Down
8 changes: 8 additions & 0 deletions centipede/seed_corpus_maker_lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,15 @@ void GenerateSeedCorpusFromConfig( //
LOG(WARNING) << "Config is empty: skipping seed corpus generation";
return;
}
GenerateSeedCorpusFromConfig( //
config, coverage_binary_name, coverage_binary_hash, override_out_dir);
}

void GenerateSeedCorpusFromConfig( //
const SeedCorpusConfig& config, //
std::string_view coverage_binary_name, //
std::string_view coverage_binary_hash, //
std::string_view override_out_dir) {
// Pre-create the destination dir early to catch possible misspellings etc.
if (!RemotePathExists(config.destination().dir_path())) {
RemoteMkdir(config.destination().dir_path());
Expand Down
7 changes: 7 additions & 0 deletions centipede/seed_corpus_maker_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ void GenerateSeedCorpusFromConfig( //
std::string_view coverage_binary_hash, //
std::string_view override_out_dir = "");

// Same as above but accepts a `SeedCorpusConfig` directly.
void GenerateSeedCorpusFromConfig( //
const SeedCorpusConfig& config, //
std::string_view coverage_binary_name, //
std::string_view coverage_binary_hash, //
std::string_view override_out_dir = "");

} // namespace centipede

#endif // THIRD_PARTY_CENTIPEDE_SEED_CORPUS_MAKER_LIB_H_

0 comments on commit 3cb8264

Please sign in to comment.