Index: llvm/trunk/utils/lit/lit/LitTestCase.py =================================================================== --- llvm/trunk/utils/lit/lit/LitTestCase.py +++ llvm/trunk/utils/lit/lit/LitTestCase.py @@ -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) Index: llvm/trunk/utils/lit/lit/discovery.py =================================================================== --- llvm/trunk/utils/lit/lit/discovery.py +++ llvm/trunk/utils/lit/lit/discovery.py @@ -249,27 +249,3 @@ 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]) Index: llvm/trunk/utils/lit/lit/run.py =================================================================== --- llvm/trunk/utils/lit/lit/run.py +++ llvm/trunk/utils/lit/lit/run.py @@ -32,9 +32,6 @@ {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. Index: llvm/trunk/utils/lit/tests/Inputs/unittest-adaptor/lit.cfg =================================================================== --- llvm/trunk/utils/lit/tests/Inputs/unittest-adaptor/lit.cfg +++ llvm/trunk/utils/lit/tests/Inputs/unittest-adaptor/lit.cfg @@ -1,6 +0,0 @@ -import lit.formats -config.name = 'unittest-adaptor' -config.suffixes = ['.txt'] -config.test_format = lit.formats.ShTest() -config.test_source_root = None -config.test_exec_root = None Index: llvm/trunk/utils/lit/tests/Inputs/unittest-adaptor/test-one.txt =================================================================== --- llvm/trunk/utils/lit/tests/Inputs/unittest-adaptor/test-one.txt +++ llvm/trunk/utils/lit/tests/Inputs/unittest-adaptor/test-one.txt @@ -1 +0,0 @@ -# RUN: true Index: llvm/trunk/utils/lit/tests/Inputs/unittest-adaptor/test-two.txt =================================================================== --- llvm/trunk/utils/lit/tests/Inputs/unittest-adaptor/test-two.txt +++ llvm/trunk/utils/lit/tests/Inputs/unittest-adaptor/test-two.txt @@ -1 +0,0 @@ -# RUN: false Index: llvm/trunk/utils/lit/tests/unittest-adaptor.py =================================================================== --- llvm/trunk/utils/lit/tests/unittest-adaptor.py +++ llvm/trunk/utils/lit/tests/unittest-adaptor.py @@ -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)