Commit c4a29865 authored by norvell's avatar norvell
Browse files

Cleanup of parse_command.py

parent 2f113327
Loading
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ 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)
@@ -60,7 +62,7 @@ if __name__ == '__main__':
                    elif "Running ISAR post renderer command" in line:
                        isar_post_rend_cmd = True                                             

    # Remove HTML tags
    # 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]

@@ -71,6 +73,7 @@ if __name__ == '__main__':
    cmds_isar_post_rend.sort()

    # Remove duplicates from cmds_enc -- some decoder tests use same encoder options
    # Relies on the list being sorted
    i = 0
    while i + 1 < len(cmds_enc):
        if " ".join(cmds_enc[i].split()[:-1]) == " ".join(cmds_enc[i+1].split()[:-1]):
@@ -152,9 +155,9 @@ if __name__ == '__main__':
                    diff_cmds.append('$DIFF_BIN '+output.replace(CUT_PATH, REF_PATH)+' '+output+' >> $LOG_FILE 2>&1')
                outfile.write(('; ').join(diff_cmds))
            if isar_out and "ref" in isar_out.group(1):
                outfile.write('$DIFF_BIN '+isar_out.group(1).replace(CUT_PATH + r'/split_rendering/ref',REF_PATH + r'/split_rendering/ref')+' '+isar_out.group(1)+' >> $LOG_FILE 2>&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 + r'/split_rendering/ref',REF_PATH + r'/split_rendering/ref')+' '+isar_md_out.group(1)+' >> $LOG_FILE 2>&1\n')
                    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('\n')
            outfile.write('\n\n')
@@ -202,7 +205,7 @@ if __name__ == '__main__':
                    arg = re.sub('ISAR_post_rend_ref(.exe)?', '$CUT_ISAR_POST_REND_BIN', arg)
                    arg = re.sub('scripts', TESTV_PATH, arg)
                    if re.search("^tests.*bit$",arg):
                        arg = re.sub('tests/split_rendering/ref', REF_PATH + r'/split_rendering/ref', arg)
                        arg = re.sub('tests', REF_PATH, arg)
                    arg = re.sub('tests', CUT_PATH, arg)
                args.append(arg)
            cmd = ' '.join(args)
@@ -211,7 +214,7 @@ if __name__ == '__main__':
                outfile.write(cmd+'\n')
            out = re.search(r"-o\s(([\S]+)(.wav|.raw|.pcm))", cmd)
            if out and "ref" in out.group(1):
                outfile.write('$DIFF_BIN '+out.group(1).replace(CUT_PATH + r'/split_rendering/ref',REF_PATH + r'/split_rendering/ref')+' '+out.group(1)+' >> $LOG_FILE 2>&1\n')
                outfile.write('$DIFF_BIN '+out.group(1).replace(CUT_PATH, REF_PATH)+' '+out.group(1)+' >> $LOG_FILE 2>&1\n')
                outfile.write('\n')            
        with open('scripts/script_footer.txt','r') as footer:
            outfile.write(footer.read())