diff options
author | Zubin Duggal <zubin.duggal@gmail.com> | 2021-11-23 13:47:58 +0530 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-11-25 01:08:54 -0500 |
commit | 5428b8c689111c11a71c81ffb58b617d3158634f (patch) | |
tree | 59320050ccf979337416c94b9ee598b2f7a4f1f8 | |
parent | 8961d632f34cffd90594406c697712d9dde4a626 (diff) | |
download | haskell-5428b8c689111c11a71c81ffb58b617d3158634f.tar.gz |
testsuite: debounce title updates
-rw-r--r-- | testsuite/driver/testlib.py | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 667d743e0b..1f525234e4 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -32,6 +32,8 @@ extra_src_files = {'T4198': ['exitminus1.c']} # TODO: See #12223 from my_typing import * +from threading import Timer + global pool_sema if config.use_threads: import threading @@ -40,6 +42,23 @@ if config.use_threads: global wantToStop wantToStop = False +global title_update_timer +title_update_timer = None + +# Update terminal title +# useful progress indicator even when make test VERBOSE=1 +# Debounce the updates to avoid spamming them. +def update_terminal_title(progress_args): + global title_update_timer + if config.supports_colors: + def worker(): + print("\033]0;{0} {1} of {2} {3}\007".format(*progress_args), end="") + sys.stdout.flush() + if title_update_timer: + title_update_timer.cancel() + title_update_timer=Timer(0.05,worker) + title_update_timer.start() + # I have no idea what the type of this is global thisdir_settings thisdir_settings = None # type: ignore @@ -1173,11 +1192,7 @@ def do_test(name: TestName, else: if_verbose(3, "=====> {0} {1} of {2} {3}".format(*progress_args)) - # Update terminal title - # useful progress indicator even when make test VERBOSE=1 - if config.supports_colors: - print("\033]0;{0} {1} of {2} {3}\007".format(*progress_args), end="") - sys.stdout.flush() + update_terminal_title(progress_args) # Clean up prior to the test, so that we can't spuriously conclude # that it passed on the basis of old run outputs. |