• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP system_with_timeout函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中system_with_timeout函数的典型用法代码示例。如果您正苦于以下问题:PHP system_with_timeout函数的具体用法?PHP system_with_timeout怎么用?PHP system_with_timeout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了system_with_timeout函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: run_test


//.........这里部分代码省略.........
            $e = explode('=', trim($e), 2);
            if (!empty($e[0]) && isset($e[1])) {
                $env[$e[0]] = $e[1];
            }
        }
    }
    // Default ini settings
    $ini_settings = array();
    // additional ini overwrites
    //$ini_overwrites[] = 'setting=value';
    settings2array($ini_overwrites, $ini_settings);
    // Any special ini settings
    // these may overwrite the test defaults...
    if (array_key_exists('INI', $section_text)) {
        if (strpos($section_text['INI'], '{PWD}') !== false) {
            $section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
        }
        settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
    }
    settings2params($ini_settings);
    // Check if test should be skipped.
    $info = '';
    $warn = false;
    if (array_key_exists('SKIPIF', $section_text)) {
        if (trim($section_text['SKIPIF'])) {
            show_file_block('skip', $section_text['SKIPIF']);
            save_text($test_skipif, $section_text['SKIPIF'], $temp_skipif);
            $extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
            if ($leak_check) {
                $env['USE_ZEND_ALLOC'] = '0';
            } else {
                $env['USE_ZEND_ALLOC'] = '1';
            }
            $output = system_with_timeout("{$extra} {$php} {$pass_options} -q {$ini_settings} {$test_skipif}", $env);
            if (!$cfg['keep']['skip']) {
                @unlink($test_skipif);
            }
            if (!strncasecmp('skip', ltrim($output), 4)) {
                if (preg_match('/^\\s*skip\\s*(.+)\\s*/i', $output, $m)) {
                    show_result('SKIP', $tested, $tested_file, "reason: {$m['1']}", $temp_filenames);
                } else {
                    show_result('SKIP', $tested, $tested_file, '', $temp_filenames);
                }
                if (isset($old_php)) {
                    $php = $old_php;
                }
                if (!$cfg['keep']['skip']) {
                    @unlink($test_skipif);
                }
                return 'SKIPPED';
            }
            if (!strncasecmp('info', ltrim($output), 4)) {
                if (preg_match('/^\\s*info\\s*(.+)\\s*/i', $output, $m)) {
                    $info = " (info: {$m['1']})";
                }
            }
            if (!strncasecmp('warn', ltrim($output), 4)) {
                if (preg_match('/^\\s*warn\\s*(.+)\\s*/i', $output, $m)) {
                    $warn = true;
                    /* only if there is a reason */
                    $info = " (warn: {$m['1']})";
                }
            }
        }
    }
    if (@count($section_text['REDIRECTTEST']) == 1) {
开发者ID:wgy0323,项目名称:ffmpeg-php,代码行数:67,代码来源:run-tests.php


示例2: run_test


//.........这里部分代码省略.........
    $tmp_skipif = $tmp . DIRECTORY_SEPARATOR . uniqid('/phpt.');
    $tmp_file = $tmp . DIRECTORY_SEPARATOR . ereg_replace('\\.phpt$', '.php', basename($file));
    $tmp_post = $tmp . DIRECTORY_SEPARATOR . uniqid('/phpt.');
    if (is_array($IN_REDIRECT)) {
        $tested = $IN_REDIRECT['prefix'] . ' ' . trim($section_text['TEST']) . " [{$tmp_file}]";
        $section_text['FILE'] = "# original source file: {$shortname}\n" . $section_text['FILE'];
    }
    @unlink($tmp_skipif);
    @unlink($tmp_file);
    @unlink($tmp_post);
    // unlink old test results
    @unlink($diff_filename);
    @unlink($log_filename);
    @unlink($exp_filename);
    @unlink($output_filename);
    // Reset environment from any previous test.
    putenv("REDIRECT_STATUS=");
    putenv("QUERY_STRING=");
    putenv("PATH_TRANSLATED=");
    putenv("SCRIPT_FILENAME=");
    putenv("REQUEST_METHOD=");
    putenv("CONTENT_TYPE=");
    putenv("CONTENT_LENGTH=");
    // Check if test should be skipped.
    $info = '';
    $warn = false;
    if (array_key_exists('SKIPIF', $section_text)) {
        if (trim($section_text['SKIPIF'])) {
            $skipif_params = array();
            settings2array($ini_overwrites, $skipif_params);
            settings2params($skipif_params);
            save_text($tmp_skipif, $section_text['SKIPIF']);
            $extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
            $output = system_with_timeout("{$extra} {$php} -q {$skipif_params} {$tmp_skipif}");
            @unlink($tmp_skipif);
            if (eregi("^skip", trim($output))) {
                echo "SKIP {$tested}";
                $reason = eregi("^skip[[:space:]]*(.+)\$", trim($output)) ? eregi_replace("^skip[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
                if ($reason) {
                    echo " (reason: {$reason})\n";
                } else {
                    echo "\n";
                }
                if (isset($old_php)) {
                    $php = $old_php;
                }
                return 'SKIPPED';
            }
            if (eregi("^info", trim($output))) {
                $reason = ereg("^info[[:space:]]*(.+)\$", trim($output)) ? ereg_replace("^info[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
                if ($reason) {
                    $info = " (info: {$reason})";
                }
            }
            if (eregi("^warn", trim($output))) {
                $reason = ereg("^warn[[:space:]]*(.+)\$", trim($output)) ? ereg_replace("^warn[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
                if ($reason) {
                    $warn = true;
                    /* only if there is a reason */
                    $info = " (warn: {$reason})";
                }
            }
        }
    }
    if (@count($section_text['REDIRECTTEST']) == 1) {
        global $test_files, $test_results, $failed_tests_file;
开发者ID:BackupTheBerlios,项目名称:php-qt-svn,代码行数:67,代码来源:run-tests.php


示例3: run_test


//.........这里部分代码省略.........
                    $ini_settings['extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $req_ext . '.' . PHP_SHLIB_SUFFIX;
                }
            }
        }
    }
    // additional ini overwrites
    //$ini_overwrites[] = 'setting=value';
    settings2array($ini_overwrites, $ini_settings);
    // Any special ini settings
    // these may overwrite the test defaults...
    if (array_key_exists('INI', $section_text)) {
        if (strpos($section_text['INI'], '{PWD}') !== false) {
            $section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
        }
        settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
    }
    settings2params($ini_settings);
    // Check if test should be skipped.
    $info = '';
    $warn = false;
    if (array_key_exists('SKIPIF', $section_text)) {
        if (trim($section_text['SKIPIF'])) {
            show_file_block('skip', $section_text['SKIPIF']);
            save_text($test_skipif, $section_text['SKIPIF'], $temp_skipif);
            $extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
            if ($leak_check) {
                $env['USE_ZEND_ALLOC'] = '0';
                $env['ZEND_DONT_UNLOAD_MODULES'] = 1;
            } else {
                $env['USE_ZEND_ALLOC'] = '1';
                $env['ZEND_DONT_UNLOAD_MODULES'] = 0;
            }
            junit_start_timer($shortname);
            $output = system_with_timeout("{$extra} {$php} {$pass_options} -q {$ini_settings} {$no_file_cache} -d display_errors=0 \"{$test_skipif}\"", $env);
            junit_finish_timer($shortname);
            if (!$cfg['keep']['skip']) {
                @unlink($test_skipif);
            }
            if (!strncasecmp('skip', ltrim($output), 4)) {
                if (preg_match('/^\\s*skip\\s*(.+)\\s*/i', $output, $m)) {
                    show_result('SKIP', $tested, $tested_file, "reason: {$m['1']}", $temp_filenames);
                } else {
                    show_result('SKIP', $tested, $tested_file, '', $temp_filenames);
                }
                if (!$cfg['keep']['skip']) {
                    @unlink($test_skipif);
                }
                $message = !empty($m[1]) ? $m[1] : '';
                junit_mark_test_as('SKIP', $shortname, $tested, null, $message);
                return 'SKIPPED';
            }
            if (!strncasecmp('info', ltrim($output), 4)) {
                if (preg_match('/^\\s*info\\s*(.+)\\s*/i', $output, $m)) {
                    $info = " (info: {$m['1']})";
                }
            }
            if (!strncasecmp('warn', ltrim($output), 4)) {
                if (preg_match('/^\\s*warn\\s*(.+)\\s*/i', $output, $m)) {
                    $warn = true;
                    /* only if there is a reason */
                    $info = " (warn: {$m['1']})";
                }
            }
        }
    }
    if (!extension_loaded("zlib") && (array_key_exists("GZIP_POST", $section_text) || array_key_exists("DEFLATE_POST", $section_text))) {
开发者ID:jimjag,项目名称:php-src,代码行数:67,代码来源:run-tests.php


示例4: run_test


//.........这里部分代码省略.........
        foreach (explode("\n", $section_text['ENV']) as $e) {
            $e = explode('=', trim($e));
            if (count($e) == 2) {
                $env[$e[0]] = $e[1];
            }
        }
    }
    // Default ini settings
    $ini_settings = array();
    // additional ini overwrites
    //$ini_overwrites[] = 'setting=value';
    settings2array($ini_overwrites, $ini_settings);
    // Any special ini settings
    // these may overwrite the test defaults...
    if (array_key_exists('INI', $section_text)) {
        if (strpos($section_text['INI'], '{PWD}') !== false) {
            $section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
        }
        settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
    }
    settings2params($ini_settings);
    // Check if test should be skipped.
    $info = '';
    $warn = false;
    if (array_key_exists('SKIPIF', $section_text)) {
        if (trim($section_text['SKIPIF'])) {
            if ($cfg['show']['skip']) {
                echo "\n========SKIP========\n";
                echo $section_text['SKIPIF'];
                echo "========DONE========\n";
            }
            save_text($test_skipif, $section_text['SKIPIF'], $temp_skipif);
            $extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
            $output = system_with_timeout("{$extra} {$php} -q {$ini_settings} {$test_skipif}", $env);
            if (!$cfg['keep']['skip']) {
                @unlink($test_skipif);
            }
            if (!strncasecmp('skip', trim($output), 4)) {
                $reason = eregi("^skip[[:space:]]*(.+)\$", trim($output)) ? eregi_replace("^skip[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
                if ($reason) {
                    show_result("SKIP", $tested, $tested_file, "reason: {$reason}", $temp_filenames);
                } else {
                    show_result("SKIP", $tested, $tested_file, '', $temp_filenames);
                }
                if (isset($old_php)) {
                    $php = $old_php;
                }
                if (!$cfg['keep']['skip']) {
                    @unlink($test_skipif);
                }
                return 'SKIPPED';
            }
            if (!strncasecmp('info', trim($output), 4)) {
                $reason = ereg("^info[[:space:]]*(.+)\$", trim($output)) ? ereg_replace("^info[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
                if ($reason) {
                    $info = " (info: {$reason})";
                }
            }
            if (!strncasecmp('warn', trim($output), 4)) {
                $reason = ereg("^warn[[:space:]]*(.+)\$", trim($output)) ? ereg_replace("^warn[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
                if ($reason) {
                    $warn = true;
                    /* only if there is a reason */
                    $info = " (warn: {$reason})";
                }
            }
开发者ID:akhan786,项目名称:LaunchDevelopment,代码行数:67,代码来源:run-tests.php



注:本文中的system_with_timeout函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP systemmail函数代码示例发布时间:2022-05-23
下一篇:
PHP system_time_zones函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap