[PATCH] D34855: [lit] Factor out listdir logic shared by different test formats.

Brian Gesiak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 18:18:38 PDT 2017


modocache added inline comments.


================
Comment at: utils/lit/lit/util.py:139
+            filename in exclude_filenames or
+            not any(filename.endswith(sfx) for sfx in suffixes)):
+            continue
----------------
Note that this is a subtle change in behavior from `os.path.splitext()`. Consider a file without an extension, such as `TARGETS`:

```
>>> os.path.splitext('TARGETS')
('TARGETS', '')
```

The previous logic, which used `os.path.splitext()`, would not include the file, even if `'TARGETS'` were included as a suffix. This new logic would include it, since `TARGETS.endswith('TARGETS')` returns `True`.

I'm not sure if any consumers of lit rely on this behavior... but if you didn't intend to make a change, perhaps keep the old behavior for now?


https://reviews.llvm.org/D34855





More information about the llvm-commits mailing list