-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regex filtering #23
Regex filtering #23
Conversation
…acceptable alternative to outrageously slow directory filters (which can take several minutes to filter something like Zend Framework from the coverage information.) TODO: Rewrite the directory filters to use the regular expressions, rather than walking the file tree
I have been struggling with speed of addDirectoryToFilter / addFileToFilter too when running ordinary non code coverage tests. For now I have a workaround by doing this in test bootstrap.php: But when I tried to profile the ordinary test, I figured out the PHPUnit does blacklist itself no matter if the code coverage is set on or off, which costs me additional ~1sec of tests execution. Your solution would solve both cases by simply making the blacklisting cheap enough to be used all the time. |
lol, if the delay had only been 2 seconds that would have been fine. I was excluding the entire Zend Framework, which is more like a 30 second delay. The patch is also useful for excluding things like '.test.' which otherwise cannot be excluded. |
Closing, as the code this pull request is for is not part of PHPUnit anymore. |
Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
…support support for wildcards (glob) in exclude
The current mechanisms for filtering large numbers of files from coverage data are horribly inadequate, especially for projects that use large monolithic libraries like Zend Framework.
I've made a few changes to PHPUnit_Util_Filter to allow regex based filters. (Blacklist only, since whitelists would be difficult to properly support, and wouldn't be made any faster by this, although a regular expression parameter on the whitelist might make sense.)
I didn't rewrite addDirectoryToFilter, so it's still slow, but this gives a workaround for now, and it shouldn't be too hard to rewrite addDirectoryToFilter later. (realpath, explode, preg_quote all segments with $delimiter='
', implode with $glue='(\|/)'), and wrap with ''.)This patch also allows for other useful exclusions, such as:
PHPUnit_Util_Filter::addRegexToFilter('
test(s?)', 'TESTS');