[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / llvm / test / tools / llvm-reduce / Inputs / llvm-dis-and-filecheck.py
blob9fa1363462327fc5f6e0b7e67c9c5da7fbf17f49
1 """
2 Script to disassembles a bitcode file and run FileCheck on the output with the
3 provided arguments. The first 2 arguments are the paths to the llvm-dis and
4 FileCheck binaries, followed by arguments to be passed to FileCheck. The last
5 argument is the bitcode file to disassemble.
7 Usage:
8 python llvm-dis-and-filecheck.py
9 <path to llvm-dis> <path to FileCheck>
10 [arguments passed to FileCheck] <path to bitcode file>
12 """
15 import sys
16 import subprocess
18 llvm_dis = sys.argv[1]
19 filecheck = sys.argv[2]
20 filecheck_args = [filecheck, ]
21 filecheck_args.extend(sys.argv[3:-1])
22 bitcode_file = sys.argv[-1]
24 disassemble = subprocess.Popen([llvm_dis, "-o", "-", bitcode_file],
25 stdout=subprocess.PIPE)
26 check = subprocess.Popen(filecheck_args, stdin=disassemble.stdout)
27 disassemble.stdout.close()
28 check.communicate()
29 sys.exit(check.returncode)