[PATCH] D107953: [Flang] test_symbols.py module file fix
Ivan Zhechev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 17 08:00:19 PDT 2021
ijan1 updated this revision to Diff 366903.
ijan1 marked 2 inline comments as done.
ijan1 added a comment.
Updated to use `tempfile.TemporaryDirectory`. Addressed comments by Andrzej.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107953/new/
https://reviews.llvm.org/D107953
Files:
flang/test/Semantics/test_symbols.py
Index: flang/test/Semantics/test_symbols.py
===================================================================
--- flang/test/Semantics/test_symbols.py
+++ 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 frontdriver 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(" ", "")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107953.366903.patch
Type: text/x-patch
Size: 1247 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210817/f71250ad/attachment.bin>
More information about the llvm-commits
mailing list