Skip to content

Helper for determining system memory usage on Windows #237

Closed
@witrin

Description

@witrin

Hi,

unfortunately the output of tasklist on Windows is language specific. Thus the unit tests always ends with an exception on systems with another language than English (e.g. Speichernutzung in German). Here is the bug. I think possible solutions are:

  • Using an index position for the memory column, don't know if this is stable over different versions of Windows,
  • detecting the language before and provide for each language the appropriate entry,
  • using regular expressions matching for the value,
  • or making the column name configurable.

Here is the exception:

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Number format '' is not recognized.' in [...]\dev\tests\integration\framework\Magento\Test\Helper\Memory.php on line 146

Call Stack:
    0.0003     126624   1. {main}() [...]\phpunit:0
    0.0074     368408   2. PHPUnit_TextUI_Command::main() [...]\phpunit:46
    0.0074     371616   3. PHPUnit_TextUI_Command->run() [...]\PHPUnit\TextUI\Command.php:129

InvalidArgumentException: Number format '' is not recognized. in [...]\dev\tests\integration\framework\Magento\Test\Helper\Memory.php on line 146

Call Stack:
    0.0003     126624   1. {main}() [...]\phpunit:0
    0.0074     368408   2. PHPUnit_TextUI_Command::main() [...]\phpunit:46
    0.0074     371616   3. PHPUnit_TextUI_Command->run() [...]\PHPUnit\TextUI\Command.php:129
   91.1336   22048832   4. Magento_Test_Bootstrap_Memory->displayStats() [...]\dev\tests\integration\framework\Magento\Test\Bootstrap\Memory.php:0
   91.1336   22048952   5. Magento_Test_MemoryLimit->printStats() [...]\dev\tests\integration\framework\Magento\Test\Bootstrap\Memory.php:67
   91.1336   22049080   6. Magento_Test_MemoryLimit->_getUsage() [...]\dev\tests\integration\framework\Magento\Test\MemoryLimit.php:75
   91.1336   22049112   7. Magento_Test_Helper_Memory->getRealMemoryUsage() [...]\dev\tests\integration\framework\Magento\Test\MemoryLimit.php:140
   91.1337   22049200   8. Magento_Test_Helper_Memory->getWinProcessMemoryUsage() [...]\dev\tests\integration\framework\Magento\Test\Helper\Memory.php:66
   92.0006   22051464   9. Magento_Test_Helper_Memory::convertToBytes() [...]\dev\tests\integration\framework\Magento\Test\Helper\Memory.php:119

Best regards,
Artus

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions