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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « tools/testrunner/local/testsuite.py ('k') | tools/testrunner/local/utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2016 the V8 project authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import os
7 import sys
8 import unittest
9
10 # Needed because the test runner contains relative imports.
11 TOOLS_PATH = os.path.dirname(os.path.dirname(os.path.dirname(
12 os.path.abspath(__file__))))
13 sys.path.append(TOOLS_PATH)
14
15 from testrunner.local.testsuite import TestSuite
16 from testrunner.objects.testcase import TestCase
17
18
19 class TestSuiteTest(unittest.TestCase):
20 def test_filter_testcases_by_status_first_pass(self):
21 suite = TestSuite('foo', 'bar')
22 suite.tests = [
23 TestCase(suite, 'foo/bar'),
24 TestCase(suite, 'baz/bar'),
25 ]
26 suite.rules = {
27 '': {
28 'foo/bar': set(['PASS', 'SKIP']),
29 'baz/bar': set(['PASS', 'FAIL']),
30 },
31 }
32 suite.wildcards = {
33 '': {
34 'baz/*': set(['PASS', 'SLOW']),
35 },
36 }
37 suite.FilterTestCasesByStatus(warn_unused_rules=False)
38 self.assertEquals(
39 [TestCase(suite, 'baz/bar')],
40 suite.tests,
41 )
42 self.assertEquals(set(['PASS', 'FAIL', 'SLOW']), suite.tests[0].outcomes)
43
44 def test_filter_testcases_by_status_second_pass(self):
45 suite = TestSuite('foo', 'bar')
46 suite.tests = [
47 TestCase(suite, 'foo/bar', variant='default'),
48 TestCase(suite, 'foo/bar', variant='stress', flags=['-v']),
49 TestCase(suite, 'baz/bar', variant='default'),
50 TestCase(suite, 'baz/bar', variant='stress', flags=['-v']),
51 ]
52
53 # Contrived outcomes from filtering by variant-independent rules.
54 suite.tests[0].outcomes = set(['PREV'])
55 suite.tests[1].outcomes = set(['PREV'])
56 suite.tests[2].outcomes = set(['PREV'])
57 suite.tests[3].outcomes = set(['PREV'])
58
59 suite.rules = {
60 'default': {
61 'foo/bar': set(['PASS', 'SKIP']),
62 'baz/bar': set(['PASS', 'FAIL']),
63 },
64 'stress': {
65 'baz/bar': set(['SKIP']),
66 },
67 }
68 suite.wildcards = {
69 'default': {
70 'baz/*': set(['PASS', 'SLOW']),
71 },
72 'stress': {
73 'foo/*': set(['PASS', 'SLOW']),
74 },
75 }
76 suite.FilterTestCasesByStatus(warn_unused_rules=False, variants=True)
77 self.assertEquals(
78 [
79 TestCase(suite, 'foo/bar', flags=['-v']),
80 TestCase(suite, 'baz/bar'),
81 ],
82 suite.tests,
83 )
84
85 self.assertEquals(
86 set(['PASS', 'SLOW', 'PREV']),
87 suite.tests[0].outcomes,
88 )
89 self.assertEquals(
90 set(['PASS', 'FAIL', 'SLOW', 'PREV']),
91 suite.tests[1].outcomes,
92 )
93
94
95 if __name__ == '__main__':
96 unittest.main()
OLDNEW
« 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