[llvm] r354188 - [lit] Remove LitTestCase

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 15 16:44:00 PST 2019


Author: yln
Date: Fri Feb 15 16:44:00 2019
New Revision: 354188

URL: http://llvm.org/viewvc/llvm-project?rev=354188&view=rev
Log:
[lit] Remove LitTestCase

>From the docs: `class LitTestCase(unittest.TestCase)`
LitTestCase is an adaptor for providing a 'unittest' compatible
interface to 'lit' tests so that we can run lit tests with standard
python test runners.

It does not seem to be used anywhere.

Differential Revision: https://reviews.llvm.org/D58264

Removed:
    llvm/trunk/utils/lit/lit/LitTestCase.py
    llvm/trunk/utils/lit/tests/Inputs/unittest-adaptor/
    llvm/trunk/utils/lit/tests/unittest-adaptor.py
Modified:
    llvm/trunk/utils/lit/lit/discovery.py
    llvm/trunk/utils/lit/lit/run.py

Removed: llvm/trunk/utils/lit/lit/LitTestCase.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/LitTestCase.py?rev=354187&view=auto
==============================================================================
--- llvm/trunk/utils/lit/lit/LitTestCase.py (original)
+++ llvm/trunk/utils/lit/lit/LitTestCase.py (removed)
@@ -1,34 +0,0 @@
-from __future__ import absolute_import
-import unittest
-
-import lit.Test
-
-"""
-TestCase adaptor for providing a 'unittest' compatible interface to 'lit' tests.
-"""
-
-class UnresolvedError(RuntimeError):
-    pass
-        
-class LitTestCase(unittest.TestCase):
-    def __init__(self, test, run):
-        unittest.TestCase.__init__(self)
-        self._test = test
-        self._run = run
-
-    def id(self):
-        return self._test.getFullName()
-
-    def shortDescription(self):
-        return self._test.getFullName()
-
-    def runTest(self):
-        # Run the test.
-        self._run.execute_test(self._test)
-
-        # Adapt the result to unittest.
-        result = self._test.result
-        if result.code is lit.Test.UNRESOLVED:
-            raise UnresolvedError(result.output)
-        elif result.code.isFailure:
-            self.fail(result.output)

Modified: llvm/trunk/utils/lit/lit/discovery.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/discovery.py?rev=354188&r1=354187&r2=354188&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/discovery.py (original)
+++ llvm/trunk/utils/lit/lit/discovery.py Fri Feb 15 16:44:00 2019
@@ -249,27 +249,3 @@ def find_tests_for_inputs(lit_config, in
         sys.exit(2)
 
     return tests
-
-def load_test_suite(inputs):
-    import platform
-    import unittest
-    from lit.LitTestCase import LitTestCase
-
-    # Create the global config object.
-    litConfig = LitConfig.LitConfig(progname = 'lit',
-                                    path = [],
-                                    quiet = False,
-                                    useValgrind = False,
-                                    valgrindLeakCheck = False,
-                                    valgrindArgs = [],
-                                    noExecute = False,
-                                    debug = False,
-                                    isWindows = (platform.system()=='Windows'),
-                                    params = {})
-
-    # Perform test discovery.
-    run = lit.run.Run(litConfig, find_tests_for_inputs(litConfig, inputs))
-
-    # Return a unittest test suite which just runs the tests in order.
-    return unittest.TestSuite([LitTestCase(test, run)
-                               for test in run.tests])

Modified: llvm/trunk/utils/lit/lit/run.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/run.py?rev=354188&r1=354187&r2=354188&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/run.py (original)
+++ llvm/trunk/utils/lit/lit/run.py Fri Feb 15 16:44:00 2019
@@ -32,9 +32,6 @@ class Run(object):
                 {k: multiprocessing.BoundedSemaphore(v) for k, v in
                  self.lit_config.parallelism_groups.items()}
 
-    def execute_test(self, test):
-        return lit.worker._execute_test(test, self.lit_config)
-
     def execute_tests_in_pool(self, jobs, max_time):
         # We need to issue many wait calls, so compute the final deadline and
         # subtract time.time() from that as we go along.

Removed: llvm/trunk/utils/lit/tests/unittest-adaptor.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/unittest-adaptor.py?rev=354187&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/unittest-adaptor.py (original)
+++ llvm/trunk/utils/lit/tests/unittest-adaptor.py (removed)
@@ -1,18 +0,0 @@
-# Check the lit adaption to run under unittest.
-#
-# RUN: %{python} %s %{inputs}/unittest-adaptor 2> %t.err
-# RUN: FileCheck < %t.err %s
-#
-# CHECK-DAG: unittest-adaptor :: test-two.txt ... FAIL
-# CHECK-DAG: unittest-adaptor :: test-one.txt ... ok
-
-import unittest
-import sys
-
-import lit
-import lit.discovery
-
-input_path = sys.argv[1]
-unittest_suite = lit.discovery.load_test_suite([input_path])
-runner = unittest.TextTestRunner(verbosity=2)
-runner.run(unittest_suite)




More information about the llvm-commits mailing list