OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 # |
| 5 # We want to run FileCheck | <cmd_line>, but all that as a parameter |
| 6 # to the python test wrapper (see CommandTest in ../SConstruct). |
| 7 # Without this wrapper for FileCheck, the command interpreter takes |
| 8 # everything on the left of '|' and pipes it to everything on the right, |
| 9 # which is not what we want. |
| 10 |
| 11 import subprocess |
| 12 import sys |
| 13 |
| 14 def Main(args): |
| 15 if len(args) < 3: |
| 16 print "llvm_file_check_wrapper <filecheck> <check_file> <cmd_line>" |
| 17 print "Where:" |
| 18 print "<filecheck> is the path to FileCheck" |
| 19 print "<check_file> is a text file containing 'CHECK' statements" |
| 20 print "<cmd_line> is the command line to use as input to FileCheck" |
| 21 return 1 |
| 22 |
| 23 file_check=args[0] |
| 24 check_file=args[1] |
| 25 what_to_run=args[2:] |
| 26 |
| 27 what_to_run_proc = subprocess.Popen(what_to_run, stdout=subprocess.PIPE) |
| 28 file_check_proc = subprocess.check_output((file_check, check_file), |
| 29 stdin=what_to_run_proc.stdout) |
| 30 what_to_run_proc.wait() |
| 31 |
| 32 if __name__ == '__main__': |
| 33 sys.exit(Main(sys.argv[1:])) |
OLD | NEW |