Skip to content

Commit 3ca8997

Browse files
authored
no-fuzz: added (optional) execution count command-line argument (#6338)
this allows the tool to be used as a "micro" benchmark of sorts for the analysis. Using a single run is also not good for profiling because it includes all the static initializations which is misleading.
1 parent ca94527 commit 3ca8997

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

oss-fuzz/main.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataSize)
6060
#else
6161
int main(int argc, char * argv[])
6262
{
63-
if (argc != 2)
63+
if (argc < 2 || argc > 3)
6464
return EXIT_FAILURE;
6565

6666
std::ifstream f(argv[1]);
@@ -73,8 +73,11 @@ int main(int argc, char * argv[])
7373
if (!f.good())
7474
return EXIT_FAILURE;
7575

76+
const int cnt = (argc == 3) ? std::stoi(argv[2]) : 1;
77+
7678
const std::string code = oss.str();
77-
doCheck(code);
79+
for (int i = 0; i < cnt; ++i)
80+
doCheck(code);
7881

7982
return EXIT_SUCCESS;
8083
}

0 commit comments

Comments
 (0)