diff options
Diffstat (limited to 'test cases/common/56 custom target/my_compiler.py')
| -rwxr-xr-x | test cases/common/56 custom target/my_compiler.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test cases/common/56 custom target/my_compiler.py b/test cases/common/56 custom target/my_compiler.py index 4ba2da64e..f46d23a91 100755 --- a/test cases/common/56 custom target/my_compiler.py +++ b/test cases/common/56 custom target/my_compiler.py @@ -1,16 +1,21 @@ #!/usr/bin/env python3 +import os import sys +assert(os.path.exists(sys.argv[3])) + +args = sys.argv[:-1] + if __name__ == '__main__': - if len(sys.argv) != 3 or not sys.argv[1].startswith('--input') or \ - not sys.argv[2].startswith('--output'): - print(sys.argv[0], '--input=input_file --output=output_file') + if len(args) != 3 or not args[1].startswith('--input') or \ + not args[2].startswith('--output'): + print(args[0], '--input=input_file --output=output_file') sys.exit(1) - with open(sys.argv[1].split('=')[1]) as f: + with open(args[1].split('=')[1]) as f: ifile = f.read() if ifile != 'This is a text only input file.\n': print('Malformed input') sys.exit(1) - with open(sys.argv[2].split('=')[1], 'w') as ofile: + with open(args[2].split('=')[1], 'w') as ofile: ofile.write('This is a binary output file.\n') |
