-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use colored output with GCC and Clang
The flag -fdiagnostics-color=always is added to the :standard set of flags for C stubs, which can be easily removed by the user if needed. Signed-off-by: Antonin Décimo <antonin@tarides.com>
- Loading branch information
Showing
6 changed files
with
72 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
test/blackbox-tests/test-cases/c-flags-diagnostics-color.t/dune-project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(lang dune 3.5) |
47 changes: 47 additions & 0 deletions
47
test/blackbox-tests/test-cases/c-flags-diagnostics-color.t/run.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
We also have to force Dune outputting colors, for that we use | ||
`CLICOLOR_FORCE=1`. | ||
|
||
The flag should be present in the command, as we want it in the | ||
:standard set. | ||
|
||
test, color enabled, color flag default (enabled) | ||
================================================= | ||
|
||
$ cat >dune <<EOF | ||
> (library | ||
> (name test) | ||
> (foreign_stubs (language c) (names stub))) | ||
> EOF | ||
|
||
$ CLICOLOR_FORCE=1 dune rules -m stub.o | grep -ce "-fdiagnostics-color=always" | ||
1 | ||
|
||
test, color enabled, color flag disabled | ||
======================================== | ||
|
||
$ cat >dune <<EOF | ||
> (library | ||
> (name test) | ||
> (foreign_stubs | ||
> (flags :standard \ -fdiagnostics-color=always) | ||
> (language c) (names stub))) | ||
> EOF | ||
|
||
$ CLICOLOR_FORCE=1 dune rules -m stub.o | grep -ce "-fdiagnostics-color=always" | ||
0 | ||
[1] | ||
|
||
test, color disabled, color flag default (enabled) | ||
================================================== | ||
|
||
$ cat >dune <<EOF | ||
> (library | ||
> (name test) | ||
> (foreign_stubs | ||
> (flags :standard) | ||
> (language c) (names stub))) | ||
> EOF | ||
|
||
$ CLICOLOR=0 dune rules -m stub.o | grep -ce "-fdiagnostics-color=always" | ||
0 | ||
[1] |
1 change: 1 addition & 0 deletions
1
test/blackbox-tests/test-cases/c-flags-diagnostics-color.t/stub.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#error "error message" |