]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tests: all errors go to log (and thus stderr)
authorChristian Hopps <chopps@labn.net>
Wed, 29 May 2024 12:07:47 +0000 (08:07 -0400)
committerChristian Hopps <chopps@labn.net>
Fri, 31 May 2024 09:16:22 +0000 (05:16 -0400)
Only output requested information to stdout so it can be
filtered and captured in shell variables etc...

Signed-off-by: Christian Hopps <chopps@labn.net>
tests/topotests/analyze.py

index 690786a07c53bb3f867cb126c5bf58d7336781c1..a1ac9a2212bb1dde70d4e063d906fd9997dc05d5 100755 (executable)
@@ -262,7 +262,7 @@ def main():
                 capture_output=True,
             )
         except subprocess.CalledProcessError:
-            print(f"{docker_bin} container '{contid}' does not exist")
+            logging.critical(f"{docker_bin} container '{contid}' does not exist")
             sys.exit(1)
         # If you need container info someday...
         # cont_info = json.loads(p.stdout)
@@ -278,7 +278,7 @@ def main():
     if scount and args.results and not os.path.exists(args.results):
         if not contid:
             if not os.path.exists(cppath):
-                print(f"'{cppath}' doesn't exist to save")
+                logging.critical(f"'{cppath}' doesn't exist to save")
                 sys.exit(1)
             if args.save_xml:
                 subprocess.run(["cp", cppath, args.results])
@@ -294,7 +294,7 @@ def main():
                     capture_output=True,
                 )
             except subprocess.CalledProcessError as error:
-                print(f"Can't {docker_bin} cp '{cppath}': %s", str(error))
+                logging.critical(f"Can't {docker_bin} cp '{cppath}': %s", str(error))
                 sys.exit(1)
 
         if "SUDO_USER" in os.environ:
@@ -303,7 +303,7 @@ def main():
         # User doesn't want to save results just use them inplace
         if not contid:
             if not os.path.exists(cppath):
-                print(f"'{cppath}' doesn't exist")
+                logging.critical(f"'{cppath}' doesn't exist")
                 sys.exit(1)
             args.results = cppath
         else:
@@ -321,7 +321,7 @@ def main():
                     capture_output=True,
                 )
             except subprocess.CalledProcessError as error:
-                print(f"Can't {docker_bin} cp '{cppath}': %s", str(error))
+                logging.critical(f"Can't {docker_bin} cp '{cppath}': %s", str(error))
                 sys.exit(1)
             args.results = tresname