當前位置: 首頁>>代碼示例>>PHP>>正文


PHP system_with_timeout函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。