[flang-commits] [flang] 5a3a126 - [Flang] test_symbols.py module file fix
Ivan Zhechev via flang-commits
flang-commits at lists.llvm.org
Wed Sep 1 07:03:07 PDT 2021
Author: Ivan Zhechev
Date: 2021-09-01T15:02:41+01:00
New Revision: 5a3a12661829d81cd64fd1532f198a7b70b6fb3f
URL: https://github.com/llvm/llvm-project/commit/5a3a12661829d81cd64fd1532f198a7b70b6fb3f
DIFF: https://github.com/llvm/llvm-project/commit/5a3a12661829d81cd64fd1532f198a7b70b6fb3f.diff
LOG: [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
Added:
Modified:
flang/test/Semantics/test_symbols.py
Removed:
################################################################################
diff --git a/flang/test/Semantics/test_symbols.py b/flang/test/Semantics/test_symbols.py
index e284e340267a8..b82903fe44f2b 100755
--- 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]
-
diff 3 = subprocess.check_output(cmd, input=
diff 2, universal_newlines=True)
+with tempfile.TemporaryDirectory() as tmpdir:
+
diff 3 = subprocess.check_output(cmd, input=
diff 2, universal_newlines=True, cwd=tmpdir)
# Removes all whitespace to compare
diff erences in files
diff 1 =
diff 1.replace(" ", "")
More information about the flang-commits
mailing list