#Centipede Add support for directly passing a corpus shard in a SeedCorpusSource PiperOrigin-RevId: 647474909
diff --git a/centipede/BUILD b/centipede/BUILD index e851c68..8092c65 100644 --- a/centipede/BUILD +++ b/centipede/BUILD
@@ -101,6 +101,7 @@ cc_proto_library( name = "seed_corpus_config_cc_proto", + visibility = EXTENDED_API_VISIBILITY, deps = [":seed_corpus_config_proto"], ) @@ -1057,6 +1058,7 @@ 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",
diff --git a/centipede/seed_corpus_config.proto b/centipede/seed_corpus_config.proto index 8abc201..f71799d 100644 --- a/centipede/seed_corpus_config.proto +++ b/centipede/seed_corpus_config.proto
@@ -34,6 +34,9 @@ // A relative glob used to find corpus shards in each `dir_glob`-matching dir. // Required. string shard_rel_glob = 3; + // Path directly to a corpus shard. Will be added to the shards specified by + // `dir_glob`. + string corpus_shard_path = 6; // An absolute or relative number of corpus elements to sample from all the // corpus shards in all `dir_glob` matching dirs of this source. Optional: the // default is to take all the elements.
diff --git a/centipede/seed_corpus_maker_lib.cc b/centipede/seed_corpus_maker_lib.cc index b43d7e9..2239a2b 100644 --- a/centipede/seed_corpus_maker_lib.cc +++ b/centipede/seed_corpus_maker_lib.cc
@@ -182,6 +182,12 @@ } LOG(INFO) << "Found " << corpus_shard_fnames.size() << " shard(s) total in source " << source.dir_glob(); + if (!source.corpus_shard_path().empty()) { + LOG(INFO) << "Adding corpus shard path: " << source.corpus_shard_path(); + corpus_shard_fnames.push_back(source.corpus_shard_path()); + } + LOG(INFO) << "Total number of corpus shards found: " + << corpus_shard_fnames.size(); if (corpus_shard_fnames.empty()) { LOG(WARNING) << "Skipping empty source " << source.dir_glob();