New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add colours to run-test #5901
Add colours to run-test #5901
Conversation
I like that very much, but at least for Windows it would make sense to check |
The command line option is indeed something which I should add. Just to be clear in regards to Windows, as I'm not familiar with it's console env, I should not print the ANSI escape code in case VT100 is not support and default back to the previous behaviour? |
I did the same in my own extension, hope this help :) // namespace XXX;
const COLOR_NONE = 0;
const COLOR_RED = 1;
const COLOR_GREEN = 2;
const COLOR_YELLOW = 3;
const COLOR_BLUE = 4;
const COLOR_MAGENTA = 5;
const COLOR_CYAN = 6;
const COLOR_WHITE = 7;
function dye(string $string, int $color): string
{
// check if it is available here?
return ($color !== COLOR_NONE ? "\033[3{$color}m{$string}\033[0m" : $string);
} BTW, isn't |
Yes. :) |
ec1c9b2
to
3670358
Compare
Added checks for Windows and added a Dark Blue colouring for LEAK. |
Should the American spelling of color be used? That seems to be the typical spelling elsewhere in the source code: https://github.com/php/php-src/search?q=color |
I agree, we tend to use more Americanized naming, would prefer to stick to that for consistency |
The Windows specific changes look good to me. I also would prefer the American English spelling. |
Will use the Americanized version the. |
@Girgias If our CIs support it and it looks good, then I do not see why not |
3670358
to
3ec8e70
Compare
Just looks like AppVeyor doesn't enable VT100, and Travis and Azure only show skipped/XFAIL/FAIL so seems reasonable to keep it on CI |
run-tests.php
Outdated
@@ -114,6 +114,8 @@ function show_usage() | |||
|
|||
--no-clean Do not execute clean section if any. | |||
|
|||
--no-color Do not colorise the result type in the test result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
colorise should be colorize (here and elsewhere)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run-tests.php
Outdated
case 'PASS': // Light Green | ||
$color = "\e[1;32m{$result}\e[0m"; break; | ||
case 'SKIP': // Light Gray | ||
$color = "\e[0;37m{$result}"; break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing
$color = "\e[0;37m{$result}"; break; | |
$color = "\e[0;37m{$result}\e[0m"; break; |
?
1c7fb6e
to
2bef7cd
Compare
FWIW, the AppVeyor CI failure is unrelated to this PR. |
run-tests.php
Outdated
case 'PASS': // Light Green | ||
$color = "\e[1;32m{$result}\e[0m"; break; | ||
case 'SKIP': // Light Gray | ||
$color = "\e[0;37m{$result}\e[0m"; break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ends up being pretty much the same as the normal text color :/ Maybe use yellow or orange?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, let this fall through the the default case that also handles XFAIL. XFAIL and SKIP seems pretty similar.
run-tests.php
Outdated
case 'BORK': // Purple | ||
$color = "\e[0;35m{$result}\e[0m"; break; | ||
case 'LEAK': // Dark Blue | ||
$color = "\e[2;34m{$result}\e[0m"; break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just make all of these red, they're all effectively a failure.
run-tests.php
Outdated
$color = "\e[1;33m{$result}\e[0m"; break; | ||
} | ||
|
||
echo "$color $tested [$tested_file] $extra\e[0m\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there an \e[0m
here?
The test runner will attempt to colourise the result of each test The --no-color option is introduced to disable this feature.
2bef7cd
to
b75bd31
Compare
echo "$result $tested [$tested_file] $extra\n"; | ||
if ($colorize) { | ||
/* Use ANSI escape codes for coloring test result */ | ||
switch ( $result ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch ( $result ) { | |
switch ($result) { |
Based from: xdebug/xdebug@296f31d
Not sure if "BORK" actually deserves it's special category/colour