Skip to content

Commit

Permalink
on FAIL only first few lines of output is displayed, but logged are all
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jul 21, 2013
1 parent e9bae92 commit 9a730f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 1 addition & 5 deletions Tester/Runner/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class Job
CODE_FAIL = 178,
CODE_ERROR = 255;

const DUMP_LINES = 10;

/** @var string test file */
private $file;

Expand Down Expand Up @@ -162,10 +160,8 @@ public function checkOptions()
$opts = $this->options;
$expected = isset($opts['exitcode']) ? (int) $opts['exitcode'] : self::CODE_OK;
if ($this->exitCode !== $expected) {
$lines = explode("\n", trim($this->output), self::DUMP_LINES + 1);
$lines[self::DUMP_LINES] = isset($lines[self::DUMP_LINES]) ? '...' : '';
throw new JobException(
($this->exitCode !== self::CODE_FAIL ? "Exited with error code $this->exitCode (expected $expected)\n" : '') . implode("\n", $lines),
($this->exitCode !== self::CODE_FAIL ? "Exited with error code $this->exitCode (expected $expected)\n" : '') . $this->output,
$this->exitCode
);
}
Expand Down
10 changes: 7 additions & 3 deletions Tester/Runner/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class Runner
/** waiting time between runs in microseconds */
const RUN_USLEEP = 10000;

/** count of lines to print */
const PRINT_LINES = 15;

/** @var array paths to test files/directories */
public $paths = array();

Expand Down Expand Up @@ -239,12 +242,13 @@ private function printAndLogResult($result, Job $job, $message = NULL)

$this->printAndLog($results[$result][0], FALSE);

$this->results[$result][] = $s = "\n-- {$results[$result][1]}: {$job->getName()}"
. ($message ? str_replace("\n", "\n ", "\n" . trim($message)) . "\n" : '');

$s = "\n-- {$results[$result][1]}: {$job->getName()}" . str_replace("\n", "\n ", "\n" . trim($message));
if ($this->logFile) {
fputs($this->logFile, Tester\Dumper::removeColors($s) . "\n");
}
$lines = explode("\n", $s, self::PRINT_LINES + 1);
$lines[self::PRINT_LINES] = isset($lines[self::PRINT_LINES]) ? "\n ..." : '';
$this->results[$result][] = implode("\n", $lines);
}

}

0 comments on commit 9a730f2

Please sign in to comment.