Commit 1584d065 authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

add IVAS ISAR encoder command and ISAR EXT REND command

parent 1abd1b07
Loading
Loading
Loading
Loading
Loading
+36 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ if __name__ == '__main__':
    cmds_enc=[]
    cmds_dec=[]
    cmds_rend=[]
    cmds_isar_enc=[]
    cmds_isar_post_rend=[]


@@ -38,15 +39,18 @@ if __name__ == '__main__':
                    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_enc.extend(re.findall(r"Running IVAS ISAR encoder command\\n(.*?)\\n", line))
                    cmds_isar_post_rend.extend(re.findall(r"Running ISAR post renderer command\\n(.*?)\\n", 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.
    if all(not x for x in [cmds_enc, cmds_dec, cmds_rend, cmds_isar_post_rend]):
    if all(not x for x in [cmds_enc, cmds_dec, cmds_rend, cmds_isar_enc, cmds_isar_post_rend]):
        for html_report in input:
            with open(html_report,'r') as infile:
                enc_cmd = False
                dec_cmd = False
                rend_cmd = False
                isar_enc_cmd = False
                isar_post_rend_cmd = False
                for line in infile.readlines():
                    line = line.split("<br/>")[0] # Remove trailing html tags
@@ -59,6 +63,9 @@ if __name__ == '__main__':
                    elif rend_cmd:
                        cmds_rend.append(line)
                        rend_cmd = False                         
                    elif isar_enc_cmd:
                        cmds_isar_enc.append(line)
                        isar_enc_cmd = False                         
                    elif isar_post_rend_cmd:
                        cmds_isar_post_rend.append(line)
                        isar_post_rend_cmd = False                        
@@ -69,13 +76,18 @@ if __name__ == '__main__':
                            dec_cmd = True
                        elif "Running command" in line:
                            rend_cmd = True                             
                        elif "Running IVAS ISAR encoder command" in line:
                            isar_enc_cmd = True                            
                        elif "Running ISAR post renderer command" in line:
                            isar_post_rend_cmd = True                            
                        elif "Running ISAR EXT REND command" in line:
                            isar_post_rend_cmd = True                            

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

    with open(txt_file.replace('.','_enc.'),'w', newline='\n') as outfile:
@@ -100,6 +112,28 @@ if __name__ == '__main__':
        with open('scripts/script_footer.txt','r') as footer:
            outfile.write(footer.read())                        

    with open(txt_file.replace('.','_ISAR_enc.'),'w', newline='\n') as outfile:
        with open('scripts/enc_isar_header.txt','r') as header:
            outfile.write(header.read())
        for cmd in cmds_isar_enc:
            args = []
            for arg in cmd.split():
                # Adjust file arguments, pass other arguments as they are
                if path.exists(arg):
                    arg = path.relpath(arg).replace('\\','/')
                    arg = re.sub('IVAS_cod(.exe)?', '$CUT_ENC_BIN', arg)
                    arg = re.sub('scripts', TESTV_PATH, arg)
                    arg = re.sub('tests', CUT_PATH, arg)
                args.append(arg)
            cmd = ' '.join(args)
            outfile.write(cmd+'\n')
            bts = re.search(r"\s(([\S]+)(.bts|.192|.pkt|.fer))$", cmd)
            if bts:
                outfile.write('$DIFF_BIN '+bts.group(1).replace(CUT_PATH + r'/dut',REF_PATH + r'/ref')+' '+bts.group(1)+' >> $LOG_FILE 2>&1\n')
            outfile.write('\n')
        with open('scripts/script_footer.txt','r') as footer:
            outfile.write(footer.read())                        

    with open(txt_file.replace('.','_dec.'),'w', newline='\n') as outfile_dec, open(txt_file.replace('.','_JBM_dec.'),'w', newline='\n') as outfile_jbm, open(txt_file.replace('.','_ISAR_dec.'),'w', newline='\n') as outfile_isar:
        with open('scripts/dec_header.txt','r') as header:
            outfile_dec.write(header.read())