[PATCH] D107041: [Flang] Ported test_symbols to Python

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 3 07:22:45 PDT 2021


Meinersbur added inline comments.


================
Comment at: flang/test/Semantics/test_symbols.py:47
+# Compares the input with the output
+for line in unified_diff(diff1, diff3, n=999999, fromfile="1.90", tofile="3.f90"):
+    diff_check += line
----------------
awarzynski wrote:
> kiranchandramohan wrote:
> > Would it be better to rename 1.f90 to source.f90 and 3.f90 to compiled.f90?
> > Otherwise, there can be the question, what happened to 2.f90?
> Also, in the original test script it was `$temp/1.90`: https://github.com/llvm/llvm-project/blob/main/flang/test/Semantics/test_symbols.sh#L12-L14. IIUC, `$temp` is a directory unique to the corresponding test. Are you preserving this here? Otherwise tests will start failing in weird way when run in parallel.
`difflib` is a pure-python implementation, it does not write to those files. They are only used in to indicate what to appear in the output as:
```
--- 1.90
+++ 3.f90
```
See https://docs.python.org/3/library/difflib.html#difflib.unified_diff

They also don't need to be filenames, but could also be descriptions such as "Actual output" and "Expected output".

The files themselves (`1.f90`, `2.f90` and `3.f90`) were just used in the shell script to pass data between commands, as shell scripts work. This python version keeps the data in strings.


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