| 569 | testingSpillCounter() = maxInjections; |
| 570 | } |
| 571 | |
| 572 | TestScopedSpillInjection::~TestScopedSpillInjection() { |
| 573 | testingSpillPct() = 0; |
| 574 | testingSpillCounter() = 0; |
| 575 | } |
| 576 | |
| 577 | bool testingTriggerSpill() { |
| 578 | // Do not evaluate further if trigger is not set. |
| 579 | if (testingSpillCounter() <= 0 || testingSpillPct() <= 0) { |
| 580 | return false; |
| 581 | } |
| 582 | if (folly::Random::rand32() % 100 < testingSpillPct()) { |
| 583 | return testingSpillCounter()-- > 0; |
no outgoing calls
no test coverage detected