function wait()
{
    global $fatherpid;
    if (posix_getpid() == $fatherpid) {
        tlog("begin wait");
        while (($pid = pcntl_wait($stat)) > 0) {
            tlog("child." . $pid . ". terminated \n");
        }
    }
}
예제 #2
0
function init_args(&$dbHandler)
{
    $iParams = array("apikey" => array(tlInputParameter::STRING_N, 32, 64), "tproject_id" => array(tlInputParameter::INT_N), "format" => array(tlInputParameter::INT_N));
    $args = new stdClass();
    $pParams = R_PARAMS($iParams, $args);
    if (!is_null($args->apikey)) {
        $cerbero = new stdClass();
        $cerbero->args = new stdClass();
        $cerbero->args->tproject_id = $args->tproject_id;
        if (strlen($args->apikey) == 32) {
            $cerbero->args->getAccessAttr = true;
            $cerbero->method = 'checkRights';
            $cerbero->redirect_target = "../../login.php?note=logout";
            setUpEnvForRemoteAccess($dbHandler, $args->apikey, $cerbero);
        } else {
            $args->addOpAccess = false;
            $cerbero->method = null;
            setUpEnvForAnonymousAccess($dbHandler, $args->apikey, $cerbero);
        }
    } else {
        testlinkInitPage($dbHandler, true, false, "checkRights");
        $args->tproject_id = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0;
    }
    if ($args->tproject_id <= 0) {
        $msg = __FILE__ . '::' . __FUNCTION__ . " :: Invalid Test Project ID ({$args->tproject_id})";
        throw new Exception($msg);
    }
    if (is_null($args->format)) {
        tlog("Parameter 'format' is not defined", 'ERROR');
        exit;
    }
    $args->user = $_SESSION['currentUser'];
    return $args;
}
예제 #3
0
파일: test.php 프로젝트: pacew/couch-test
function tlog_dump()
{
    echo "<div class='noprint'" . "  style='border-bottom: 2px solid red;height:3em'>" . "</div>";
    tlog("done");
    global $tlog_arr;
    echo "<div class='noprint tlog_report'>\n";
    echo "<table>\n";
    echo "<tr class='tlog_heading'>" . "<th>Total</th>" . "<th>Delta</th>" . "<th>Message</th>" . "</tr>\n";
    $start = $tlog_arr[0][0];
    $n = count($tlog_arr);
    for ($i = 0; $i < $n; $i++) {
        $arr = $tlog_arr[$i];
        $ts = $arr[0];
        $msg = $arr[1];
        if ($i < $n - 1) {
            $delta = $tlog_arr[$i + 1][0] - $ts;
        } else {
            $delta = 0;
        }
        $ts -= $start;
        echo sprintf("<tr>" . "<td class='tlog_num'>%.3f</td>" . "<td class='tlog_num'>%.3f</td>" . "<td>%s</td></tr>\n", $ts * 1000, $delta * 1000, h($msg));
    }
    echo "</table>\n";
    echo "</div>\n";
}
예제 #4
0
파일: func.php 프로젝트: arestotel/project
function error($handl)
{
    //функция вызова ошибки
    tlog($handl);
    ob_end_clean();
    include 'error.php';
    exit;
}
function getDataAndScale(&$dbHandler, $argsObj)
{
    $obj = new stdClass();
    $totals = null;
    $resultsCfg = config_get('results');
    $metricsMgr = new tlTestPlanMetrics($dbHandler);
    $dataSet = $metricsMgr->getRootTestSuites($argsObj->tplan_id, $argsObj->tproject_id);
    $dummy = $metricsMgr->getStatusTotalsByTopLevelTestSuiteForRender($argsObj->tplan_id);
    $obj->canDraw = !is_null($dummy->info);
    if (property_exists($argsObj, 'debug')) {
        new dBug($dummy->info);
    }
    if ($obj->canDraw) {
        //// Process to enable alphabetical order
        $item_descr = array_flip($dataSet);
        ksort($item_descr);
        foreach ($item_descr as $name => $tsuite_id) {
            if (isset($dummy->info[$tsuite_id])) {
                $items[] = htmlspecialchars($name);
                $rmap = $dummy->info[$tsuite_id]['details'];
                foreach ($rmap as $key => $value) {
                    $totals[$key][] = $value['qty'];
                }
            } else {
                // make things work, but create log this is not ok
                tlog(__FILE__ . '::' . __FUNCTION__ . 'Missing item: name/id:' . "{$name}/{$tsuite_id}", 'DEBUG');
            }
        }
    }
    $obj->xAxis = new stdClass();
    $obj->xAxis->values = $items;
    $obj->xAxis->serieName = 'Serie8';
    $obj->series_color = null;
    foreach ($totals as $status => $values) {
        $obj->chart_data[] = $values;
        $obj->series_label[] = lang_get($resultsCfg['status_label'][$status]);
        if (isset($resultsCfg['charts']['status_colour'][$status])) {
            $obj->series_color[] = $resultsCfg['charts']['status_colour'][$status];
        }
    }
    return $obj;
}
예제 #6
0
function init_args()
{
    $iParams = array("tplan_id" => array(tlInputParameter::INT_N), "format" => array(tlInputParameter::INT_N));
    $args = new stdClass();
    $pParams = G_PARAMS($iParams, $args);
    $args->tproject_id = $_SESSION['testprojectID'];
    if (is_null($args->format)) {
        tlog("Parameter 'format' is not defined", 'ERROR');
        exit;
    }
    return $args;
}
예제 #7
0
    case 'testproject':
        show_instructions('assignReqs');
        exit;
        break;
    case 'testsuite':
        $gui = processTestSuite($db, $args, $gui);
        $templateCfg->default_template = 'reqTcBulkAssignment.tpl';
        if ($bulkDone) {
            $gui->user_feedback = sprintf(lang_get('bulk_assigment_done'), $bulkCounter);
        }
        break;
    case 'testcase':
        $gui = processTestCase($db, $args, $gui);
        break;
    default:
        tlog("Wrong GET/POST arguments.", 'ERROR');
        exit;
        break;
}
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->assign('modify_req_rights', has_rights($db, "mgt_modify_req"));
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
/**
 *
 */
function init_args()
{
    $iParams = array("id" => array(tlInputParameter::INT_N), "req_id" => array(tlInputParameter::ARRAY_INT), "req" => array(tlInputParameter::INT_N), "showCloseButton" => array(tlInputParameter::STRING_N, 0, 1), "doAction" => array(tlInputParameter::STRING_N, 0, 100), "edit" => array(tlInputParameter::STRING_N, 0, 100), "unassign" => array(tlInputParameter::STRING_N, 0, 1), "assign" => array(tlInputParameter::STRING_N, 0, 1), "form_token" => array(tlInputParameter::INT_N), "idSRS" => array(tlInputParameter::INT_N));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
 * 
 * Page has two functions: navigation and select Test Plan
 *
 * This file is the first page that the user sees when they log in.
 * Most of the code in it is html but there is some logic that displays
 * based upon the login. 
 * There is also some javascript that handles the form information.
 *
 * @internal revisions
 * @since 1.9.10
 *
 **/
require_once '../../config.inc.php';
require_once 'common.php';
if (function_exists('memory_get_usage') && function_exists('memory_get_peak_usage')) {
    tlog("mainPage.php: Memory after common.php> Usage: " . memory_get_usage(), 'DEBUG');
}
testlinkInitPage($db, TRUE);
$smarty = new TLSmarty();
$tproject_mgr = new testproject($db);
$user = $_SESSION['currentUser'];
$testprojectID = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0;
$testplanID = isset($_SESSION['testplanID']) ? intval($_SESSION['testplanID']) : 0;
$accessibleItems = $tproject_mgr->get_accessible_for_user($user->dbID, array('output' => 'map_name_with_inactive_mark'));
$tprojectQty = $tproject_mgr->getItemCount();
$userIsBlindFolded = (is_null($accessibleItems) || count($accessibleItems) == 0) && $tprojectQty > 0;
if ($userIsBlindFolded) {
    $testprojectID = $testplanID = 0;
    $_SESSION['testprojectTopMenu'] = '';
}
$tplan2check = null;
예제 #9
0
/**
 * initializeGui
 *
 */
function initializeGui($statusCode, &$argsObj)
{
    $guiObj = new stdClass();
    // Count for the Failed Issues whose bugs have to be raised/not linked.
    $guiObj->without_bugs_counter = 0;
    $guiObj->dataSet = null;
    $guiObj->title = null;
    $guiObj->type = $argsObj->type;
    $guiObj->warning_msg = '';
    // Humm this may be can be configured ???
    foreach (array('failed', 'blocked', 'not_run') as $verbose_status) {
        if ($argsObj->type == $statusCode[$verbose_status]) {
            $guiObj->title = lang_get('list_of_' . $verbose_status);
            break;
        }
    }
    if (is_null($guiObj->title)) {
        tlog('wrong value of GET type');
        exit;
    }
    return $guiObj;
}
예제 #10
0
파일: test.code.php 프로젝트: hcopr/Hubbub
    if(!$parse['func'][$function])    
      tlog(false, $function.' in '.$parse2['files'][$decl], 'OK', 'fail');
    else
      $okCount1++;
  }
}
tlog(true, 'Other declarations: '.$okCount1, 'OK', 'fail');

tsection('Unused Code');
ksort($parse['func']);
foreach($parse['func'] as $function => $decl) if(!strStartsWith($parse2['files'][$decl], './plugins/') && !strStartsWith($parse2['files'][$decl], './log/') && !strStartsWith($parse2['files'][$decl], './static/'))
{
  if(!inStr($parse2['files'][$decl], 'controller') && substr($function, 0, 1) != '_' && 
    substr($function, 0, 1) != '(' && !strStartsWith($parse2['files'][$decl], './msg') && !$ignoreCallCheck[$function] && !strEndsWith($function, 'callback()') &&
    !strStartsWith($function, 'js_') && !strStartsWith($function, 'dyn_') && $function != 'h2_exceptionhandler()')
  {
    if(!$parse['call'][$function])
      tlog(false, $function.' in '.$parse2['files'][$decl], 'OK', 'fail');
    else
      $okCount2++;
  }
}
tlog(true, 'Other calls: '.$okCount2, 'OK', 'fail');

tsection_end();

?><!--<pre>
  <? 
  print_r($parse);
  ?>  
</pre>-->
예제 #11
0
  tlog($post->isDeleted, '"deleted" internal property set', 'OK', 'fail');  
	$streamPosts1 = $this->msg->getStream($ne2->key());
	$wallPosts1 = $this->msg->getPostList($ne1->key());
  $postFound9 = -1; $postFound10 = -1;
  foreach($streamPosts1['list'] as $pds)
    if($pds['m_id'] == $post->data['msgid']) $postFound9 = $pds['m_id']; 
  tlog($postFound9 == -1, 'Message gone from author stream', 'OK', 'fail (#'.$postFound9.')');
	foreach($wallPosts1['list'] as $pds)
	  if($pds['m_id'] == $post->data['msgid']) $postFound10 = $pds['m_id']; 
	tlog($postFound10 == -1, 'Message gone from owner profile', 'OK', 'fail ('.$postFound10.')');  
  
  // next, we'll try an invalid update where the author has suddenly changed
  $post->data['text'] = 'This update should not have happened.';
  $post->author($ne1->ds);
  $post->sendToUrl($ne1->ds['server']);
  tlog($post->responseData['result'] != 'OK', 'Rejection policy', 'OK ('.$post->responseData['reason'].')', 'fail');

  tsection_end();
?>











예제 #12
0
파일: test_base.php 프로젝트: alphaxxl/hhvm
function waitForClientToOutput($pipe, $string1, $retryCount = 20)
{
    global $test_run_id;
    tlog("reading client output");
    $rc = $retryCount;
    while (!feof($pipe)) {
        $clientOutput = fgets($pipe);
        tlog($clientOutput);
        if (strpos($clientOutput, ".....Debugger client still waiting for server response.....") === 0) {
            if (--$rc > 0) {
                continue;
            }
            dumpLogFilesToStdoutAndDie();
        }
        echo $clientOutput;
        if (strpos($clientOutput, $string1) === 0) {
            break;
        }
        $rc = $retryCount;
    }
    if (feof($pipe)) {
        tlog("client closed the pipe.");
    }
    tlog("done reading client output");
}
예제 #13
0
    tlog('No students purposefully not updated.', 'warn');
}
tlog('', '----');
if ($logging['num']['grade_types']) {
    tlog($logging['num']['grade_types'] . ' grade types with ' . $logging['num']['grade_types_in_use'] . ' grades set:', 'smry');
    $count = 0;
    foreach ($logging['grade_types'] as $grade_type => $num_grades) {
        echo sprintf('%4s', ++$count) . ': ' . $grade_type . ': ' . $num_grades . ".\n";
    }
} else {
    tlog('No grade_types found.', 'warn');
}
tlog('', '----');
if ($logging['num']['poor_grades']) {
    tlog($logging['num']['poor_grades'] . ' poor grades:', 'smry');
    $count = 0;
    foreach ($logging['poor_grades'] as $poorgrade) {
        echo sprintf('%4s', ++$count) . ': ' . $poorgrade . "\n";
    }
} else {
    tlog('No poor grades found. Good!', 'smry');
}
// Finish time.
$time_end = microtime(true);
$duration = $time_end - $time_start;
$mins = floor($duration / 60) == 0 ? '' : floor($duration / 60) . ' minutes';
$secs = $duration % 60 == 0 ? '' : $duration % 60 . ' seconds';
$secs = $mins == '' ? $secs : ' ' . $secs;
tlog('', '----');
tlog('Finished at ' . date('c', $time_end) . ', took ' . $mins . $secs . ' (' . number_format($duration, DECIMALS) . ' seconds).', 'done');
exit(0);
/**
 * initializeGui
 *
 */
function initializeGui($statusCode, &$argsObj, &$tplanMgr)
{
    $guiObj = new stdClass();
    $guiObj->format = $argsObj->format;
    $guiObj->tproject_id = $argsObj->tproject_id;
    $guiObj->tplan_id = $argsObj->tplan_id;
    $guiObj->apikey = $argsObj->apikey;
    // Count for the Failed Issues whose bugs have to be raised/not linked.
    $guiObj->without_bugs_counter = 0;
    $guiObj->dataSet = null;
    $guiObj->title = null;
    $guiObj->type = $argsObj->type;
    $guiObj->warning_msg = '';
    // Implementation based on convention, will use only keys starting with 'list_tc_'
    // see reports.cfg.php
    $reportCfg = config_get('reports_list');
    $lbl_th_bugs_not_linked = lang_get('th_bugs_not_linked');
    $needle = 'list_tc_';
    $nl = strlen($needle);
    foreach ($reportCfg as $key => $val) {
        $checkIt = false;
        if ($checkIt = strpos($key, $needle) !== FALSE) {
            // now get the verbose status
            // list_tc_[verbose_status], example list_tc_not_run
            $verbose_status = substr($key, $nl);
            // if( $verbose_status != 'not_run' || $verbose_status != 'passed' )
            $guiObj->bugs_msg = $lbl_th_bugs_not_linked;
            if (isset($reportCfg[$key]['misc'])) {
                if (isset($reportCfg[$key]['misc']['bugs_not_linked']) && $reportCfg[$key]['misc']['bugs_not_linked'] == false) {
                    $guiObj->bugs_msg = '';
                }
            }
        }
        if ($checkIt) {
            if ($argsObj->type == $statusCode[$verbose_status]) {
                $guiObj->title = lang_get('list_of_' . $verbose_status);
                break;
            }
        }
    }
    if (is_null($guiObj->title)) {
        tlog('wrong value of GET type');
        exit;
    }
    // needed to decode
    $getOpt = array('outputFormat' => 'map');
    $guiObj->platformSet = $tplanMgr->getPlatforms($argsObj->tplan_id, $getOpt);
    if (!($guiObj->show_platforms = !is_null($guiObj->platformSet))) {
        $guiObj->platformSet = array('');
    }
    $guiObj->buildSet = $tplanMgr->get_builds_for_html_options($argsObj->tplan_id);
    return $guiObj;
}
예제 #15
0
<h3>Creating and finding</h3>
<?
  
	$newUserId = 'HTT_'.substr(md5(time()), 0, 5);
	$erec = array('server' => $_SERVER['HTTP_HOST'], 'user' => $newUserId, 'url' => $_SERVER['HTTP_HOST'].'/'.$newUserId);
	$ne = new HubbubEntity();
	?><div>Test Entity: <?php 
echo json_encode($erec);
?>
</div><?
	$ne->create($erec, true);
  tlog($ne->ds['_key'] > 0, 'HubbubEntity::create()', 'created', 'failed, no key assigned'); 

  $found = HubbubEntity::findEntityGlobal(array('server' => $erec['server'], 'user' => $erec['user']));
  tlog($found['_key'] > 0, 'HubbubEntity::findEntityGlobal(server, user)', 'found', 'not found'); 
  tlog($found['_key'] == $ne->ds['_key'], 'HubbubEntity::findEntityGlobal(server, user) key value', 'correct', 'not valid'); 	
	
  tlog(!HubbubEntity::isNameAvailable($erec['user']), 'HubbubEntity::isNameAvailable(user)', 'OK', 'name not found'); 
	
?>
예제 #16
0
파일: test.vis.php 프로젝트: hcopr/Hubbub
  $post = new HubbubMessage('post');
	$post->localUserEntity = $u[0]['id'];
  $post->owner($u[0]['erec']);
  $post->data['text'] = 'This is a realtime message. Umlauts like üöä should be preserved.';
  $post->save();
  
  tlog($post->ds['m_key'] > 0, 'Message created by user ('.$u[0]['id'].')', 'OK (#'.$post->ds['m_key'].')', 'fail');

  // now let's see who has the message in their stream
  foreach($u as $usr)
  {
    if($isFriend[$u[0]['id']][$usr['id']])
      tlog(hasMessageInStream($this, $usr['id'], $post->ds['m_key']), 
        'User '.$usr['id'].' has message '.$post->ds['m_key'].' in stream', 'OK', 'fail'); 
    else
      tlog(!hasMessageInStream($this, $usr['id'], $post->ds['m_key']), 
        'User '.$usr['id'].' has message '.$post->ds['m_key'].' NOT in stream', 'OK', 'fail'); 
  }
  
  tsection_end();
?>
<div style="height: 200px"></div>
<pre><?

#print_r($this->msg->getStream($u[4]['id']));

?></pre>