PHPUnit 和 Jenkins 中“//proc/tty/driver”的权限错误?
Permissions error with "//proc/tty/driver" in PHPUnit and Jenkins?
我正在尝试 运行 在 Jenkins 运行ning Ubuntu 14.04 上构建。我的 PHP 单元因以下错误消息而崩溃,但关于此错误的信息似乎并不多。我的 xdebug 似乎加载正确。我是 运行ning PHPUnit v4.8.10.
当我尝试直接通过命令行 运行 phpunit
时,它只是挂起而没有 return。我错过了什么?
phpunit:
[phpunit] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(//proc/tty/driver): failed to open dir: Permission denied' in /var/lib/jenkins/jobs/Some other job/workspace/vendor/phpunit/php-file-iterator/src/Factory.php:66
[phpunit] Stack trace:
[phpunit] #0 [internal function]: RecursiveDirectoryIterator->__construct('//proc/tty/driv...', 512)
[phpunit] #1 [internal function]: RecursiveDirectoryIterator->getChildren()
[phpunit] #2 [internal function]: FilterIterator->rewind()
[phpunit] #3 /var/lib/jenkins/jobs/Some other job/workspace/vendor/phpunit/php-file-iterator/src/Factory.php(66): AppendIterator->append(Object(File_Iterator))
[phpunit] #4 /var/lib/jenkins/jobs/Some other job/workspace/vendor/phpunit/php-file-iterator/src/Facade.php(38): File_Iterator_Factory->getFileIterator(Array, '.php', '', Array)
[phpunit] #5 /var/lib/jenkins/jobs/Some other job/workspace/vendor/phpunit/php-code-coverage/src/CodeCoverage/Filter.php(112): File_Iterator_Facade->getFilesAsArray('/', '.php', '')
[phpunit] #6 /var/lib/jenkins/jobs/Some other job/workspace/vend in /var/lib/jenkins/jobs/Some other job/workspace/vendor/phpunit/php-file-iterator/src/Factory.php on line 66
BUILD FAILED
/var/lib/jenkins/jobs/Some other job/workspace/build.xml:169: exec returned: 255
PHP 信息:
PHP 5.5.9-1ubuntu4.13 (cli) (built: Sep 29 2015 15:24:49)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
问题出在我 phpunit.xml
中的白名单上。正如您在 <directory>
标记中看到的,我告诉我的代码覆盖从服务器的根目录开始!这就是它最终通过我的插座查看并在不应该出现的地方被抓住的原因。
要解决此问题,请将下面的 <directory suffix=".php">/</directory>
更改为 <directory suffix=".php">./</directory>
,这样代码覆盖率只会查看您的项目目录。
旧过滤器:
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">/</directory>
<exclude>
<file>bootstrap/autoload.php</file>
</exclude>
</whitelist>
</filter>
我正在尝试 运行 在 Jenkins 运行ning Ubuntu 14.04 上构建。我的 PHP 单元因以下错误消息而崩溃,但关于此错误的信息似乎并不多。我的 xdebug 似乎加载正确。我是 运行ning PHPUnit v4.8.10.
当我尝试直接通过命令行 运行 phpunit
时,它只是挂起而没有 return。我错过了什么?
phpunit:
[phpunit] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(//proc/tty/driver): failed to open dir: Permission denied' in /var/lib/jenkins/jobs/Some other job/workspace/vendor/phpunit/php-file-iterator/src/Factory.php:66
[phpunit] Stack trace:
[phpunit] #0 [internal function]: RecursiveDirectoryIterator->__construct('//proc/tty/driv...', 512)
[phpunit] #1 [internal function]: RecursiveDirectoryIterator->getChildren()
[phpunit] #2 [internal function]: FilterIterator->rewind()
[phpunit] #3 /var/lib/jenkins/jobs/Some other job/workspace/vendor/phpunit/php-file-iterator/src/Factory.php(66): AppendIterator->append(Object(File_Iterator))
[phpunit] #4 /var/lib/jenkins/jobs/Some other job/workspace/vendor/phpunit/php-file-iterator/src/Facade.php(38): File_Iterator_Factory->getFileIterator(Array, '.php', '', Array)
[phpunit] #5 /var/lib/jenkins/jobs/Some other job/workspace/vendor/phpunit/php-code-coverage/src/CodeCoverage/Filter.php(112): File_Iterator_Facade->getFilesAsArray('/', '.php', '')
[phpunit] #6 /var/lib/jenkins/jobs/Some other job/workspace/vend in /var/lib/jenkins/jobs/Some other job/workspace/vendor/phpunit/php-file-iterator/src/Factory.php on line 66
BUILD FAILED
/var/lib/jenkins/jobs/Some other job/workspace/build.xml:169: exec returned: 255
PHP 信息:
PHP 5.5.9-1ubuntu4.13 (cli) (built: Sep 29 2015 15:24:49)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
问题出在我 phpunit.xml
中的白名单上。正如您在 <directory>
标记中看到的,我告诉我的代码覆盖从服务器的根目录开始!这就是它最终通过我的插座查看并在不应该出现的地方被抓住的原因。
要解决此问题,请将下面的 <directory suffix=".php">/</directory>
更改为 <directory suffix=".php">./</directory>
,这样代码覆盖率只会查看您的项目目录。
旧过滤器:
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">/</directory>
<exclude>
<file>bootstrap/autoload.php</file>
</exclude>
</whitelist>
</filter>