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

ptest: Don't output colors unconditionally #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

ptest: Don't output colors unconditionally #6

wants to merge 1 commit into from

Conversation

nmeum
Copy link

@nmeum nmeum commented Apr 23, 2020

Started using ptest for an mpc-parser because it was used in mpc itself.
While running my ptest parser test suite on a CI I noticed that ptest
outputs colors unconditionally. This change only outputs colors if the
TERM variable is not set to dumb and standard output is a TTY.

I obviously didn't test this change on WIN32.


Also make outputs a bunch of errors on my system currently:

example.c: In function 'suite_basic':
example.c:5:11: error: trampoline generated for nested function 'test_maths' [-Werror=trampolines]
    5 |   PT_TEST(test_maths) {
      |           ^~~~~~~~~~
ptest.h:10:64: note: in definition of macro 'PT_TEST'
   10 | #define PT_TEST(name) auto void name(void); PT_REG(name); void name(void)
      |                                                                ^~~~
example.c:14:11: error: trampoline generated for nested function 'test_strings' [-Werror=trampolines]
   14 |   PT_TEST(test_strings) {
      |           ^~~~~~~~~~~~
ptest.h:10:64: note: in definition of macro 'PT_TEST'
   10 | #define PT_TEST(name) auto void name(void); PT_REG(name); void name(void)
      |                                                                ^~~~
example.c: In function 'suite_other':
example.c:22:11: error: trampoline generated for nested function 'test_stuff' [-Werror=trampolines]
   22 |   PT_TEST(test_stuff) {
      |           ^~~~~~~~~~
ptest.h:10:64: note: in definition of macro 'PT_TEST'
   10 | #define PT_TEST(name) auto void name(void); PT_REG(name); void name(void)
      |                                                                ^~~~
example.c:28:11: error: trampoline generated for nested function 'test_failure' [-Werror=trampolines]
   28 |   PT_TEST(test_failure) {
      |           ^~~~~~~~~~~~
ptest.h:10:64: note: in definition of macro 'PT_TEST'
   10 | #define PT_TEST(name) auto void name(void); PT_REG(name); void name(void)
      |                                                                ^~~~
cc1: all warnings being treated as errors
make: *** [Makefile:8: example] Error 1

Started using ptest for an mpc-parser because it was used in mpc itself.
While running my ptest parser test suite on our CI I noticed that ptest
outputs colors unconditionally. This change only outputs colors if the
TERM variable is not set to `dumb` and standard output is a TTY.

I obviously didn't test this change on WIN32.
@nmeum nmeum changed the title ptest: Don't output colors intentionally ptest: Don't output colors unconditionally Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant