]> git.proxmox.com Git - mirror_frr.git/blobdiff - tests/topotests/analyze.py
Merge pull request #12791 from taspelund/loc_rib_json_fix
[mirror_frr.git] / tests / topotests / analyze.py
index 888e706339b2d8966905d57a4174042b82dc5ce6..360c9cf1e9e165c7bc94bb771e549ee69826fa89 100755 (executable)
@@ -1,24 +1,11 @@
 #!/usr/bin/env python3
 # -*- coding: utf-8 eval: (blacken-mode 1) -*-
+# SPDX-License-Identifier: GPL-2.0-or-later
 #
 # July 9 2021, Christian Hopps <chopps@labn.net>
 #
 # Copyright (c) 2021, LabN Consulting, L.L.C.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; see the file COPYING; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
 import argparse
 import glob
 import logging
@@ -115,6 +102,9 @@ def dump_testcase(testcase):
     for key, val in testcase.items():
         if isinstance(val, str) or isinstance(val, float) or isinstance(val, int):
             s += "{}: {}\n".format(key, val)
+        elif isinstance(val, list):
+            for k2, v2 in enumerate(val):
+                s += "{}: {}\n".format(k2, v2)
         else:
             for k2, v2 in val.items():
                 s += "{}: {}\n".format(k2, v2)
@@ -198,9 +188,12 @@ def main():
                 logging.critical("%s doesn't exist", args.results)
                 sys.exit(1)
             ttfiles = [args.results]
+        elif os.path.exists("/tmp/topotests/topotests.xml"):
+            ttfiles.append("/tmp/topotests/topotests.xml")
 
-        if not ttfiles and os.path.exists("/tmp/topotests.xml"):
-            ttfiles.append("/tmp/topotests.xml")
+        if not ttfiles:
+            if os.path.exists("/tmp/topotests.xml"):
+                ttfiles.append("/tmp/topotests.xml")
 
     for f in ttfiles:
         m = re.match(r"tt-group-(\d+)/topotests.xml", f)