Page MenuHomePhabricator

Translate coverage publish step fails with: Incorrect whitelist config, no code coverage will be generated.
Open, Needs TriagePublic

Description

The postmerge job that publish coverage for Translate fails as witnessed on https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Translate/+/505212/

INFO:test.commands:mwext-phpunit-coverage
++ basename mediawiki/extensions/Translate
+ EXT_NAME=Translate
+ phpunit-suite-edit /workspace/src/tests/phpunit/suite.xml --cover-extension Translate
+ mkdir -p /workspace/cover
+ find /workspace/cover -mindepth 1 -delete
+ set +e
+ cover_pid=619
+ relay_signals SIGINT SIGTERM
+ for signal in "$@"
+ trap 'kill -$signal $cover_pid; wait $cover_pid' SIGINT
+ for signal in "$@"
+ trap 'kill -$signal $cover_pid; wait $cover_pid' SIGTERM
+ wait 619
+ php7.0 -d zend_extension=xdebug.so /workspace/src/tests/phpunit/phpunit.php --testsuite extensions --coverage-clover /workspace/log/clover.xml --coverage-html /workspace/cover /workspace/src/extensions/Translate/tests/phpunit
Using PHP 7.0.33-0+deb9u3
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Error:         Incorrect whitelist config, no code coverage will be generated.

...............................................................  63 / 356 ( 17%)
....................S......................S................... 126 / 356 ( 35%)
............................................................... 189 / 356 ( 53%)
......................SSS...................................... 252 / 356 ( 70%)
..........................................................S.... 315 / 356 ( 88%)
.........................................                       356 / 356 (100%)

Time: 7.22 seconds, Memory: 129.35MB

OK, but incomplete, skipped, or risky tests!
Tests: 356, Assertions: 751, Skipped: 6.
+ set -e
+ test -f /workspace/cover/index.html

Event Timeline

hashar created this task.Apr 25 2019, 11:04 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 25 2019, 11:04 PM
awight added a subscriber: awight.Jun 10 2019, 1:56 PM

I can confirm the work that's already been done on this ticket. As Thiemo pointed out, the phpunit-suite-edit script is responsible for constructing the coverage whitelist, and for the Translate extension none of these directories exist.

Modifying that script to allow customization non-standard directories isn't worth the effort, since the current structure of the Translate sources is unintentional and will be corrected in the future (T193166). Instead, we should probably follow @Nikerabbit's suggestion in IRC,

14:18 <+Nikerabbit> awight: dirty trick: move everything one level down to includes/ (and keep src/ for future namespaced code)
14:18 <+Nikerabbit> But that should be timed in a slot where there aren't many open patches that would be manually rebased.

This lets us tackle the problem in several phases: moving to includes enables test coverage without breaking backwards-compatibility; and PSR-4 refactoring will benefit from test coverage.

@Nikerabbit Do you want to take over the scheduling part of this task? I'll create a subtask to refactor the code but as you said, such a patch should be merged in coordination with other open work.

Does anyone have a script or anything that would quickly tell which paths have (non-obsolete) patches against them?

Does anyone have a script or anything that would quickly tell which paths have (non-obsolete) patches against them?

Would you mind clarifying your question? As I understand it you are looking for a way to find changes in Gerrit that affects a given file. One such way is to use the file: search predicates in Gerrit. For example:

file:^src.* project:mediawiki/extensions/Translatelink to Gerrit

Which looks for any change to the Translate extension that affects a file/directory starting with src.