[TASK] Reduce memory footprint of unit tests 28/27528/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Mon, 10 Feb 2014 17:15:24 +0000 (18:15 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 10 Feb 2014 19:36:54 +0000 (20:36 +0100)
commit2d05837d4a9865aff3dc67fc5d78ec008eb8f063
tree164ed5d4c6169d67a2aebbc358b2627165a21252
parent41a4f981e4d094e24ef4eabfd5beea9579480d84
[TASK] Reduce memory footprint of unit tests

Running the whole unit test suite on cli can eat up a significant
amount of memory. Most of that can not be mitigated due to phpunit
itself, but we can at least hint the PHP garbage collection by
unsetting test class properties in tearDown().

The patch introduces a generic tearDown() method that reflects the
test class and unsets all temporary properties of the class. In
effect, tests do not need to take care of unsetting properties.

The patch removes all tearDown() methods that only unset() stuff
and keeps others that do additional things but adds a call to
parent::tearDown(). Private properties are changed to protected,
so parent::tearDown can reach them. The additional computing
effort of the reflection is insignificant, the suite is nearly as
fast as before.

Results:
php 5.3: 1056MB -> 851MB
php 5.4: 870MB -> 670MB
php 5.5.: 876MB -> 674MB

Resolves: #55850
Related: #51436
Releases: 6.2
Change-Id: Ie665c53a3ab35e4808677e483d2099e0511c393f
Reviewed-on: https://review.typo3.org/27528
Reviewed-by: Helmut Hummel
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
172 files changed:
typo3/sysext/backend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php
typo3/sysext/backend/Tests/Unit/Form/Element/InlineElementTest.php
typo3/sysext/backend/Tests/Unit/Form/ElementConditionMatcherTest.php
typo3/sysext/backend/Tests/Unit/Module/ModuleControllerTest.php
typo3/sysext/backend/Tests/Unit/Tree/Pagetree/DataProviderTest.php
typo3/sysext/backend/Tests/Unit/Tree/TreeNodeCollectionTest.php
typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php
typo3/sysext/backend/Tests/Unit/Utility/IconUtilityTest.php
typo3/sysext/backend/Tests/Unit/View/BackendLayout/DataProviderCollectionTest.php
typo3/sysext/backend/Tests/Unit/View/BackendLayoutViewTest.php
typo3/sysext/belog/Tests/Unit/Domain/Model/ConstraintTest.php
typo3/sysext/belog/Tests/Unit/Domain/Model/LogEntryTest.php
typo3/sysext/belog/Tests/Unit/Domain/Repository/HistoryEntryRepositoryTest.php
typo3/sysext/belog/Tests/Unit/Domain/Repository/LogEntryRepositoryTest.php
typo3/sysext/belog/Tests/Unit/Domain/Repository/WorkspaceRepositoryTest.php
typo3/sysext/beuser/Tests/Unit/Domain/Model/BackendUserTest.php
typo3/sysext/beuser/Tests/Unit/Domain/Model/DemandTest.php
typo3/sysext/beuser/Tests/Unit/Domain/Repository/BackendUserRepositoryTest.php
typo3/sysext/beuser/Tests/Unit/Domain/Repository/BackendUserSessionRepositoryTest.php
typo3/sysext/beuser/Tests/Unit/Service/ModuleDataStorageServiceTest.php
typo3/sysext/core/Tests/Unit/Authentication/AbstractUserAuthenticationTest.php
typo3/sysext/core/Tests/Unit/Authentication/BackendUserAuthenticationTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/RedisBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/Typo3DatabaseBackendTest.php
typo3/sysext/core/Tests/Unit/Category/CategoryRegistryTest.php
typo3/sysext/core/Tests/Unit/Charset/CharsetConverterTest.php
typo3/sysext/core/Tests/Unit/Collection/RecordCollectionRepositoryTest.php
typo3/sysext/core/Tests/Unit/Configuration/ConfigurationManagerTest.php
typo3/sysext/core/Tests/Unit/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcherTest.php
typo3/sysext/core/Tests/Unit/Core/ClassLoaderTest.php
typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php
typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php
typo3/sysext/core/Tests/Unit/Database/DatabaseConnectionTest.php
typo3/sysext/core/Tests/Unit/Database/PreparedStatementTest.php
typo3/sysext/core/Tests/Unit/Database/SqlParserTest.php
typo3/sysext/core/Tests/Unit/Encoder/JavaScriptEncoderTest.php
typo3/sysext/core/Tests/Unit/Error/DebugExceptionHandlerTest.php
typo3/sysext/core/Tests/Unit/Error/ProductionExceptionHandlerTest.php
typo3/sysext/core/Tests/Unit/FormProtection/AbstractFormProtectionTest.php
typo3/sysext/core/Tests/Unit/FormProtection/BackendFormProtectionTest.php
typo3/sysext/core/Tests/Unit/FormProtection/FormProtectionFactoryTest.php
typo3/sysext/core/Tests/Unit/FormProtection/InstallToolFormProtectionTest.php
typo3/sysext/core/Tests/Unit/Html/HtmlParserTest.php
typo3/sysext/core/Tests/Unit/Html/RteHtmlParserTest.php
typo3/sysext/core/Tests/Unit/Imaging/GraphicalFunctionsTest.php
typo3/sysext/core/Tests/Unit/Localization/Parser/LocallangXmlParserTest.php
typo3/sysext/core/Tests/Unit/Localization/Parser/XliffParserTest.php
typo3/sysext/core/Tests/Unit/Log/LogManagerTest.php
typo3/sysext/core/Tests/Unit/Log/Writer/DatabaseTest.php
typo3/sysext/core/Tests/Unit/Mail/MailerTest.php
typo3/sysext/core/Tests/Unit/Mail/SwiftMailerAdapterTest.php
typo3/sysext/core/Tests/Unit/Resource/Driver/DriverRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/Driver/LocalDriverTest.php
typo3/sysext/core/Tests/Unit/Resource/FileReferenceTest.php
typo3/sysext/core/Tests/Unit/Resource/FileTest.php
typo3/sysext/core/Tests/Unit/Resource/FolderTest.php
typo3/sysext/core/Tests/Unit/Resource/Repository/AbstractRepositoryTest.php
typo3/sysext/core/Tests/Unit/Resource/ResourceFactoryTest.php
typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php
typo3/sysext/core/Tests/Unit/Resource/Service/FrontendContentAdapterServiceTest.php
typo3/sysext/core/Tests/Unit/Resource/Utility/FileExtensionFilterTest.php
typo3/sysext/core/Tests/Unit/TypoScript/Parser/TypoScriptParserTest.php
typo3/sysext/core/Tests/Unit/TypoScript/TemplateServiceTest.php
typo3/sysext/core/Tests/Unit/Utility/ClientUtilityTest.php
typo3/sysext/core/Tests/Unit/Utility/ExtensionManagementUtilityTest.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
typo3/sysext/core/Tests/Unit/Utility/MailUtilityTest.php
typo3/sysext/core/Tests/UnitTestCase.php
typo3/sysext/dbal/Tests/Unit/Database/DatabaseConnectionMssqlTest.php
typo3/sysext/dbal/Tests/Unit/Database/DatabaseConnectionOracleTest.php
typo3/sysext/dbal/Tests/Unit/Database/DatabaseConnectionPostgresqlTest.php
typo3/sysext/dbal/Tests/Unit/Database/DatabaseConnectionTest.php
typo3/sysext/dbal/Tests/Unit/Database/SqlParserTest.php
typo3/sysext/documentation/Tests/Unit/Domain/Model/DocumentFormatTest.php
typo3/sysext/documentation/Tests/Unit/Domain/Model/DocumentTest.php
typo3/sysext/documentation/Tests/Unit/Domain/Model/DocumentTranslationTest.php
typo3/sysext/extbase/Tests/Unit/Core/BootstrapTest.php
typo3/sysext/extbase/Tests/Unit/Domain/Model/BackendUserGroupTest.php
typo3/sysext/extbase/Tests/Unit/Domain/Model/BackendUserTest.php
typo3/sysext/extbase/Tests/Unit/Domain/Model/CategoryTest.php
typo3/sysext/extbase/Tests/Unit/Domain/Model/FileMountTest.php
typo3/sysext/extbase/Tests/Unit/Domain/Model/FrontendUserGroupTest.php
typo3/sysext/extbase/Tests/Unit/Domain/Model/FrontendUserTest.php
typo3/sysext/extbase/Tests/Unit/Domain/Repository/CategoryRepositoryTest.php
typo3/sysext/extbase/Tests/Unit/Domain/Repository/FileMountRepositoryTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Cli/CommandManagerTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/Web/Routing/UriBuilderTest.php
typo3/sysext/extbase/Tests/Unit/Object/Container/ClassInfoFactoryTest.php
typo3/sysext/extbase/Tests/Unit/Object/Container/ContainerTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/QueryFactoryTest.php
typo3/sysext/extbase/Tests/Unit/Property/MapperTest.php
typo3/sysext/extbase/Tests/Unit/Utility/LocalizationUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Task/UpdateExtensionListTaskTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/FileHandlingUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/InstallUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/ListUtilityTest.php
typo3/sysext/felogin/Tests/Unit/Controller/FrontendLoginControllerTest.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/ParsingStateTest.php
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/TemplateVariableContainerTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/WidgetRequestBuilderTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/WidgetRequestHandlerTest.php
typo3/sysext/fluid/Tests/Unit/View/StandaloneViewTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Be/IfAuthenticatedViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Be/IfHasRoleViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/SelectViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Format/DateViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Security/IfAuthenticatedViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Widget/Controller/PaginateControllerTest.php
typo3/sysext/form/Tests/Unit/Domain/Factory/TypoScriptFactoryTest.php
typo3/sysext/form/Tests/Unit/Filter/AlphabeticFilterTest.php
typo3/sysext/form/Tests/Unit/Filter/AlphanumericFilterTest.php
typo3/sysext/form/Tests/Unit/Filter/CurrencyFilterTest.php
typo3/sysext/form/Tests/Unit/Filter/DigitFilterTest.php
typo3/sysext/form/Tests/Unit/Filter/IntegerFilterTest.php
typo3/sysext/form/Tests/Unit/Filter/LowerCaseFilterTest.php
typo3/sysext/form/Tests/Unit/Filter/RegExpFilterTest.php
typo3/sysext/form/Tests/Unit/Filter/RemoveXssFilterTest.php
typo3/sysext/form/Tests/Unit/Filter/StripNewLinesFilterTest.php
typo3/sysext/form/Tests/Unit/Filter/TitleCaseFilterTest.php
typo3/sysext/form/Tests/Unit/Filter/TrimFilterTest.php
typo3/sysext/form/Tests/Unit/Filter/UpperCaseFilterTest.php
typo3/sysext/form/Tests/Unit/PostProcess/MailPostProcessorTest.php
typo3/sysext/form/Tests/Unit/Validation/AlphabeticValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/AlphanumericValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/BetweenValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/DateValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/DigitValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/EmailValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/EqualsValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/FileAllowedTypesValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/FileMaximumSizeValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/FileMinimumSizeValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/FloatValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/GreaterThanValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/InArrayValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/IntegerValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/IpValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/LengthValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/LessThanValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/RegExpValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/RequiredValidatorTest.php
typo3/sysext/form/Tests/Unit/Validation/UriValidatorTest.php
typo3/sysext/frontend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php
typo3/sysext/frontend/Tests/Unit/ContentObject/FilesContentObjectTest.php
typo3/sysext/frontend/Tests/Unit/ContentObject/FluidTemplateContentObjectTest.php
typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php
typo3/sysext/frontend/Tests/Unit/MediaWizard/MediaWizardProviderTest.php
typo3/sysext/frontend/Tests/Unit/Page/CacheHashCalculatorTest.php
typo3/sysext/frontend/Tests/Unit/Page/PageRepositoryTest.php
typo3/sysext/frontend/Tests/Unit/Plugin/AbstractPluginTest.php
typo3/sysext/indexed_search/Tests/Unit/IndexerTest.php
typo3/sysext/install/Tests/Unit/Controller/Action/Ajax/ExtensionCompatibilityTesterTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/AbstractNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/DirectoryNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/FileNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/LinkNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/RootNodeTest.php
typo3/sysext/install/Tests/Unit/Service/SqlSchemaMigrationServiceTest.php
typo3/sysext/lang/Tests/Unit/Domain/Model/ExtensionTest.php
typo3/sysext/lang/Tests/Unit/Domain/Model/LanguageSelectionFormTest.php
typo3/sysext/lang/Tests/Unit/Domain/Model/LanguageTest.php
typo3/sysext/lang/Tests/Unit/Domain/Model/UpdateTranslationFormTest.php
typo3/sysext/lowlevel/Tests/Unit/Utility/ArrayBrowserTest.php
typo3/sysext/rsaauth/Tests/Unit/Backend/CommandLineBackendTest.php
typo3/sysext/rsaauth/Tests/Unit/Backend/PhpBackendTest.php
typo3/sysext/rsaauth/Tests/Unit/KeypairTest.php
typo3/sysext/saltedpasswords/Tests/Unit/Salt/BlowfishSaltTest.php
typo3/sysext/saltedpasswords/Tests/Unit/Salt/Md5SaltTest.php
typo3/sysext/saltedpasswords/Tests/Unit/Salt/PhpassSaltTest.php
typo3/sysext/saltedpasswords/Tests/Unit/Salt/SaltFactoryTest.php
typo3/sysext/scheduler/Tests/Unit/Controller/SchedulerModuleControllerTest.php
typo3/sysext/scheduler/Tests/Unit/CronCommand/CronCommandTest.php