Commit 0edf5760 authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

fix incorrect parsing of ISAR EXT rend commands

parent d6fed386
Loading
Loading
Loading
Loading
Loading
+21 −7
Original line number Diff line number Diff line
@@ -35,11 +35,27 @@ if __name__ == '__main__':
    for html_report in input:
        
        with open(html_report,'r') as infile:
            for line in infile.readlines():
            lines = infile.readlines()
            for idx, line in enumerate(lines):
                    # parse encoder and decoder commands
                    cmds_enc.extend(re.findall(r"REF encoder command:\\n\\t(.*?)\\n", line))
                    cmds_dec.extend(re.findall(r"REF decoder command:\\n\\t(.*?)\\n", line))

                    # parse renderer commands, including ISAR EXT REND commands (the next line contains IVAS_rend or IVAS_rend_ref)
                    cmds_rend.extend(re.findall(r"Running command\\n(.*?)\\n", line))
                    next_line = lines[idx + 1] if idx + 1 < len(lines) else ""
                    if (
                        "Running ISAR EXT REND command" in line
                        and ("IVAS_rend" in next_line or "IVAS_rend_ref" in next_line)
                    ):
                        cmds_rend.extend(re.findall(r"Running ISAR EXT REND command\\n(.*?)\\n", line))

                    # parse ISAR post renderer commands, including ISAR EXT REND commands (the next line contains ISAR_post_rend or ISAR_post_rend_ref)
                    cmds_isar_post_rend.extend(re.findall(r"Running ISAR post renderer command\\n(.*?)\\n", line))
                    if (
                        "Running ISAR EXT REND command" in line
                        and ("ISAR_post_rend" in next_line or "ISAR_post_rend_ref" in next_line)
                    ):
                        cmds_isar_post_rend.extend(re.findall(r"Running ISAR EXT REND command\\n(.*?)\\n", line))

    # If pytest-html < v4 is used, the parsing will fail and render empty lists. This is a work-around in case that happens.
@@ -170,10 +186,8 @@ if __name__ == '__main__':
            if isar_out and "ref" in isar_out.group(1):
                outfile.write('$DIFF_BIN '+isar_out.group(1).replace(CUT_PATH, REF_PATH)+' '+isar_out.group(1)+' >> $LOG_FILE 2>&1')
                if isar_md_out and "ref" in isar_md_out.group(1):
                    outfile.write('; $DIFF_BIN '+isar_md_out.group(1).replace(CUT_PATH, REF_PATH)+' '+isar_md_out.group(1)+' >> $LOG_FILE 2>&1\n')
                else:
                    outfile.write('; $DIFF_BIN '+isar_md_out.group(1).replace(CUT_PATH, REF_PATH)+' '+isar_md_out.group(1)+' >> $LOG_FILE 2>&1')
            outfile.write('\n')
            outfile.write('\n\n')
        with open('scripts/script_footer.txt','r') as footer:
            outfile_dec.write(footer.read())    
            footer.seek(0)
@@ -208,7 +222,7 @@ if __name__ == '__main__':
                for output in glob.glob(absolute_out.group(1) + '*'):
                    output = path.relpath(output).replace('\\','/')
                    output = re.sub('tests', CUT_PATH, output)
                    diff_cmds.append('$DIFF_BIN '+output.replace(CUT_PATH + r'/renderer_short/ref',REF_PATH + r'/renderer_short/ref')+' '+ output +' >> $LOG_FILE 2>&1')
                    diff_cmds.append('$DIFF_BIN '+output.replace(CUT_PATH + r'/renderer_short/ref',REF_PATH + r'/renderer_short/ref')+' '+ output +' >> $LOG_FILE 2>&1\n')
                outfile.write(('; ').join(diff_cmds))
                outfile.write('\n')            
        with open('scripts/script_footer.txt','r') as footer: