diff options
Diffstat (limited to 'llvm/test/MC/COFF/stdin.py')
| -rw-r--r-- | llvm/test/MC/COFF/stdin.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/llvm/test/MC/COFF/stdin.py b/llvm/test/MC/COFF/stdin.py new file mode 100644 index 000000000000..1be1f452da85 --- /dev/null +++ b/llvm/test/MC/COFF/stdin.py @@ -0,0 +1,32 @@ +# RUN: echo "// comment" > %t.input +# We use STDIN to for the binary name as lit will substitute in the full path +# of the binary before executing, ensuring we pick up the correct llvm-mc. +# RUN: echo llvm-mc | %python %s %t.input %t + +import argparse +import subprocess +import sys + +parser = argparse.ArgumentParser() +parser.add_argument("input_file") +parser.add_argument("temp_file") +arguments = parser.parse_args() + +llvm_mc_binary = sys.stdin.readlines()[0].strip() + +with open(arguments.temp_file, "w") as mc_stdout: + ## We need to test that starting on an input stream with a non-zero offset + ## does not trigger an assertion in WinCOFFObjectWriter.cpp, so we seek + ## past zero for STDOUT. + mc_stdout.seek(4) + subprocess.run( + [ + llvm_mc_binary, + "-filetype=obj", + "-triple", + "i686-pc-win32", + arguments.input_file, + ], + stdout=mc_stdout, + check=True, + ) |
