twister: improve the alignment of columns in verbose output
This commit improves the alignment of columns in the verbose Twister output by reclaiming extra space in the testsuite name column when the platform name oveflows its allocated width. Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This commit is contained in:
parent
d26ed348ef
commit
2d264618bc
1 changed files with 11 additions and 2 deletions
|
@ -1553,6 +1553,15 @@ class ProjectBuilder(FilterBuilder):
|
|||
f'{TwisterStatus.get_color(instance.status)}{str.upper(instance.status)}{Fore.RESET}'
|
||||
)
|
||||
|
||||
def name_columns(instance, plat_width, ts_width):
|
||||
# try to compensate for a platform name longer than plat_width
|
||||
# by reclaiming extra spaces after the testsuite name, if any
|
||||
plat_name = instance.platform.name
|
||||
ts_name = instance.testsuite.name
|
||||
plat_extra = max(0, len(plat_name) - plat_width)
|
||||
ts_width = max(0, ts_width - plat_extra)
|
||||
return f"{plat_name:<{plat_width}} {ts_name:<{ts_width}}"
|
||||
|
||||
if instance.status in [TwisterStatus.ERROR, TwisterStatus.FAIL]:
|
||||
if instance.status == TwisterStatus.ERROR:
|
||||
results.error_increment()
|
||||
|
@ -1562,7 +1571,7 @@ class ProjectBuilder(FilterBuilder):
|
|||
status += " " + instance.reason
|
||||
else:
|
||||
logger.error(
|
||||
f"{instance.platform.name:<25} {instance.testsuite.name:<50}"
|
||||
f"{name_columns(instance, 25, 50)}"
|
||||
f" {status}: {instance.reason}"
|
||||
)
|
||||
if not self.options.verbose:
|
||||
|
@ -1603,7 +1612,7 @@ class ProjectBuilder(FilterBuilder):
|
|||
more_info += f" <{instance.toolchain}>"
|
||||
logger.info(
|
||||
f"{results.done - results.filtered_static:>{total_tests_width}}/{total_to_do}"
|
||||
f" {instance.platform.name:<25} {instance.testsuite.name:<50}"
|
||||
f" {name_columns(instance, 25, 50)}"
|
||||
f" {status} ({more_info})"
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue