Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
run-tests.sh --module is broken at least two ways: one, it tries to run basically everything it can find in a certain directory. This is too little as it doesn't include phpunit tests and it's too much because it runs php files that are not tests.
Proposed resolution
Pass a $module argument around and handle it. Quite easy once we found the bug, really. The patch iswas a net negative in lines of code before we added doxygen for parameters on functions noone ever uses. What a waste.
Comment | File | Size | Author |
---|---|---|---|
#8 | 2132441_8.patch | 7.08 KB | eliza411 |
#3 | interdiff.txt | 2.82 KB | chx |
#3 | 2132441_3.patch | 6.56 KB | chx |
run_tests_module.patch | 4.46 KB | chx | |
Comments
Comment #1
chx CreditAttribution: chx commentedBTW the bug was discovered by mpgeek in an IMP issue trying to run the module tests.
Comment #2
BerdirNeeds a docblock update. Same for multiple functions below, looks like one of them even mentioned non-existing arguments...
Also, this function has a persistent and static cache, you need to consider $module there as well, otherwise it won't work correctly. You'll always only get the module of the first cache clear... Alternatively don't bother caching if $module isn't empty, probably not worth it?
Why isset, wouldn't if ($mnodule) be enough?
Took me a few seconds to understand what this is doing, a quick comment might be useful?
Comment #3
chx CreditAttribution: chx commentedComment #4
BerdirConfirmed that the patch works, php ./core/scripts/run-tests.sh --module node right now results in RuntimeException: Sub-class must implement the getInfo method! in Drupal\simpletest\TestBase::getInfo(), with the patch, it successfully identifies all tests in node.module and starts executing them.
However, I do have some nitpicks, you won't like me for this...
*are* returned, I think?
Also needs an empty line between the @param's and @return.
I know you didn't add this (@msonnabaum very likely did, so kick him, not me :)), but it's missing @return (copy from another one) and the initial line is wrong in multiple lines, should be "Gets PHPUnit classes." IMHO, but I'm OK with that not being fixed here.
Unfortunately another function without updated docblock.
Comment #5
chx CreditAttribution: chx commentedNo, I won't.
Comment #6
BerdirNo reason to won't fix, let's just tag it for a novice re-roll...
Comment #7
chx CreditAttribution: chx commentedComment #8
eliza411 CreditAttribution: eliza411 commentedI'm not sure I've re-rolled this correctly. I was confused by list item 3 in comment #4.
Let me know what more needs to be done
Comment #9
amateescu CreditAttribution: amateescu commentedIt was about
simpletest_script_get_all_tests()
missing the doc for the new $module param, and it looks great now.Comment #11
amateescu CreditAttribution: amateescu commented8: 2132441_8.patch queued for re-testing.
Comment #13
amateescu CreditAttribution: amateescu commented8: 2132441_8.patch queued for re-testing.
Comment #14
BerdirAgreed, looks great now, thanks! (The only thing is the still missing "." at the end of one of those function descriptions, but that was already missing before and could easily be added before commit.
Comment #15
webchickOnly issue is we don't have test coverage for this regression, so we may re-introduce it once again. But in talking to Tim, he seemed to think it was basically impossible to pull this off in run-tests.sh. So...
Committed and pushed to 8.x, including the missing "." ;)