diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e382280..8da376f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,13 +58,11 @@ jobs: python tools/make_example.py python tools/extract_code.py "bin/test.copapy" "bin/test.copapy.bin" objdump -D -b binary -m i386:x86-64 --adjust-vma=0x1000 bin/test.copapy.bin > bin/test.copapy.asm - echo '
test.copapy.asm
' >> $GITHUB_STEP_SUMMARY - cat bin/test.copapy.asm >> $GITHUB_STEP_SUMMARY - echo '' >> $GITHUB_STEP_SUMMARY - objdump -d -j .text src/copapy/obj/stencils_x86_64_O3.o > bin/stencils_x86_64_O3.asm - echo '
stencils_x86_64_O3.asm
' >> $GITHUB_STEP_SUMMARY - cat bin/stencils_x86_64_O3.asm >> $GITHUB_STEP_SUMMARY - echo '' >> $GITHUB_STEP_SUMMARY + echo '
test.copapy.asm
' >> $GITHUB_STEP_SUMMARY + python tools/clean_asm.py bin/test.copapy.asm >> $GITHUB_STEP_SUMMARY + objdump -d -x src/copapy/obj/stencils_x86_64_O3.o > bin/stencils_x86_64_O3.asm + echo 'stencils_x86_64_O3.asm
' >> $GITHUB_STEP_SUMMARY + python tools/clean_asm.py bin/stencils_x86_64_O3.asm >> $GITHUB_STEP_SUMMARY - name: Run tests with pytest run: pytest diff --git a/tools/clean_asm.py b/tools/clean_asm.py new file mode 100644 index 0000000..24aadd3 --- /dev/null +++ b/tools/clean_asm.py @@ -0,0 +1,34 @@ +import argparse +import re + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("path", type=str, help="Input file path") + #parser.add_argument("--abi", type=str, default="", help="Optionaler String (Standard: '')") + args = parser.parse_args() + + regex = r"(\:\n)(.*?)(^[^\n]+\n[^\n]+result_.*?\n\n)" + subst = "\\g<1>\\g<2>\\g<3>" + + with open(args.path, 'rt') as f: + text = f.read() + + outp_flag = "Disassembly of section .text" not in text + + text = text.replace('>', '>') + text = text.replace('<', '<') + + text = re.sub(regex, subst, text, 0, re.MULTILINE | re.DOTALL) + + print('')
+ for line in text.splitlines():
+ if outp_flag:
+ print(line.replace(' ', ' ') + '
')
+
+ if "Disassembly of section .text:" in line:
+ outp_flag = True
+
+ print('')
+
+if __name__ == "__main__":
+ main()
\ No newline at end of file