[PATCH] [LIT] Add SuffixDispatchTest for use in libc++ and libc++abi tests.

Eric Fiselier eric at efcs.ca
Tue Nov 11 22:40:45 PST 2014


@jroelofs  Thanks for the review. 
I'm going to remove the handling of UNSUPPORTED-XFAIL and REQUIRES-XFAIL tomorrow. They make things needlessly complex and provide little value. Please don't take a look at it until then.

================
Comment at: utils/lit/lit/formats/base.py:25-28
@@ -24,6 +24,6 @@
             if not os.path.isdir(filepath):
-                base,ext = os.path.splitext(filename)
-                if ext in localConfig.suffixes:
-                    yield lit.Test.Test(testSuite, path_in_suite + (filename,),
-                                        localConfig)
+                for ext in localConfig.suffixes:
+                    if filepath.endswith(ext):
+                        yield lit.Test.Test(testSuite, path_in_suite + (filename,),
+                                            localConfig)
 
----------------
This allows suffixes to have multiple extensions ex: `.pass.cpp` 

================
Comment at: utils/lit/lit/formats/suffixdispatchtest.py:38
@@ +37,3 @@
+    @staticmethod
+    def _handle_metadata_line(ln, tag, out):
+        if tag not in ln:
----------------
jroelofs wrote:
> _parse_metadata_line or _metadata_line_matches perhaps? 'handle' is a bit hand-wavey.
Sounds good thanks.

================
Comment at: utils/lit/lit/formats/suffixdispatchtest.py:106
@@ +105,3 @@
+        test_runner = None
+        for suffix_test in self.suffix_tests:
+            if name.endswith(suffix_test[0]):
----------------
jroelofs wrote:
> I think you can do this in python....
> 
>   for (suffix, test) in self.suffix_tests:
>     if name.endswith(suffix):
>       test_runner = test
>       break
Cool! That's so much cleaner. Thanks.

================
Comment at: utils/lit/lit/formats/suffixdispatchtest.py:111
@@ +110,3 @@
+        if test_runner is None:
+            lit_config.fatal('Unrecognized test suffix: %s' % name)
+
----------------
jroelofs wrote:
> When does this happen? Should it be an 'assert False'?
lit_config.fatal will kill the process. This will happen when a test is matched to a suffix in config.suffixes but no test handler has been registered for that suffix.

http://reviews.llvm.org/D6206






More information about the llvm-commits mailing list