Mesa (main): radeonsi/test: prettier output

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 12 10:03:59 UTC 2021


Module: Mesa
Branch: main
Commit: a92367209fb67729c5ba955afdea36af1fd98ace
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a92367209fb67729c5ba955afdea36af1fd98ace

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Tue Aug 10 15:30:40 2021 +0200

radeonsi/test: prettier output

Acked-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12306>

---

 .../drivers/radeonsi/ci/radeonsi-run-tests.py      | 29 +++++++++++++++-------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/ci/radeonsi-run-tests.py b/src/gallium/drivers/radeonsi/ci/radeonsi-run-tests.py
index d7fbebac27c..5b386b26bef 100755
--- a/src/gallium/drivers/radeonsi/ci/radeonsi-run-tests.py
+++ b/src/gallium/drivers/radeonsi/ci/radeonsi-run-tests.py
@@ -35,12 +35,16 @@ import multiprocessing
 import csv
 
 
-def print_red(txt, end_line=True):
-    print("\033[0;31m", txt, "\033[0m", end="\n" if end_line else " ")
+def print_red(txt, end_line=True, prefix=None):
+    if prefix:
+        print(prefix, end="")
+    print("\033[0;31m{}\033[0m".format(txt), end="\n" if end_line else " ")
 
 
-def print_yellow(txt, end_line=True):
-    print("\033[1;33m", txt, "\033[0m", end="\n" if end_line else " ")
+def print_yellow(txt, end_line=True, prefix=None):
+    if prefix:
+        print(prefix, end="")
+    print("\033[1;33m{}\033[0m".format(txt), end="\n" if end_line else " ")
 
 
 parser = argparse.ArgumentParser(description="radeonsi tester")
@@ -163,8 +167,12 @@ spin = itertools.cycle("-\\|/")
 
 
 def run_cmd(args, verbosity, env=None):
-    if verbosity > 0:
-        print_yellow("Running ", args)
+    if verbosity > 1:
+        print_yellow(
+            "| Command line argument '"
+            + " ".join(['"{}"'.format(a) for a in args])
+            + "'"
+        )
     start = datetime.now()
     proc = subprocess.Popen(
         args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env
@@ -173,9 +181,9 @@ def run_cmd(args, verbosity, env=None):
         line = proc.stdout.readline().decode()
         if verbosity > 0:
             if "ERROR" in line:
-                print_red(line.strip())
+                print_red(line.strip(), prefix="| ")
             else:
-                print(line.strip())
+                print("| " + line.strip())
         else:
             sys.stdout.write(next(spin))
             sys.stdout.flush()
@@ -191,7 +199,10 @@ def run_cmd(args, verbosity, env=None):
     if verbosity == 0:
         sys.stdout.write(" ... ")
 
-    print_yellow("Completed in {} seconds".format(int((end - start).total_seconds())))
+    print_yellow(
+        "Completed in {} seconds".format(int((end - start).total_seconds())),
+        prefix="└ " if verbosity > 0 else None,
+    )
 
 
 def verify_results(baseline1, baseline2):



More information about the mesa-commit mailing list