Skip to content

Commit

Permalink
Log number of failed runs in ExpressionFuzzer (facebookincubator#7809)
Browse files Browse the repository at this point in the history
Summary:
Log total and failed iterations at the end of the run. This allows use to see
cases where random inputs generated by the Fuzzer are not able to test a
function because these are rejected early on.

```
velox_expression_fuzzer_test --logtostderr --only from_base64

Total iterations: 10
Total failed: 8
```

Pull Request resolved: facebookincubator#7809

Reviewed By: xiaoxmeng

Differential Revision: D51716747

Pulled By: mbasmanova

fbshipit-source-id: 5c661a02d515e65594cec329a27e657f438ee802
  • Loading branch information
mbasmanova authored and facebook-github-bot committed Nov 30, 2023
1 parent 0494224 commit 50be0f9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions velox/expression/tests/ExpressionFuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,7 @@ void ExpressionFuzzer::go() {

auto startTime = std::chrono::system_clock::now();
size_t i = 0;
size_t numFailed = 0;

while (!isDone(i, startTime)) {
LOG(INFO) << "==============================> Started iteration " << i
Expand Down Expand Up @@ -1346,6 +1347,10 @@ void ExpressionFuzzer::go() {
throw;
}

if (result.exceptionPtr) {
++numFailed;
}

// If both paths threw compatible exceptions, we add a try() function to
// the expression's root and execute it again. This time the expression
// cannot throw.
Expand All @@ -1360,6 +1365,9 @@ void ExpressionFuzzer::go() {
++i;
}
logStats();

LOG(ERROR) << "Total iterations: " << i;
LOG(ERROR) << "Total failed: " << numFailed;
}

void expressionFuzzer(FunctionSignatureMap signatureMap, size_t seed) {
Expand Down

0 comments on commit 50be0f9

Please sign in to comment.