Skip to content

Commit 5a3a126

Browse files
author
Ivan Zhechev
committed
[Flang] test_symbols.py module file fix
Due to how the LIT deals with module files, this change stores and runs the scripts in their own temporary directory to prevent interference in-between different tests. It also makes ``test_symbols.py`` be more consistent with the other scripts. Reviewed By: Meinersbur, awarzynski Differential Revision: https://reviews.llvm.org/D107953
1 parent f8bcbb8 commit 5a3a126

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

flang/test/Semantics/test_symbols.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
"""Compiles a source file with "-fdebug-unparse-with-symbols' and verifies
44
we get the right symbols in the output, i.e. the output should be
55
the same as the input, except for the copyright comment.
6-
Expects a source file passed as the first argument;
7-
Expects the Flang frontend driver with options as second argument."""
6+
7+
Parameters:
8+
sys.argv[1]: a source file with contains the input and expected output
9+
sys.argv[2]: the Flang frontend driver
10+
sys.argv[3:]: Optional arguments to the Flang frontend driver"""
811

912
import sys
13+
import tempfile
1014
import re
1115
import subprocess
1216
import common as cm
@@ -36,7 +40,8 @@
3640

3741
# Compiles, inserting comments for symbols:
3842
cmd = [flang_fc1, *flang_fc1_args, flang_fc1_options]
39-
diff3 = subprocess.check_output(cmd, input=diff2, universal_newlines=True)
43+
with tempfile.TemporaryDirectory() as tmpdir:
44+
diff3 = subprocess.check_output(cmd, input=diff2, universal_newlines=True, cwd=tmpdir)
4045

4146
# Removes all whitespace to compare differences in files
4247
diff1 = diff1.replace(" ", "")

0 commit comments

Comments
 (0)