示例#1
0
<?php

// 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ
$fp = fopen(__FILE__, 'r');
// Open self
DoTest($fp, 'ZZZ');
// test multi-char delimiter
DoTest($fp, "Z");
// test single-char delimiter
function DoTest($fp, $delim)
{
    echo "Delimiter:  " . $delim . "\n";
    rewind($fp);
    echo "\t" . stream_get_line($fp, 10, $delim) . "\n";
    echo "\t" . stream_get_line($fp, 10, $delim) . "\n";
}
示例#2
0
 if ($dotests) {
     // evaluation
     if ($lrow['simpleeval'] == 1) {
         $lvl = SimpleEval($lrow['testtype'], $result);
     } else {
         $lvl = nats_eval("L" . $lrow['localtestid'], $result);
     }
     db(" Eval: " . $lvl);
     // put in the custom retries based on attempts here - we KNOW dotests is on so don't need to worry about untested status
     $att = $lrow['attempts'];
     if ($lvl != 0 && is_numeric($att) && $att > 1) {
         for ($a = 2; $a <= $att; $a++) {
             test_sleep();
             db(" Test: " . $lrow['testtype'] . " (" . $lrow['testparam'] . ") X" . $a);
             $NATS->Event("Tester " . $trid . " Node " . $row['nodeid'] . " X" . $a . " Doing " . $lrow['testtype'] . "(" . $lrow['testparam'] . ")", 10, "Tester", "Test");
             $result = DoTest($lrow['testtype'], $lrow['testparam'], $row['hostname'], $lrow['timeout'], $params, $row['nodeid']);
             db(" Result: " . $result);
             if ($lrow['simpleeval'] == 1) {
                 $lvl = SimpleEval($lrow['testtype'], $result);
             } else {
                 $lvl = nats_eval("L" . $lrow['localtestid'], $result);
             }
             db(" Eval: " . $lvl);
             if ($lvl == 0) {
                 $a = $att + 1;
             }
             // test passed
         }
     }
     // $lvl is now the last lvl regardless of where it came from
     if ($lvl > $alertlevel) {