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

Side by Side Diff: scripts/slave/run_slavelastic_unittest.py

Issue 10035003: Split up Each Swarm Test into Two Steps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium 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 HERE = os.path.dirname(os.path.abspath(__file__))
11 sys.path.insert(0, os.path.join(HERE, '..', '..', 'site_config'))
12 sys.path.insert(0, os.path.join(HERE, '..'))
13 sys.path.insert(0, HERE)
14
15 import slave.run_slavelastic as slavelastic
16
17
18 class TestSummaryTest(unittest.TestCase):
19 def test_correct_output(self):
20 summary_output = [
21 ('[ PASSED ] 10 tests.\n'
22 'YOU HAVE 1 DISABLED TESTS\n'
23 'YOU HAVE 1 test with ignored failures (FAILS prefix)'),
24 ('[ PASSED ] 10 tests\n'
25 '[ FAILED ] 1 test, listed below:\n'
26 '[ FAILED ] ObserverListThreadSafeTest.RemoveObserver\n'
27 '1 FAILED TEST\n'
28 'YOU HAVE 2 DISABLED TESTS\n'
29 'YOU HAVE 2 test with ignored failures (FAILS prefix)\n')]
30
31 expected_output = ['[ PASSED ] 20 tests.',
32 '[ FAILED ] failed tests listed below:',
33 '[ FAILED ] ObserverListThreadSafeTest.RemoveObserver',
34 '1 FAILED TESTS',
35 '3 DISABLED TESTS',
36 '3 tests with ignored failures (FAILS prefix)']
37
38 summary = slavelastic.TestSummary()
39
40 for data in summary_output:
41 summary.AddSummaryData(data)
42
43 self.assertEquals(expected_output, summary.Output())
44 self.assertEquals(1, summary.exit_code())
45
46 def test_correct_all_pass(self):
47 summary_output = [
48 ('[ PASSED ] 10 tests.'),
49 ('[ PASSED ] 10 tests')]
50
51 expected_output = ['[ PASSED ] 20 tests.']
52
53 summary = slavelastic.TestSummary()
54
55 for data in summary_output:
56 summary.AddSummaryData(data)
57
58 self.assertEquals(expected_output, summary.Output())
59
60 def test_test_run_output(self):
61 full_output = ('[==========] Running 1 tests from results test run.\n'
62 '[ RUN ] results.Run Test\n'
63 'DONE\n'
64 '[ OK ] results.Run Test (10 ms)\n\n'
65 '[----------] results summary\n'
66 '[==========] 1 tests ran. (10 ms total)\n'
67 '[ PASSED ] 1 tests.\n'
68 '[ FAILED ] 0 tests\n\n'
69 ' 0 FAILED TESTS')
70
71 cleaned_output = slavelastic.TestRunOutput(full_output)
72
73 self.assertEquals('DONE', cleaned_output)
74
75 if __name__ == '__main__':
76 unittest.main()
OLDNEW
« scripts/slave/get_swarm_results.py ('K') | « scripts/slave/run_slavelastic.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698