[fuzzer] add option -save_minimized_corpus

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227395 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kostya Serebryany
2015-01-28 23:48:39 +00:00
parent 41e59785c1
commit 1f3043175c
5 changed files with 27 additions and 4 deletions

View File

@@ -13,7 +13,7 @@
#include <dirent.h>
namespace fuzzer {
std::vector<std::string> ListFilesInDir(const std::string &Dir) {
static std::vector<std::string> ListFilesInDir(const std::string &Dir) {
std::vector<std::string> V;
DIR *D = opendir(Dir.c_str());
if (!D) return V;
@@ -38,7 +38,12 @@ void WriteToFile(const Unit &U, const std::string &Path) {
void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V) {
for (auto &X : ListFilesInDir(Path))
V->push_back(FileToVector(std::string(Path) + "/" + X));
V->push_back(FileToVector(DirPlusFile(Path, X)));
}
std::string DirPlusFile(const std::string &DirPath,
const std::string &FileName) {
return DirPath + "/" + FileName;
}
} // namespace fuzzer