Updated: Comment #N
Problem/Motivation
Including and executing ::getInfo on each test class consumes memory that cannot be returned to the pool.
We should investigate alternatives to the ::getInfo method that would allow this memory to be freed.
The most logical would be our existing Annotations as that would keep the metadata with the class.
An alternative approach would be yaml, but that would leave the metadata orphaned in an alternate file.
Proposed resolution
Move the ::getInfo method to an annotation
Remaining tasks
Patch
User interface changes
None
API changes
::getInfo replaced with annotations
Related Issues
#1567500: [meta] Pave the way to replace the testing framework with PHPUnit and possibly rewrite Simpletest
Coming from backdrop investigations into memory-usage https://github.com/backdrop/backdrop-issues/issues/78#issuecomment-24485072
Comments
Comment #1
quicksketchIf you haven't tried it recently, give loading the SimpleTest page in the UI a try. Last I attempted this, it exhausted my 150MB memory limit in PHP. I had to increase it to 200MB to get the page to load. By switching to an approach that doesn't require parsing the PHP classes in memory, you can get an enormous memory savings.
That said, I'd recommend YAML over Annotations. It's the same thing we do for modules themselves, right? If you want a list of modules, read the YAML files. If you want a list of tests, read the YAML files. I didn't benchmark annotations, but from a speed perspective, I would expect a single module.tests.yml file to be a lot faster than needing to discover and then parse all the individual test classes. Though I'd say the same for plugins too...
Comment #2
larowlanNote this is a stopgap measure as ideally we won't have a Simpletest UI in D9 for all the reasons detailed in #1567500: [meta] Pave the way to replace the testing framework with PHPUnit and possibly rewrite Simpletest
Comment #3
quicksketchEven if there's no UI, if there's a mechanism for listing tests the static getInfo() approach is still going to consume a lot of memory parsing all the available tests.
Over in Backdrop-land, I filed a PR that moves all the test information to .info files. The results were great:
Memory usage getInfo() approach: 45.5 MB
Memory usage .info file approach: 700 KB
Drupal savings would probably be greater because it has more tests.
Full test details are at https://github.com/backdrop/backdrop-issues/issues/81#issuecomment-26208301
Comment #3.0
quicksketchUpdated issue summary.
Comment #4
rodrigoaguileragetInfo() doesn't exist anymore.
#697760: Replace getInfo() in tests with native phpDoc + annotations (following PHPUnit)
https://api.drupal.org/api/drupal/core!modules!simpletest!src!TestBase.p...