2015-06-06 5 views
5

मेरे phpunit.xmlPhpUnit ... मारे गए क्यों इसे मारा जा रहा है?

<phpunit 
    bootstrap="bootstrap.php" 
    backupGlobals="false" 
    colors="true" 
    convertErrorsToExceptions="true" 
    convertNoticesToExceptions="true" 
    convertWarningsToExceptions="true" 
    > 
    <testsuites> 
    <testsuite> 
     <directory suffix="Test.php">./tests</directory> 
    </testsuite> 
    </testsuites> 

    <logging> 
    <log type="coverage-html" target="coverage" lowUpperBound="75" highUpperBound="100" /> 
    </logging> 
</phpunit> 

मेरे bootstrap.php:

<?php 

/** ---------------------------------------------------- **/ 
// Require the vendors autoload file. 
/** ---------------------------------------------------- **/ 
require_once 'vendor/autoload.php'; 

/** ---------------------------------------------------- **/ 
// We neeed WordPress Bootstrap files for its test. 
/** ---------------------------------------------------- **/ 
define('WP_TEST_DIR', parse_ini_file('test-config.ini')['test-location']); 

// Include the bootstrap file. 
require_once WP_TEST_DIR . 'includes/bootstrap.php'; 

// Include the Functions file 
require_once WP_TEST_DIR . 'includes/functions.php'; 

जब मैं uncommented लॉगिंग अनुभाग के साथ इस चलाने के लिए, मैं:

[email protected]:/vagrant/Freya/Routes$ phpunit 
Installing... 
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml 
Not running ajax tests. To execute these, use --group ajax. 
Not running ms-files tests. To execute these, use --group ms-files. 
Not running external-http tests. To execute these, use --group external-http. 
PHPUnit 4.6.6 by Sebastian Bergmann and contributors. 

Configuration read from /vagrant/Freya/Routes/phpunit.xml 

...............Killed 

जब मैं प्रवेश बाहर टिप्पणी मैं:

[email protected]:/vagrant/Freya/Routes$ phpunit 
Installing... 
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml 
Not running ajax tests. To execute these, use --group ajax. 
Not running ms-files tests. To execute these, use --group ms-files. 
Not running external-http tests. To execute these, use --group external-http. 
PHPUnit 4.6.6 by Sebastian Bergmann and contributors. 

Configuration read from /vagrant/Freya/Routes/phpunit.xml 

.................................. 

Time: 9.64 seconds, Memory: 45.50Mb 

OK (34 tests, 38 assertions) 

कोई दृश्यमान त्रुटियों के साथ क्यों मर जाता है? क्या यह एक स्मृति मुद्दा है? यदि ऐसा है तो ऐसा क्यों नहीं? परीक्षणों के इन सेटों में वर्डप्रेस टेस्ट सूट क्लास WP_UnitTestCase शामिल है ताकि मुझे कुछ परीक्षणों के लिए नकली वर्डप्रेस इंस्टॉल स्थापित करने की अनुमति मिल सके, लेकिन जैसा कि आप दूसरी बार देख सकते हैं कि लॉगिंग के साथ मैंने परीक्षण किया था, मुझे 45.50 एमबी मेमोरी मिली । वो कुछ भी नहीं है।

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT 
display_errors = On 
display_startup_errors = Off 

PHP संस्करण 5.5.9

क्या हो रहा है? (हाँ कवरेज फ़ोल्डर मौजूद है)

अद्यतन 1

बाहर कर देता है कि dmesg दिखा रहा है:

[942618.313174] Out of memory: Kill process 12987 (php) score 384 or sacrifice child 
[942618.315188] Killed process 12987 (php) total-vm:453360kB, anon-rss:192380kB, file-rss:12kB 
[942757.404416] php5-fpm invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0 
[942757.404421] php5-fpm cpuset=/ mems_allowed=0 
[942757.404424] CPU: 0 PID: 16427 Comm: php5-fpm Tainted: G   OX 3.13.0-37-generiC#64-Ubuntu 
[942757.404426] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 
[942757.404428] 0000000000000000 ffff88000200d980 ffffffff8171ed09 ffff88001dfbb000 
[942757.404431] ffff88000200da08 ffffffff817195c4 0000000000000000 0000000000000000 
[942757.404432] 0000000000000000 0000000000000000 0000000000000000 0000000000000000 

मैं इस मामले में पीएचपी की स्मृति बढ़ाने की आवश्यकता होगी?

+1

यह देखने के लिए कि वास्तव में ओओएम हत्यारे द्वारा मारा गया है, 'dmesg' जांचें। – VolenD

+0

डीएमएसई लॉग के अनुसार मारे गए प्रक्रिया द्वारा उपयोग की गई स्मृति 1 9 2 एमबी है। मुझे लगता है कि वीएम में पर्याप्त मुफ्त मेमोरी नहीं है (परीक्षण चल रहे हैं, तो आप इसे 'शीर्ष' के साथ मॉनीटर कर सकते हैं)। तो, आपको वीएम की याददाश्त में वृद्धि करना है (बढ़ती PHP मेमोरी आपकी मदद नहीं करेगी)। – VolenD

+0

मैंने PHP एमएम को 550 एमबी तक बढ़ा दिया और इस मुद्दे को हल किया, वीएम में 2 गीगा हैं, जहां PHP एमएम 120 एम – TheWebs

उत्तर

1

मुझे PHPUnit में घातक त्रुटियों का निदान करने के लिए सबसे अच्छा (केवल?) तरीका मिला है बूटस्ट्रैप में शटडाउन त्रुटि जाल जोड़ना है। PHPUnit त्रुटियों को स्वयं रिपोर्टिंग में मदद करने के लिए त्रुटियों का उपयोग करता है, लेकिन किसी कारण से यह कुछ मूल/घातक प्रकार की त्रुटियों को रिपोर्ट होने से रोकता है।

मैं अपने सभी परियोजनाओं में इस जोड़ें:

phpunit.xml:

< phpunit 
    bootstrap="bootstrap.php" 
... 

bootstrap.php:

// PHPUnit dies silently with FATAL ERRORS which makes it hard to debug the tests. 
register_shutdown_function('PHPUnit_shutdownFunction'); 
function PHPUnit_shutdownFunction() { 
    // http://www.php.net/manual/en/errorfunc.constants.php 
    $error = error_get_last(); 
    if (!is_null($error)){ 
     if($error['type'] & (E_ERROR + E_PARSE + E_CORE_ERROR + E_COMPILE_ERROR + E_USER_ERROR + E_RECOVERABLE_ERROR)){ 
      echo 'Test Bootstrap: Caught untrapped fatal error: '; 
      var_export($error); 
     } 
    } 
} 

और साथ अतीत की बात हो इन रहस्यमय समस्याओं।

संबंधित मुद्दे