douquanjie9326 2016-02-20 14:11
浏览 42
已采纳

在Arch Linux上构建PHP5.6.18:尽管PHP_OS检查,但不会跳过Windows测试

Short version

Why does this unmodified code from the official PHP 5.6.18 release:

--SKIPIF--
<?php
if (phpversion() < "5.3.0") { die('SKIP php version so lower.'); }
if (!extension_loaded('openssl')) { die('ext/openssl required'); }
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
        die('skip windows only test');
}
?>

... not cause a windows-only test to be skipped when I'm building the PHP package on Arch Linux?

Long version

I'm trying to build PHP5.6.18 using the PKGBUILD from the official Arch Build System. Here's what I've done:

  1. git clone git://projects.archlinux.org/svntogit/packages.git
  2. I went through the git history of the php package, and identified this commit as the best starting point - basically the last commit before the uprev to PHP7. So, I cd into packages, and git checkout that commit ID.
  3. I updated the PKGBUILD like this:
    • set pkgver=5.6.18
    • set pkgrel=1
    • set the first md5sum to '177ba962557795866ae331ad4ad99bba'
  4. setup clean chroot for building (this reduced the test failures from 2-3 to 1)
  5. Build php: makechrootpkg -c -r $CHROOT (in the directory with the PKGBUILD file.

The build works fine, but I get the following test failure:

Number of tests : 6651              6180
Tests skipped   :  471 (  7.1%) --------
Tests warned    :    1 (  0.0%) (  0.0%)
Tests failed    :    1 (  0.0%) (  0.0%)
Expected fail   :    9 (  0.1%) (  0.1%)
Tests passed    : 6169 ( 92.8%) ( 99.8%)
---------------------------------------------------------------------
Time taken      :   45 seconds
...
FAILED TEST SUMMARY
---------------------------------------------------------------------
mixed stream_socket_enable_crypto(resource $stream , bool $enable [, int $crypto_type [, resource $session_stream
]] ) ; [ext/standard/tests/streams/stream_socket_enable_crypto-win32.phpt]
=====================================================================

=====================================================================
WARNED TEST SUMMARY
---------------------------------------------------------------------
Bug #70172 - Use After Free Vulnerability in unserialize() [ext/standard/tests/serialize/bug70172.phpt] (warn: XFA
IL section but test passes)
=====================================================================

OK, so the win32 already looks suspicious in the filename, and a look at the file contents indeed suggests that the test should be skipped on Linux:

--TEST--
mixed stream_socket_enable_crypto(resource $stream , bool $enable [, int $crypto_type [, resource $session_stream ]] ) ;
...
--SKIPIF--
<?php
if (phpversion() < "5.3.0") { die('SKIP php version so lower.'); }
if (!extension_loaded('openssl')) { die('ext/openssl required'); }
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
        die('skip windows only test');
}
?>

Note the PHP_OS related check. So, I'm thinking, maybe PHP_OS is somehow getting the wrong value. So, I:

  1. Manually go into the build chroot: arch-nspawn $CHROOT/$USER/
  2. Add echo substr(PHP_OS, 0, 3) to the beginning of that test (just under the <?php in the --FILE-- section, and in the actual stream_socket_enable_crypto-win32.php file)
  3. Re-run it using the stream_socket_enable_crypto-win32.sh script in the same directory, I indeed see the expected Lin output.

Why is this test not skipped? I'm really confused. How can I fix this issue?

  • 写回答

2条回答 默认 最新

  • douhuang3833 2016-02-21 12:12
    关注

    As a workaround, for now I'll just delete the test in the prepare() section of the PKGBUILD file:

    prepare() {
            cd ${srcdir}/${pkgbase}-${pkgver}
            # ....
            # add this line:
            rm ./ext/standard/tests/streams/stream_socket_enable_crypto-win32.phpt
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了
  • ¥15 电脑最近经常蓝屏,求大家看看哪的问题
  • ¥60 高价有偿求java辅导。工程量较大,价格你定,联系确定辅导后将采纳你的答案。希望能给出完整详细代码,并能解释回答我关于代码的疑问疑问,代码要求如下,联系我会发文档
  • ¥50 C++五子棋AI程序编写
  • ¥30 求安卓设备利用一个typeC接口,同时实现向pc一边投屏一边上传数据的解决方案。
  • ¥15 SQL Server analysis services 服务安装失败