diff --git a/flang/test/Semantics/test_symbols.py b/flang/test/Semantics/test_symbols.py --- a/flang/test/Semantics/test_symbols.py +++ b/flang/test/Semantics/test_symbols.py @@ -3,10 +3,14 @@ """Compiles a source file with "-fdebug-unparse-with-symbols' and verifies we get the right symbols in the output, i.e. the output should be the same as the input, except for the copyright comment. -Expects a source file passed as the first argument; -Expects the Flang frontend driver with options as second argument.""" + +Parameters: + sys.argv[1]: a source file with contains the input and expected output + sys.argv[2]: the Flang frontend driver + sys.argv[3:]: Optional arguments to the Flang frontend driver""" import sys +import tempfile import re import subprocess import common as cm @@ -36,7 +40,8 @@ # Compiles, inserting comments for symbols: cmd = [flang_fc1, *flang_fc1_args, flang_fc1_options] -diff3 = subprocess.check_output(cmd, input=diff2, universal_newlines=True) +with tempfile.TemporaryDirectory() as tmpdir: + diff3 = subprocess.check_output(cmd, input=diff2, universal_newlines=True, cwd=tmpdir) # Removes all whitespace to compare differences in files diff1 = diff1.replace(" ", "")