Speed up code coverage generation for local development
authorKosta Harlan <kharlan@wikimedia.org>
Wed, 3 Jul 2019 14:48:55 +0000 (10:48 -0400)
committerKosta Harlan <kharlan@wikimedia.org>
Tue, 9 Jul 2019 15:14:23 +0000 (11:14 -0400)
Changing addUncoveredFilesFromWhitelist to false drastically speeds up code
coverage report generation. Including extensions/skins in the config also
removes the need to manually edit your phpunit.xml file when you want to inspect
code coverage for your extension or skin locally.

With this patch you can very quickly generate coverage for an extension/skin or
subsection of core, this is especially useful if you are using an IDE that
supports running a test and importing its coverage into the editor.

The downside to this patch is that the coverage report only contains
information about code that's exercised by the tests, so this patch on its own
is unsuitable for our current processes in integration/config which generate a
full code coverage report per patch for extensions or post-merge for core.

However, since we are not yet using phpunit.xml.dist in CI, this patch should be
OK to merge as is. A follow-up patch to integration/config will use sed or
phpunit-suite-edit.py to set processUncoveredFilesFromWhitelist to true.

Bug: T192078
Change-Id: I3d19627fa36f6cc6666c29fdb638272fdaa30630

phpunit.xml.dist

index 159adbc..11425a9 100644 (file)
                </exclude>
        </groups>
        <filter>
-               <whitelist addUncoveredFilesFromWhitelist="true">
+               <whitelist addUncoveredFilesFromWhitelist="false">
                        <directory suffix=".php">includes</directory>
                        <directory suffix=".php">languages</directory>
                        <directory suffix=".php">maintenance</directory>
+                       <directory suffix=".php">extensions</directory>
+                       <directory suffix=".php">skins</directory>
                        <exclude>
                                <directory suffix=".php">languages/messages</directory>
                                <file>languages/data/normalize-ar.php</file>