-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Trim trailing whitespace in tests #3507
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
Trim trailing whitespace in tests #3507
Conversation
@petk Remember a while ago this comment #3468 (comment)? Give this patch a Do you have any idea how can we fix those tests? Also, there're some tests in |
Of course... I remember. I'm just not that fast with all the file fixing scripts... :D Case is that those files are binary files. For example:
shows This should probably be done in a separate pull request/patch for easier handling. There are quite many binary phpt files - at least 292 from my quick check. |
Don't worry, this patch is still in WIP and I've followed your recently patches, was just a ping.
Agree. let me know how we can fix it, so I can hold this patch to merge after this fix we want to. |
@petk Gonna remove the binary test files from this patch and open it for review. I'll post it here so we can track them in the future we want to solve this task. Sounds good? |
Sounds good... |
Comment on behalf of carusogabriel at php.net: Labelling |
Patch is ready for review. |
@petk Mind to review this one? :) |
It seems that CI passed this one. Is this change somehow repeatable? Using a script or a list of whitelisted/blacklisted files? There is also one remaining binary files changed |
Nops. I trimmed with a lot of regex and add/remove files from git until get a perfect patch.
I don't think is necessary to revert, as it passes in the CI and locally. @cmb69 Mind to check on this one as well? |
Some of our tests have ASCII control characters in the Wrt. each.phpt: such tremendous tests have the unfortunate consequence, that they'll be fixed by whatever is actually output, if they fail. In this case it seems that the test has been written this way in the first place, without even checking whether the tested output makes sense. The NUL bytes are the result of outputting this array, which has actually only 9 elements, even though 12 are written, and this has nothing to do with
I don't have the time to review more than 5000 changed files, but it seems to me we can commit this, if we check the submitted test reports for potential issues, subsequently. |
Especially if reproducing this result is non-trivial, we need an automated way to do this before the change is committed. |
@nikic @petk Here's some of the patterns I used to compose this patch:
Do you think is there a way to automate that, or can we proceed with the merge?
@cmb69 Thanks for the link. I used to check GCOV for that before, but I'll track QA as well. |
Thanks @cmb69 for the explanation. Yes, of course. Once you go through the binary files basics, it's more understandable what's happening. For the binary PHP test files (or any other binary files where diff is important in Git) a simple
That way Git will show diffs for these files as well and still treat them as binary in the index and all as before. |
@carusogabriel I've added some of these fixing rules specific for phpt files to the upcoming Since this pull request is probably very nicely fine tuned I think we should merge it in the master anyway after we get most of the specifics for phpt files figured out. I'll try to get as close to this one in the tidy.php though. So, this is on its way and coming up soon. |
@petk Thanks for that. If there's no objection, I'll be merging this in the weekend |
I think that's good. The tidy.php script is in final fine tuning phase... I think I got at least most of the phpt files figures out a bit. Not everything, but a lot:
|
I only hope that 1000+ lines long tidy.php won't be an issue in php-src 😐 I'm currently doing dedicated tests of the tidy.php itself manually in not so fine tuned way yet... |
@petk You shouldn't worry about the size, its the utility itself that matters ;-) |
I'm still objecting -- we'll want to apply mass CS changes to all active branches, which is not possible in the current form. I would suggest to wait until @petk finishes his work and apply the phpt CS cleanup together with the other CS cleanup. |
@nikic So should I also prepare patches for the other active branches? |
Hello, the |
@petk Should I merge only on |
yes, this should go only in master... |
Applied via 9c144e0. I'll track both GCOV and QA to find possible regressions related to these changes. |
Following #2995 and a reworked version of #3039.
Opened to run against CIs and see the affected tests.