Ejemplo n.º 1
0
/**
* Submit the test request file to the server
*
* @param mixed $run
* @param mixed $testRun
* @param mixed $test
*/
function SubmitUrl($testId, $testData, &$test, $url)
{
    $ret = false;
    global $error;
    global $locations;
    if (array_key_exists('loc_type', $test) && $test['loc_type'] == 'Appurify') {
        require_once './lib/appurify.inc.php';
        $appurify = new Appurify($test['appurify_key'], $test['appurify_secret']);
        $ret = $appurify->SubmitTest($test, $error);
    } else {
        $script = ProcessTestScript($url, $test);
        $out = "Test ID={$testId}\r\nurl=";
        if (isset($script) && strlen($script)) {
            $out .= "script://{$testId}.pts";
        } else {
            $out .= $url;
        }
        // add the actual test configuration
        $out .= $testData;
        if (isset($script) && strlen($script)) {
            $out .= "\r\n[Script]\r\n" . $script;
        }
        // write out the actual test file
        $ext = 'url';
        if ($test['priority']) {
            $ext = "p{$test['priority']}";
        }
        $test['job'] = "{$testId}.{$ext}";
        $location = $test['location'];
        $ret = WriteJob($location, $test, $out, $testId);
        if (isset($test['ami'])) {
            EC2_StartInstanceIfNeeded($test['ami']);
        }
    }
    return $ret;
}