Skip to content
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

ISPN-8414 Colored testsuite progress #5520

Merged

Conversation

tristantarrant
Copy link
Member

@tristantarrant
Copy link
Member Author

Need to find a way to suppress colors when running in CI

private final boolean useColor;

public TestSuiteProgress() {
useColor = System.getenv("JENKINS_HOME") == null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is really necessary... jansi uses isatty to avoid writing the escape codes when output is redirected.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I see that isatty check is in AnsiConsole, and you're not using it... still, when I run the build from my Python script (which uses Popen to parse the output and set the test count in the title), the colours just disappear.

@tristantarrant
Copy link
Member Author

Checking isatty is pointless, since we use surefire's fork which filters the output. In fact System.console() returns null when running the testsuite.
Can I have your Python script so I can check ?

@danberindei
Copy link
Member

danberindei commented Oct 20, 2017

@tristantarrant I forgot surefire is already doing one redirect... but that makes the fact that ./build.sh -pl commons | tee build.log doesn't show any colors on the terminal or escapes in the file even more confusing. Maybe it's zsh being extra helpful...

You could avoid the Jenkins-specific check by using -Dansi.strip, like AnsiConsole does. And to skip the H , in IDEs, you could check for -Dinfinispan.module-suffix.

@tristantarrant
Copy link
Member Author

@danberindei I have made some changes:

  • use -Djansi.strip (added to Jenkinsfile) to explicitly avoid colors
  • if output has been not been redirected, print directly without the magic H , prefix

@danberindei danberindei merged commit a265049 into infinispan:master Oct 23, 2017
@danberindei
Copy link
Member

Integrated, thanks Tristan!

@tristantarrant tristantarrant deleted the ISPN-8414/jansi_test_progress branch April 10, 2018 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants