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

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

Issue 28933002: Android: do not run telemetry directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
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
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 fp = self._GetDefaultFactoryProperties() 67 fp = self._GetDefaultFactoryProperties()
68 68
69 cmd = [self.telemetry, '--print-cmd', 69 cmd = [self.telemetry, '--print-cmd',
70 '--factory-properties=%s' % json.dumps(fp)] 70 '--factory-properties=%s' % json.dumps(fp)]
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 = ([
78 '\'adb\' \'wait-for-device\'',
79 '\'%s\' ' % sys.executable + 78 '\'%s\' ' % sys.executable +
80 '\'%s\' \'--run-python-script\' \'--target\' \'Release\' ' % runtest + 79 '\'%s\' \'--run-python-script\' \'--target\' \'Release\' ' % runtest +
81 '\'--build-dir\' \'src/build\' \'--no-xvfb\' ' + 80 '\'--build-dir\' \'src/build\' \'--no-xvfb\' ' +
82 '\'--factory-properties=' + 81 '\'--factory-properties=' +
83 '{"target": "Release", ' + 82 '{"target": "Release", ' +
84 '"build_dir": "src/build", "perf_id": "android-gn", ' + 83 '"build_dir": "src/build", "perf_id": "android-gn", ' +
85 '"step_name": "sunspider", "test_name": "sunspider", ' + 84 '"step_name": "sunspider", "test_name": "sunspider", ' +
86 '"target_platform": "linux2", "target_os": "android", ' + 85 '"target_platform": "linux2", "target_os": "android", ' +
87 '"show_perf_results": true}\' ' + 86 '"show_perf_results": true}\' ' +
88 '\'src/tools/perf/run_benchmark\' \'-v\' ' + 87 '\'src/build/android/test_runner.py\' \'perf\' ' +
89 '\'--output-format=buildbot\' ' + 88 '\'--print\' ' +
90 '\'--browser=android-chromium-testshell\' \'sunspider\'' 89 '\'sunspider\''
91 ]) 90 ])
92
93 self.assertEqual(expectedText, self.capture.text) 91 self.assertEqual(expectedText, self.capture.text)
94 92
95 def testExtraArg(self): 93 def testExtraArg(self):
96 fp = self._GetDefaultFactoryProperties() 94 fp = self._GetDefaultFactoryProperties()
97 fp['extra_args'] = ['--profile-dir=fake_dir'] 95 fp['extra_args'] = ['--profile-dir=fake_dir']
98 96
99 cmd = [self.telemetry, '--print-cmd', 97 cmd = [self.telemetry, '--print-cmd',
100 '--factory-properties=%s' % json.dumps(fp)] 98 '--factory-properties=%s' % json.dumps(fp)]
101 99
102 ret = runScript(cmd, filter_obj=self.capture, print_cmd=False) 100 ret = runScript(cmd, filter_obj=self.capture, print_cmd=False)
103 self.assertEqual(ret, 0) 101 self.assertEqual(ret, 0)
104 102
105 runtest = os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'runtest.py')) 103 runtest = os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'runtest.py'))
106 104
107 expectedText = (['\'adb\' \'root\'', 105 expectedText = ([
108 '\'adb\' \'wait-for-device\'',
109 '\'%s\' ' % sys.executable + 106 '\'%s\' ' % sys.executable +
110 '\'%s\' \'--run-python-script\' \'--target\' \'Release\' ' % runtest + 107 '\'%s\' \'--run-python-script\' \'--target\' \'Release\' ' % runtest +
111 '\'--build-dir\' \'src/build\' \'--no-xvfb\' ' + 108 '\'--build-dir\' \'src/build\' \'--no-xvfb\' ' +
112 '\'--factory-properties=' + 109 '\'--factory-properties=' +
113 '{"target": "Release", "build_dir": "src/build", ' + 110 '{"target": "Release", "build_dir": "src/build", ' +
114 '"extra_args": ["--profile-dir=fake_dir"], ' + 111 '"extra_args": ["--profile-dir=fake_dir"], ' +
115 '"perf_id": "android-gn", ' + 112 '"perf_id": "android-gn", ' +
116 '"step_name": "sunspider", "test_name": "sunspider", ' + 113 '"step_name": "sunspider", "test_name": "sunspider", ' +
117 '"target_platform": "linux2", "target_os": "android", ' + 114 '"target_platform": "linux2", "target_os": "android", ' +
118 '"show_perf_results": true}\' ' + 115 '"show_perf_results": true}\' ' +
119 '\'src/tools/perf/run_benchmark\' \'-v\' ' + 116 '\'src/build/android/test_runner.py\' \'perf\' ' +
120 '\'--output-format=buildbot\' ' + 117 '\'--print\' ' +
121 '\'--profile-dir=fake_dir\' '+ 118 '\'sunspider\''
122 '\'--browser=android-chromium-testshell\' \'sunspider\''
123 ]) 119 ])
124 120
125 self.assertEqual(expectedText, self.capture.text) 121 self.assertEqual(expectedText, self.capture.text)
126 122
127 if __name__ == '__main__': 123 if __name__ == '__main__':
128 unittest.main() 124 unittest.main()
OLDNEW
« scripts/master/factory/chromium_commands.py ('K') | « scripts/slave/telemetry.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698