[lit] fix a error when using --show-used-features
authorYuanfang Chen <yuanfang.chen@sony.com>
Wed, 19 Oct 2022 17:51:13 +0000 (10:51 -0700)
committerYuanfang Chen <yuanfang.chen@sony.com>
Wed, 19 Oct 2022 17:57:01 +0000 (10:57 -0700)
The error is
```
NotADirectoryError: [Errno 20] Not a directory: '<build-dir>/unittests/Analysis/./AnalysisTests/0/40'
```

Exclude unittests when collecting features because
unittests don't make use of feature keywords.

llvm/utils/lit/lit/main.py

index 27bcef1..dc90321 100755 (executable)
@@ -53,7 +53,7 @@ def main(builtin_params={}):
         sys.exit(0)
 
     if opts.show_used_features:
-        features = set(itertools.chain.from_iterable(t.getUsedFeatures() for t in discovered_tests))
+        features = set(itertools.chain.from_iterable(t.getUsedFeatures() for t in discovered_tests if t.gtest_json_file is None))
         print(' '.join(sorted(features)))
         sys.exit(0)