[llvm-commits] [llvm] r109062 - in /llvm/trunk/utils/lit/lit: ExampleTests/lit.cfg TestRunner.py TestingConfig.py

Daniel Dunbar daniel at zuster.org
Wed Jul 21 16:39:57 PDT 2010


Author: ddunbar
Date: Wed Jul 21 18:39:57 2010
New Revision: 109062

URL: http://llvm.org/viewvc/llvm-project?rev=109062&view=rev
Log:
lit: Add support for 'REQUIRES: feature-one, feature-two, ...' in the
integrated-test formats (sh and tcl style). The particular features which get
recognized are up to the test suite itself to define.

Modified:
    llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg
    llvm/trunk/utils/lit/lit/TestRunner.py
    llvm/trunk/utils/lit/lit/TestingConfig.py

Modified: llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg?rev=109062&r1=109061&r2=109062&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg (original)
+++ llvm/trunk/utils/lit/lit/ExampleTests/lit.cfg Wed Jul 21 18:39:57 2010
@@ -21,3 +21,6 @@
 
 # target_triple: Used by ShTest and TclTest formats for XFAIL checks.
 config.target_triple = 'foo'
+
+# available_features: Used by ShTest and TclTest formats for REQUIRES checks.
+config.available_features = ['some-feature-name']

Modified: llvm/trunk/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=109062&r1=109061&r2=109062&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Wed Jul 21 18:39:57 2010
@@ -422,6 +422,7 @@
     script = []
     xfails = []
     xtargets = []
+    requires = []
     for ln in open(sourcepath):
         if 'RUN:' in ln:
             # Isolate the command to run.
@@ -442,6 +443,9 @@
         elif 'XTARGET:' in ln:
             items = ln[ln.index('XTARGET:') + 8:].split(',')
             xtargets.extend([s.strip() for s in items])
+        elif 'REQUIRES:' in ln:
+            items = ln[ln.index('REQUIRES:') + 9:].split(',')
+            requires.extend([s.strip() for s in items])
         elif 'END.' in ln:
             # Check for END. lines.
             if ln[ln.index('END.'):].strip() == 'END.':
@@ -461,9 +465,18 @@
     if not script:
         return (Test.UNRESOLVED, "Test has no run line!")
 
+    # Check for unterminated run lines.
     if script[-1][-1] == '\\':
         return (Test.UNRESOLVED, "Test has unterminated run lines (with '\\')")
 
+    # Check that we have the required features:
+    missing_required_features = [f for f in requires
+                                 if f not in test.config.available_features]
+    if missing_required_features:
+        msg = ', '.join(missing_required_features)
+        return (Test.UNSUPPORTED,
+                "Test requires the following features: %s" % msg)
+
     isXFail = isExpectedFail(xfails, xtargets, test.suite.config.target_triple)
     return script,isXFail,tmpBase,execdir
 

Modified: llvm/trunk/utils/lit/lit/TestingConfig.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestingConfig.py?rev=109062&r1=109061&r2=109062&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestingConfig.py (original)
+++ llvm/trunk/utils/lit/lit/TestingConfig.py Wed Jul 21 18:39:57 2010
@@ -28,7 +28,8 @@
                                    on_clone = None,
                                    test_exec_root = None,
                                    test_source_root = None,
-                                   excludes = [])
+                                   excludes = [],
+                                   available_features = [])
 
         if os.path.exists(path):
             # FIXME: Improve detection and error reporting of errors in the
@@ -54,7 +55,8 @@
 
     def __init__(self, parent, name, suffixes, test_format,
                  environment, substitutions, unsupported, on_clone,
-                 test_exec_root, test_source_root, excludes):
+                 test_exec_root, test_source_root, excludes,
+                 available_features):
         self.parent = parent
         self.name = str(name)
         self.suffixes = set(suffixes)
@@ -66,6 +68,7 @@
         self.test_exec_root = test_exec_root
         self.test_source_root = test_source_root
         self.excludes = set(excludes)
+        self.available_features = set(available_features)
 
     def clone(self, path):
         # FIXME: Chain implementations?
@@ -75,7 +78,7 @@
                             self.environment, self.substitutions,
                             self.unsupported, self.on_clone,
                             self.test_exec_root, self.test_source_root,
-                            self.excludes)
+                            self.excludes, self.available_features)
         if cfg.on_clone:
             cfg.on_clone(self, cfg, path)
         return cfg





More information about the llvm-commits mailing list