Commit 658e7668 authored by norvell's avatar norvell
Browse files

Revert to old html parsing in parse_commands.py. Seems to work better on Windows runners

parent 31a32c69
Loading
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -24,12 +24,10 @@ if __name__ == '__main__':

    with open(input,'r') as infile:
        report = infile.read()

        # Try finding all command lines. May fail if the pytest-html version does not produce a multiple line output.
        cmds_enc = re.findall(r'REF encoder command:\s*\n\s*(\S.*)', report, re.MULTILINE)
        cmds_dec = re.findall(r'REF decoder command:\s*\n\s*(\S.*)', report, re.MULTILINE)
        cmds_rend = re.findall(r'Running command\s*\n\s*(\S.*)', report, re.MULTILINE)
        cmds_isar_post_rend = re.findall(r'Running ISAR post renderer command\s*\n\s*(\S.*)', report, re.MULTILINE)
        cmds_enc = []
        cmds_dec = []
        cmds_rend = []
        cmds_isar_post_rend = []

        # Depending on pytest-html version, the data may be in a json-blob. If so, the code below should handle this format.
        if all(not x for x in [cmds_enc, cmds_dec, cmds_rend, cmds_isar_post_rend]):
@@ -62,10 +60,22 @@ if __name__ == '__main__':
                    elif "Running ISAR post renderer command" in line:
                        isar_post_rend_cmd = True                                             

    # If the above reading failed, try this variant instead.
    if all(not x for x in [cmds_enc, cmds_dec, cmds_rend, cmds_isar_post_rend]):
        with open(input,'r') as infile:
            for line in infile.readlines():
                    cmds_enc.extend(re.findall(r"DUT encoder command:\\n\\t(.*?)\\n", line))
                    cmds_dec.extend(re.findall(r"DUT decoder command:\\n\\t(.*?)\\n", line))
                    cmds_rend.extend(re.findall(r"Running command\\n(.*?)\\n", line))
                    cmds_isar_post_rend.extend(re.findall(r"Running ISAR post renderer command\\n(.*?)\\n", line))


    # Remove trailing HTML tags, if any
    cmds_rend = [x.split('<')[0] for x in cmds_rend]
    cmds_isar_post_rend = [x.split('<')[0] for x in cmds_isar_post_rend]



    # Sort lists to keep deterministic order between runs
    cmds_enc.sort()
    cmds_dec.sort()