Page MenuHomePhabricator

BenchmarkerTest division by zero
Closed, ResolvedPublic


Using PHP 7 to run tests, I find that occasionally a BenchmarkerTest fails with a "Division by 0" message. Usually just in just one test, but I've seen it happen in two as shown below.

Using PHP 7.0.27-1
PHPUnit 4.8.36 by Sebastian Bergmann and contributors.


Time: 126 ms, Memory: 18.00MB

There were 2 errors:

1) MediaWiki\Tests\Maintenance\BenchmarkerTest::testBenchVerbose
Division by zero


2) MediaWiki\Tests\Maintenance\BenchmarkerTest::testVerboseRun
Division by zero


Tests: 7, Assertions: 5, Errors: 2.

I wasn't able to get PHP5 or HHVM to do it in some quick attempts. Perhaps they're enough slower that they never wind up with a zero timing, or perhaps they have more accurate timers.

Event Timeline

Anomie created this task.Feb 1 2018, 9:25 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 1 2018, 9:25 PM

Change 407520 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] Benchmarker: Don't try to divide by zero

Krinkle closed this task as Resolved.Feb 2 2018, 2:25 AM
Krinkle assigned this task to Anomie.
Krinkle moved this task from Inbox to PHPUnit on the MediaWiki-Core-Testing board.
Krinkle edited projects, added Performance-Team (Radar); removed Patch-For-Review.

Change 407520 merged by jenkins-bot:
[mediawiki/core@master] benchmarks: Fix divide by zero in Benchmarker

Aklapper removed a subscriber: Anomie.Oct 16 2020, 5:39 PM