Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: third_party/lit/lit/LitTestCase.py

Issue 1663053003: [fusl] Add llvm's lit tool to third_party (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: move down a dir Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/lit/lit/LitConfig.py ('k') | third_party/lit/lit/ProgressBar.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/lit/lit/LitTestCase.py
diff --git a/third_party/lit/lit/LitTestCase.py b/third_party/lit/lit/LitTestCase.py
new file mode 100644
index 0000000000000000000000000000000000000000..e04846c7bd6a49b7e6ad20f7cff5096142dba333
--- /dev/null
+++ b/third_party/lit/lit/LitTestCase.py
@@ -0,0 +1,34 @@
+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)
« no previous file with comments | « third_party/lit/lit/LitConfig.py ('k') | third_party/lit/lit/ProgressBar.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698