mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 15:14:44 +00:00
cmake: Force color in the tests
For littlecheck/pexpect this just unconditionally enables color. I have no idea what happens if you run cmake outside of a terminal , but the worst that can happen is that *errors* have color escapes in them. If someone figures out how to get cmake to tell us if it's running in a terminal, we can add a check.
This commit is contained in:
parent
aa17ed51ce
commit
23e6698dc8
4 changed files with 15 additions and 4 deletions
|
@ -688,6 +688,13 @@ def get_argparse():
|
|||
help="Show the files to be checked",
|
||||
default=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--force-color",
|
||||
action="store_true",
|
||||
dest="force_color",
|
||||
help="Force usage of color even if not connected to a terminal",
|
||||
default=False,
|
||||
)
|
||||
parser.add_argument("file", nargs="+", help="File to check")
|
||||
return parser
|
||||
|
||||
|
@ -702,7 +709,7 @@ def main():
|
|||
failed = False
|
||||
skip_count = 0
|
||||
config = Config()
|
||||
config.colorize = sys.stdout.isatty()
|
||||
config.colorize = args.force_color or sys.stdout.isatty()
|
||||
config.progress = args.progress
|
||||
fields = config.colors()
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ class SpawnedProc(object):
|
|||
if name not in env:
|
||||
raise ValueError("'%s' variable not found in environment" % name)
|
||||
exe_path = env.get(name)
|
||||
self.colorize = sys.stdout.isatty()
|
||||
self.colorize = sys.stdout.isatty() or env.get("FISH_FORCE_COLOR", "0") == "1"
|
||||
self.messages = []
|
||||
self.start_time = None
|
||||
self.spawn = pexpect.spawn(exe_path, env=env, encoding="utf-8", timeout=timeout, **kwargs)
|
||||
|
|
|
@ -34,7 +34,7 @@ if(POLICY CMP0037)
|
|||
cmake_policy(SET CMP0037 OLD)
|
||||
endif()
|
||||
add_custom_target(test
|
||||
COMMAND env CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL}
|
||||
COMMAND env CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL} FISH_FORCE_COLOR=1
|
||||
${CMAKE_CTEST_COMMAND} --force-new-ctest-process
|
||||
--output-on-failure --progress
|
||||
DEPENDS fish_tests tests_buildroot_target
|
||||
|
|
|
@ -30,8 +30,12 @@ set -g python (__fish_anypython)
|
|||
set -l skipped 0
|
||||
set -l failed 0
|
||||
if set -q files_to_test[1]
|
||||
set -l force_color
|
||||
test "$FISH_FORCE_COLOR" = 1
|
||||
and set force_color --force-color
|
||||
|
||||
$python -S ../littlecheck.py \
|
||||
--progress \
|
||||
--progress $force_color \
|
||||
-s fish=../test/root/bin/fish \
|
||||
-s fish_test_helper=../test/root/bin/fish_test_helper \
|
||||
$files_to_test
|
||||
|
|
Loading…
Reference in a new issue