[PATCH] D107041: [Flang] Ported test_symbols to Python
Michael Kruse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 30 11:38:50 PDT 2021
Meinersbur added a comment.
Some suggestions for more idiomatic python
================
Comment at: flang/test/Semantics/common.py:13
+def set_source(source):
+ if Path(source).is_file() is False:
+ die(source)
----------------
================
Comment at: flang/test/Semantics/common.py:19
+ flang_fc1 = Path(executable)
+ if flang_fc1.is_file() is False:
+ die(flang_fc1)
----------------
================
Comment at: flang/test/Semantics/common.py:29
+ if file is None:
+ print("{}: FAIL".format(sys.argv[0]))
+ else:
----------------
================
Comment at: flang/test/Semantics/common.py:31
+ else:
+ print("{}: File not found: {}".format(sys.argv[0], file))
+ sys.exit(1)
----------------
================
Comment at: flang/test/Semantics/common.py:36-37
+ if len(args) < 3:
+ print("Usage: {} <fortran-source> <f18-command>"\
+ .format(args[0]))
+ sys.exit(1)
----------------
================
Comment at: flang/test/Semantics/common.py:42-43
+ if len(args) < 4:
+ print("Usage: {} <fortran-source> <temp-test-dir> <f18-command>"\
+ .format(args[0]))
+ sys.exit(1)
----------------
================
Comment at: flang/test/Semantics/common.py:42-43
+ if len(args) < 4:
+ print("Usage: {} <fortran-source> <temp-test-dir> <f18-command>"\
+ .format(args[0]))
+ sys.exit(1)
----------------
Meinersbur wrote:
>
================
Comment at: flang/test/Semantics/test_symbols.py:27-28
+with open(src, 'r') as text_in:
+ for line in text_in:
+
+ text = re.sub("!(?![DR]EF:|\$omp|\$acc).*", "", line)
----------------
================
Comment at: flang/test/Semantics/test_symbols.py:34-35
+# Strips out "!DEF:" and "!REF:" comments
+for line in diff1:
+
+ text = re.sub("![DR]EF:.*", "", line)
----------------
================
Comment at: flang/test/Semantics/test_symbols.py:46-50
+diff_check = ""
+
+# Compares the input with the output
+for line in unified_diff(diff1, diff3, n=999999, fromfile="1.90", tofile="3.f90"):
+ diff_check += line
----------------
Isn't this identical to:
```
diff_check = unified_diff(diff1, diff3, n=999999, fromfile="1.90", tofile="3.f90")
```
?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107041/new/
https://reviews.llvm.org/D107041
More information about the llvm-commits
mailing list