[polly] r218826 - Change the output of arc unit
Johannes Doerfert
doerfert at cs.uni-saarland.de
Wed Oct 1 14:26:24 PDT 2014
Author: jdoerfert
Date: Wed Oct 1 16:26:24 2014
New Revision: 218826
URL: http://llvm.org/viewvc/llvm-project?rev=218826&view=rev
Log:
Change the output of arc unit
arc unit will now show the number of consecutive tests with the same
result instead of printing a "." for each one. Due to the number of
tests the "dots" didn't fit in one line any more. Furthermore the
result list is shortened, only non passing tests or tests taking
longer than a time threshold (50ms) will be reported (both to the user
and to phabricator).
Modified:
polly/trunk/utils/arcanist/LitTestEngine/src/LitTestEngine.php
Modified: polly/trunk/utils/arcanist/LitTestEngine/src/LitTestEngine.php
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/utils/arcanist/LitTestEngine/src/LitTestEngine.php?rev=218826&r1=218825&r2=218826&view=diff
==============================================================================
--- polly/trunk/utils/arcanist/LitTestEngine/src/LitTestEngine.php (original)
+++ polly/trunk/utils/arcanist/LitTestEngine/src/LitTestEngine.php Wed Oct 1 16:26:24 2014
@@ -27,8 +27,11 @@ final class LitTestEngine extends Arcani
ArcanistUnitTestResult::RESULT_POSTPONED => 'yellow'
);
- $s = "[";
+ $s = "\t[\033[0;30m";
+ $number = -1;
$lastColor = "";
+ $lastResult = "";
+ $lastNumber = "";
foreach ($results as $result) {
$color = $colors[$result->getResult()];
if (!$color && $lastColor)
@@ -37,14 +40,29 @@ final class LitTestEngine extends Arcani
$s .= "<bg:$color>";
elseif ($lastColor !== $color)
$s .= "</bg><bg:$color>";
+ if ($number <= 0)
+ $number = 1;
+ elseif ($lastResult == $result->getResult())
+ $number += 1;
+ else
+ $number = 1;
+ if ($number > 1 && $number <= 10)
+ $s = substr($s, 0, -1);
+ elseif ($number > 10 && $number <= 100)
+ $s = substr($s, 0, -2);
+ elseif ($number > 100 && $number <= 1000)
+ $s = substr($s, 0, -3);
+ $s .= "$number";
+ $lastNumber = $number;
+ $lastResult = $result->getResult();
$lastColor = $color;
- $s .= ".";
}
if ($lastColor)
$s .= "</bg>";
+ $s .= "\033[0m";
$c = count($results);
if ($numTests)
- $s .= str_repeat(" ", $numTests - $c) . " $c/$numTests]";
+ $s .= " $c/$numTests]";
else
$s .= " $c]";
return phutil_console_format($s);
@@ -99,9 +117,9 @@ final class LitTestEngine extends Arcani
$numTests = (int)$matches[1];
}
if ($res == ArcanistUnitTestResult::RESULT_FAIL)
- print "\033[1A";
+ print "\033[0A";
if ($res != ArcanistUnitTestResult::RESULT_SKIP && $res != ArcanistUnitTestResult::RESULT_PASS)
- print "\r\033[K\033[1A".$line.self::progress($results, $numTests);
+ print "\r\033[K\033[0A".$line.self::progress($results, $numTests);
if ($res == ArcanistUnitTestResult::RESULT_UNSOUND)
continue;
$result = new ArcanistUnitTestResult();
@@ -112,7 +130,7 @@ final class LitTestEngine extends Arcani
$lastTime = $newTime;
$results[] = $result;
$dots .= ".";
- print "\r\033[K\033[1A".self::progress($results, $numTests);
+ print "\r\033[K\033[0A".self::progress($results, $numTests);
}
}
list ($out1,$out2) = $litFuture->read();
@@ -122,7 +140,15 @@ final class LitTestEngine extends Arcani
}
print "\n";
- return $results;
+ $timeThreshold = 0.050;
+ $interestingTests = array();
+ foreach ($results as $result) {
+ if ($result->getResult() != "pass")
+ $interestingTests[] = $result;
+ if ($result->getDuration() > $timeThreshold)
+ $interestingTests[] = $result;
+ }
+ return $interestingTests;
}
/**
More information about the llvm-commits
mailing list