33 lines · python
1# RUN: echo "// comment" > %t.input2# We use STDIN to for the binary name as lit will substitute in the full path3# of the binary before executing, ensuring we pick up the correct llvm-mc.4# RUN: echo llvm-mc | %python %s %t.input %t5 6import argparse7import subprocess8import sys9 10parser = argparse.ArgumentParser()11parser.add_argument("input_file")12parser.add_argument("temp_file")13arguments = parser.parse_args()14 15llvm_mc_binary = sys.stdin.readlines()[0].strip()16 17with open(arguments.temp_file, "w") as mc_stdout:18 ## We need to test that starting on an input stream with a non-zero offset19 ## does not trigger an assertion in WinCOFFObjectWriter.cpp, so we seek20 ## past zero for STDOUT.21 mc_stdout.seek(4)22 subprocess.run(23 [24 llvm_mc_binary,25 "-filetype=obj",26 "-triple",27 "i686-pc-win32",28 arguments.input_file,29 ],30 stdout=mc_stdout,31 check=True,32 )33