示例#1
0
<?php

function get_php($rand)
{
    $jumpTypeArr = array();
    $jumpTypeArr[0] = 1;
    $jumpTypeArr[5] = 8;
    $jumpTypeArr[6] = 8;
    $jumpTypeSum = array_sum($jumpTypeArr);
    $randValueSum = 0;
    foreach ($jumpTypeArr as $jumpType => $randValue) {
        $randValueSum += ceil($randValue / $jumpTypeSum * 100);
        if ($rand < $randValueSum) {
            break;
        }
    }
    return $jumpType;
}
for ($i = 0; $i <= 100; $i++) {
    echo "{$i}\t" . get_php($i) . "\n";
}
示例#2
0
symlink($working_directory, "test/working/latest");
mkdir("{$working_directory}/.libs");
// avoid 'File exists' errors
print "Working from: {$working_directory}\n";
require_once "lib/startup.php";
require_once "lib/autovars.php";
require_once "reduce/Reduce.php";
if ($opt_clean) {
    echo "rm -Rf ./test/logs/*\n";
    `rm -Rf ./test/logs/*`;
    echo "rm -Rf ./test/working/*\n";
    `rm -Rf ./test/working/*`;
    exit(0);
}
open_status_files();
$php = get_php();
$base_dir = getcwd();
if ($opt_installed) {
    // Make it so we cant rely on anything that's installed
    $phc = "{$bindir}/phc";
    $plugin_dir = "{$pkglibdir}/plugins";
    $phc_compile_plugin = "{$bindir}/phc_compile_plugin";
    $trunk_CPPFLAGS = "";
    // we use these for compiling plugins with phc_compile_plugin
    $pwd = getcwd();
    $dir = sys_get_temp_dir() . "/phc-test-" . getmypid();
    echo `rm -Rf {$dir}`;
    mkdir($dir);
    chdir($dir);
    echo `ln -s {$pwd}/test test`;
    echo "Running from: " . getcwd() . "\n";