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

Unified Diff: tools/testrunner/local/testsuite_unittest.py

Issue 2203013002: [test] Enable test status filtering by variant (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Nits Created 4 years, 4 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 | « tools/testrunner/local/testsuite.py ('k') | tools/testrunner/local/utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testrunner/local/testsuite_unittest.py
diff --git a/tools/testrunner/local/testsuite_unittest.py b/tools/testrunner/local/testsuite_unittest.py
new file mode 100755
index 0000000000000000000000000000000000000000..003822afdf36a50ee984d2ff830c93d3db468566
--- /dev/null
+++ b/tools/testrunner/local/testsuite_unittest.py
@@ -0,0 +1,96 @@
+#!/usr/bin/env python
+# Copyright 2016 the V8 project authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import sys
+import unittest
+
+# Needed because the test runner contains relative imports.
+TOOLS_PATH = os.path.dirname(os.path.dirname(os.path.dirname(
+ os.path.abspath(__file__))))
+sys.path.append(TOOLS_PATH)
+
+from testrunner.local.testsuite import TestSuite
+from testrunner.objects.testcase import TestCase
+
+
+class TestSuiteTest(unittest.TestCase):
+ def test_filter_testcases_by_status_first_pass(self):
+ suite = TestSuite('foo', 'bar')
+ suite.tests = [
+ TestCase(suite, 'foo/bar'),
+ TestCase(suite, 'baz/bar'),
+ ]
+ suite.rules = {
+ '': {
+ 'foo/bar': set(['PASS', 'SKIP']),
+ 'baz/bar': set(['PASS', 'FAIL']),
+ },
+ }
+ suite.wildcards = {
+ '': {
+ 'baz/*': set(['PASS', 'SLOW']),
+ },
+ }
+ suite.FilterTestCasesByStatus(warn_unused_rules=False)
+ self.assertEquals(
+ [TestCase(suite, 'baz/bar')],
+ suite.tests,
+ )
+ self.assertEquals(set(['PASS', 'FAIL', 'SLOW']), suite.tests[0].outcomes)
+
+ def test_filter_testcases_by_status_second_pass(self):
+ suite = TestSuite('foo', 'bar')
+ suite.tests = [
+ TestCase(suite, 'foo/bar', variant='default'),
+ TestCase(suite, 'foo/bar', variant='stress', flags=['-v']),
+ TestCase(suite, 'baz/bar', variant='default'),
+ TestCase(suite, 'baz/bar', variant='stress', flags=['-v']),
+ ]
+
+ # Contrived outcomes from filtering by variant-independent rules.
+ suite.tests[0].outcomes = set(['PREV'])
+ suite.tests[1].outcomes = set(['PREV'])
+ suite.tests[2].outcomes = set(['PREV'])
+ suite.tests[3].outcomes = set(['PREV'])
+
+ suite.rules = {
+ 'default': {
+ 'foo/bar': set(['PASS', 'SKIP']),
+ 'baz/bar': set(['PASS', 'FAIL']),
+ },
+ 'stress': {
+ 'baz/bar': set(['SKIP']),
+ },
+ }
+ suite.wildcards = {
+ 'default': {
+ 'baz/*': set(['PASS', 'SLOW']),
+ },
+ 'stress': {
+ 'foo/*': set(['PASS', 'SLOW']),
+ },
+ }
+ suite.FilterTestCasesByStatus(warn_unused_rules=False, variants=True)
+ self.assertEquals(
+ [
+ TestCase(suite, 'foo/bar', flags=['-v']),
+ TestCase(suite, 'baz/bar'),
+ ],
+ suite.tests,
+ )
+
+ self.assertEquals(
+ set(['PASS', 'SLOW', 'PREV']),
+ suite.tests[0].outcomes,
+ )
+ self.assertEquals(
+ set(['PASS', 'FAIL', 'SLOW', 'PREV']),
+ suite.tests[1].outcomes,
+ )
+
+
+if __name__ == '__main__':
+ unittest.main()
« no previous file with comments | « tools/testrunner/local/testsuite.py ('k') | tools/testrunner/local/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698