OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import json | 6 import json |
7 import os | 7 import os |
8 import shutil | 8 import shutil |
9 import sys | 9 import sys |
10 import tempfile | 10 import tempfile |
(...skipping 20 matching lines...) Expand all Loading... | |
31 | 31 |
32 def test_arguments(self): | 32 def test_arguments(self): |
33 actual = [] | 33 actual = [] |
34 runisolatedtest.run_command = lambda x: actual.append(x) or 0 | 34 runisolatedtest.run_command = lambda x: actual.append(x) or 0 |
35 exe = os.path.join(self.tempdir, 'foo') | 35 exe = os.path.join(self.tempdir, 'foo') |
36 isolated = exe + '.isolated' | 36 isolated = exe + '.isolated' |
37 | 37 |
38 data = { | 38 data = { |
39 'version': '1.0', | 39 'version': '1.0', |
40 'command': [ '../testing/test_env.py', | 40 'command': [ '../testing/test_env.py', |
41 r'..\build\Release/browser_test.exe'], | 41 r'..\build\Release/browser_test.exe'], |
Nico
2014/03/30 06:09:41
..\out\Release/...
| |
42 'files': { r'build\Release\testdata': {} }, | 42 'files': { r'build\Release\testdata': {} }, |
Nico
2014/03/30 06:09:41
out\Release\testdata
| |
43 | 43 |
44 'variables' : { | 44 'variables' : { |
45 'EXECUTABLE_SUFFIX' : '.exe', | 45 'EXECUTABLE_SUFFIX' : '.exe', |
46 'OS' : 'win', | 46 'OS' : 'win', |
47 'PRODUCT_DIR' : '../build/Release' | 47 'PRODUCT_DIR' : '../build/Release' |
Nico
2014/03/30 06:09:41
Change this to ../out/Release
| |
48 }, | 48 }, |
49 } | 49 } |
50 with open(isolated, 'w') as f: | 50 with open(isolated, 'w') as f: |
51 json.dump(data, f) | 51 json.dump(data, f) |
52 | 52 |
53 sample_line = [ | 53 sample_line = [ |
54 '--test_name', 'base_unittests', | 54 '--test_name', 'base_unittests', |
55 '--builder_name', "Linux Tests", | 55 '--builder_name', "Linux Tests", |
56 '--checkout_dir', | 56 '--checkout_dir', |
57 'build/', | 57 'build/', |
(...skipping 22 matching lines...) Expand all Loading... | |
80 '--no-cr', | 80 '--no-cr', |
81 '--gtest_output=xml:build/gtest-results/base_unittests.xml', | 81 '--gtest_output=xml:build/gtest-results/base_unittests.xml', |
82 '--shards', '1', | 82 '--shards', '1', |
83 '--index', '2', | 83 '--index', '2', |
84 '--gtest_filter=Junk', | 84 '--gtest_filter=Junk', |
85 ], | 85 ], |
86 ] | 86 ] |
87 res = runisolatedtest.main(sample_line) | 87 res = runisolatedtest.main(sample_line) |
88 | 88 |
89 expected_data = { | 89 expected_data = { |
90 'version': '1.0', | 90 u'command': [ |
91 'command': [ '../testing/test_env.py', | 91 u'../testing/test_env.py', |
92 r'..\out\Release/browser_test.exe'], | 92 u'..\\build\\Release/browser_test.exe', |
93 'files': { r'out\Release\testdata': {} }, | 93 ], |
94 'variables' : { | 94 u'files': { u'build\\Release\\testdata': {} }, |
95 'EXECUTABLE_SUFFIX' : '.exe', | 95 u'variables' : { |
96 'OS' : 'win', | 96 u'EXECUTABLE_SUFFIX' : u'.exe', |
97 'PRODUCT_DIR' : '../out/Release' | 97 u'OS' : u'win', |
98 u'PRODUCT_DIR' : u'../build/Release' | |
98 }, | 99 }, |
100 u'version': u'1.0', | |
99 } | 101 } |
100 with open(isolated) as f: | 102 with open(isolated) as f: |
101 converted_data = json.load(f) | 103 converted_data = json.load(f) |
102 | 104 |
103 self.assertEqual(expected_data, converted_data) | 105 self.assertEqual(expected_data, converted_data) |
104 | 106 |
105 self.assertEqual(0, res) | 107 self.assertEqual(0, res) |
106 self.assertEqual(expected, actual) | 108 self.assertEqual(expected, actual) |
107 | 109 |
108 | 110 |
109 if __name__ == '__main__': | 111 if __name__ == '__main__': |
112 if '-v' in sys.argv: | |
113 unittest.TestCase.maxDiff = None | |
110 unittest.main() | 114 unittest.main() |
OLD | NEW |