Skip to content

Commit

Permalink
Added support for post-processing of relayed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeenan committed Aug 13, 2013
1 parent da2afb6 commit 198f692
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion www/lib/tsview.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
function TSViewPostResult(&$test, $id, $testPath, $server, $tsview_name) {
require_once('page_data.inc');

$runs = $test['runs'];
if (array_key_exists('discard', $test) &&
$test['discard'] > 0 &&
Expand Down Expand Up @@ -72,6 +72,8 @@ function TSViewPostResult(&$test, $id, $testPath, $server, $tsview_name) {

function TSViewCreate($server, $tsview_name, &$metrics) {
$needs_update = false;
if (!is_dir('./dat'))
mkdir('./dat', 0777, true);
$def = './dat/tsview-' . sha1($tsview_name) . '.json';
if ($lock = fopen("$def.lock", 'w')) {
if (flock($lock, LOCK_EX)) {
Expand Down
2 changes: 1 addition & 1 deletion www/runtest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function DealWithMagicQuotes(&$arr) {
$test['clearcerts'] = array_key_exists('clearcerts', $_REQUEST) && $_REQUEST['clearcerts'] ? 1 : 0;
$test['orientation'] = array_key_exists('orientation', $_REQUEST) ? trim($_REQUEST['orientation']) : 'default';
if (array_key_exists('tsview_id', $_REQUEST))
$test['tsview_id'] = $_REQUEST('tsview_id');
$test['tsview_id'] = $_REQUEST['tsview_id'];

// custom options
$test['cmdLine'] = '';
Expand Down
4 changes: 2 additions & 2 deletions www/testStatus.inc
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ function GetRelayStatus($id, $testPath, &$test) {
$zip = new ZipArchive();
if ($zip->open($tmp) === true) {
if ($zip->extractTo($testPath)) {
require_once('archive.inc');
ArchiveTest($id);
SendAsyncRequest("/work/postprocess.php?test=$id");
http_fetch("{$server}delete.php?test=$id&rkey=$key");
$ret = $status['data'];
}
Expand Down Expand Up @@ -348,6 +347,7 @@ function GetAppurifyStatus($id, $testPath, &$test) {
$ret['statusCode'] = 200;
$ret['statusText'] = 'Test Complete';
$ret['completeTime'] = $date;
SendAsyncRequest("/work/postprocess.php?test=$id");
} elseif ($started) {
$ret['statusCode'] = 100;
$ret['statusText'] = 'Test Started';
Expand Down
4 changes: 2 additions & 2 deletions www/work/postprocess.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@
$testInfo = json_decode(gz_file_get_contents("$testPath/testinfo.json"), true);

// post the test to tsview if requested
$tsviewdb = GetSetting('tsviewdb');
if (array_key_exists('tsview_id', $testInfo) &&
strlen($testInfo['tsview_id']) &&
array_key_exists('tsviewdb', $settings) &&
strlen($settings['tsviewdb']) &&
strlen($tsviewdb) &&
is_file('./lib/tsview.inc.php')) {
require_once('./lib/tsview.inc.php');
TSViewPostResult($testInfo, $id, $testPath, $settings['tsviewdb'], $testInfo['tsview_id']);
Expand Down

0 comments on commit 198f692

Please sign in to comment.