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

Side by Side Diff: build/scripts/slave/unittests/telemetry_test.py

Issue 38873003: Reland "Dynamically pick build directory on the slave side." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/
Patch Set: Created 7 years, 2 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
« no previous file with comments | « build/scripts/slave/build_directory.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 """Unit tests for telemetry.py. 6 """Unit tests for telemetry.py.
7 7
8 This is a basic check that telemetry.py forms commands properly. 8 This is a basic check that telemetry.py forms commands properly.
9 9
10 """ 10 """
(...skipping 29 matching lines...) Expand all
40 40
41 def FilterDone(self, text): 41 def FilterDone(self, text):
42 self.text.append(text) 42 self.text.append(text)
43 43
44 class TelemetryTest(unittest.TestCase): 44 class TelemetryTest(unittest.TestCase):
45 """Holds tests for telemetry script.""" 45 """Holds tests for telemetry script."""
46 46
47 @staticmethod 47 @staticmethod
48 def _GetDefaultFactoryProperties(): 48 def _GetDefaultFactoryProperties():
49 fp = {} 49 fp = {}
50 fp['build_dir'] = 'src/build' 50 fp['build_dir'] = 'src/out'
51 fp['test_name'] = 'sunspider' 51 fp['test_name'] = 'sunspider'
52 fp['target'] = 'Release' 52 fp['target'] = 'Release'
53 fp['target_os'] = 'android' 53 fp['target_os'] = 'android'
54 fp['target_platform'] = 'linux2' 54 fp['target_platform'] = 'linux2'
55 fp['step_name'] = 'sunspider' 55 fp['step_name'] = 'sunspider'
56 fp['show_perf_results'] = True 56 fp['show_perf_results'] = True
57 fp['perf_id'] = 'android-gn' 57 fp['perf_id'] = 'android-gn'
58 return fp 58 return fp
59 59
60 def setUp(self): 60 def setUp(self):
(...skipping 10 matching lines...) Expand all
71 71
72 ret = runScript(cmd, filter_obj=self.capture, print_cmd=False) 72 ret = runScript(cmd, filter_obj=self.capture, print_cmd=False)
73 self.assertEqual(ret, 0) 73 self.assertEqual(ret, 0)
74 74
75 runtest = os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'runtest.py')) 75 runtest = os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'runtest.py'))
76 76
77 expectedText = (['\'adb\' \'root\'', 77 expectedText = (['\'adb\' \'root\'',
78 '\'adb\' \'wait-for-device\'', 78 '\'adb\' \'wait-for-device\'',
79 '\'%s\' ' % sys.executable + 79 '\'%s\' ' % sys.executable +
80 '\'%s\' \'--run-python-script\' \'--target\' \'Release\' ' % runtest + 80 '\'%s\' \'--run-python-script\' \'--target\' \'Release\' ' % runtest +
81 '\'--build-dir\' \'src/build\' \'--no-xvfb\' ' + 81 '\'--build-dir\' \'src/out\' \'--no-xvfb\' ' +
82 '\'--factory-properties=' + 82 '\'--factory-properties=' +
83 '{"target": "Release", ' + 83 '{"target": "Release", ' +
84 '"build_dir": "src/build", "perf_id": "android-gn", ' + 84 '"build_dir": "src/out", "perf_id": "android-gn", ' +
85 '"step_name": "sunspider", "test_name": "sunspider", ' + 85 '"step_name": "sunspider", "test_name": "sunspider", ' +
86 '"target_platform": "linux2", "target_os": "android", ' + 86 '"target_platform": "linux2", "target_os": "android", ' +
87 '"show_perf_results": true}\' ' + 87 '"show_perf_results": true}\' ' +
88 '\'src/tools/perf/run_benchmark\' \'-v\' ' + 88 '\'src/tools/perf/run_benchmark\' \'-v\' ' +
89 '\'--output-format=buildbot\' ' + 89 '\'--output-format=buildbot\' ' +
90 '\'--browser=android-chromium-testshell\' \'sunspider\'' 90 '\'--browser=android-chromium-testshell\' \'sunspider\''
91 ]) 91 ])
92 92
93 self.assertEqual(expectedText, self.capture.text) 93 self.assertEqual(expectedText, self.capture.text)
94 94
95 def testExtraArg(self): 95 def testExtraArg(self):
96 fp = self._GetDefaultFactoryProperties() 96 fp = self._GetDefaultFactoryProperties()
97 fp['extra_args'] = ['--profile-dir=fake_dir'] 97 fp['extra_args'] = ['--profile-dir=fake_dir']
98 98
99 cmd = [self.telemetry, '--print-cmd', 99 cmd = [self.telemetry, '--print-cmd',
100 '--factory-properties=%s' % json.dumps(fp)] 100 '--factory-properties=%s' % json.dumps(fp)]
101 101
102 ret = runScript(cmd, filter_obj=self.capture, print_cmd=False) 102 ret = runScript(cmd, filter_obj=self.capture, print_cmd=False)
103 self.assertEqual(ret, 0) 103 self.assertEqual(ret, 0)
104 104
105 runtest = os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'runtest.py')) 105 runtest = os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'runtest.py'))
106 106
107 expectedText = (['\'adb\' \'root\'', 107 expectedText = (['\'adb\' \'root\'',
108 '\'adb\' \'wait-for-device\'', 108 '\'adb\' \'wait-for-device\'',
109 '\'%s\' ' % sys.executable + 109 '\'%s\' ' % sys.executable +
110 '\'%s\' \'--run-python-script\' \'--target\' \'Release\' ' % runtest + 110 '\'%s\' \'--run-python-script\' \'--target\' \'Release\' ' % runtest +
111 '\'--build-dir\' \'src/build\' \'--no-xvfb\' ' + 111 '\'--build-dir\' \'src/out\' \'--no-xvfb\' ' +
112 '\'--factory-properties=' + 112 '\'--factory-properties=' +
113 '{"target": "Release", "build_dir": "src/build", ' + 113 '{"target": "Release", "build_dir": "src/out", ' +
114 '"extra_args": ["--profile-dir=fake_dir"], ' + 114 '"extra_args": ["--profile-dir=fake_dir"], ' +
115 '"perf_id": "android-gn", ' + 115 '"perf_id": "android-gn", ' +
116 '"step_name": "sunspider", "test_name": "sunspider", ' + 116 '"step_name": "sunspider", "test_name": "sunspider", ' +
117 '"target_platform": "linux2", "target_os": "android", ' + 117 '"target_platform": "linux2", "target_os": "android", ' +
118 '"show_perf_results": true}\' ' + 118 '"show_perf_results": true}\' ' +
119 '\'src/tools/perf/run_benchmark\' \'-v\' ' + 119 '\'src/tools/perf/run_benchmark\' \'-v\' ' +
120 '\'--output-format=buildbot\' ' + 120 '\'--output-format=buildbot\' ' +
121 '\'--profile-dir=fake_dir\' '+ 121 '\'--profile-dir=fake_dir\' '+
122 '\'--browser=android-chromium-testshell\' \'sunspider\'' 122 '\'--browser=android-chromium-testshell\' \'sunspider\''
123 ]) 123 ])
124 124
125 self.assertEqual(expectedText, self.capture.text) 125 self.assertEqual(expectedText, self.capture.text)
126 126
127 if __name__ == '__main__': 127 if __name__ == '__main__':
128 unittest.main() 128 unittest.main()
OLDNEW
« no previous file with comments | « build/scripts/slave/build_directory.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698