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

Side by Side Diff: appengine/third_party/python-adb/smoke_test.py

Issue 1421463006: Tweak CPU support; list all available CPU frequencies. (Closed) Base URL: git@github.com:luci/luci-py.git@5_fixes
Patch Set: Remove freqs, it's noisy in swarming stats and already available Created 5 years, 1 month 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 | « appengine/third_party/python-adb/high_test.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 2015 Google Inc. All rights reserved. 2 # Copyright 2015 Google Inc. All rights reserved.
3 # 3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License. 5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at 6 # You may obtain a copy of the License at
7 # 7 #
8 # http://www.apache.org/licenses/LICENSE-2.0 8 # http://www.apache.org/licenses/LICENSE-2.0
9 # 9 #
10 # Unless required by applicable law or agreed to in writing, software 10 # Unless required by applicable law or agreed to in writing, software
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 self.assertGreater(uptime, self.cmd.GetUptime()) 273 self.assertGreater(uptime, self.cmd.GetUptime())
274 finally: 274 finally:
275 # Restarting the Android device changed the port path. Find it back by the 275 # Restarting the Android device changed the port path. Find it back by the
276 # serial number. 276 # serial number.
277 logging.info('Updating port path to %s', self.cmd.port_path) 277 logging.info('Updating port path to %s', self.cmd.port_path)
278 self.__class__.PORT_PATH = self.cmd.port_path 278 self.__class__.PORT_PATH = self.cmd.port_path
279 279
280 def test_cpu(self): 280 def test_cpu(self):
281 """Adjust the CPU speed to power save then max speed then back to normal.""" 281 """Adjust the CPU speed to power save then max speed then back to normal."""
282 self.high() 282 self.high()
283 expected = {u'cur', u'governor', u'max', u'min'} 283
284 # Only one of these 2 scaling governor is supported, not both for one
285 # kernel.
286 unknown = {
287 'conservative', 'interactive'} - set(self.cmd.cache.available_governors)
288 self.assertEqual(1, len(unknown), unknown)
289 unknown = unknown.pop()
290
291 expected = {u'cur', u'governor'}
284 previous = self.cmd.GetCPUScale() 292 previous = self.cmd.GetCPUScale()
285 self.assertEqual(expected, set(previous)) 293 self.assertEqual(expected, set(previous))
286 try: 294 try:
287 self.assertEqual(True, self.cmd.SetCPUScalingGovernor('powersave')) 295 self.assertEqual(True, self.cmd.SetCPUScalingGovernor('powersave'))
288 self.assertIn( 296 self.assertIn(
289 self.cmd.GetCPUScale()['governor'], ('powersave', 'userspace')) 297 self.cmd.GetCPUScale()['governor'], ('powersave', 'userspace'))
290 self.assertEqual(True, self.cmd.SetCPUSpeed(previous['max'])) 298
299 self.assertEqual(
300 True, self.cmd.SetCPUSpeed(self.cmd.cache.available_frequencies[0]))
291 self.assertEqual('userspace', self.cmd.GetCPUScale()['governor']) 301 self.assertEqual('userspace', self.cmd.GetCPUScale()['governor'])
302 with self.assertRaises(AssertionError):
303 self.cmd.SetCPUSpeed(self.cmd.cache.available_frequencies[0]-1)
304
305 self.assertEqual(False, self.cmd.SetCPUScalingGovernor(unknown))
292 self.assertEqual(True, self.cmd.SetCPUScalingGovernor('ondemand')) 306 self.assertEqual(True, self.cmd.SetCPUScalingGovernor('ondemand'))
293 finally: 307 finally:
294 self.assertEqual( 308 self.assertEqual(
295 True, self.cmd.SetCPUScalingGovernor(previous['governor'])) 309 True, self.cmd.SetCPUScalingGovernor(previous['governor']))
296 310
297 def test_stuff(self): 311 def test_stuff(self):
298 # Tests a lot of small functions. 312 # Tests a lot of small functions.
299 self.high() 313 self.high()
300 self.assertTrue(self.cmd.serial) 314 self.assertTrue(self.cmd.serial)
301 self.assertTrue(self.cmd.cache.external_storage_path.startswith('/')) 315 self.assertTrue(self.cmd.cache.external_storage_path.startswith('/'))
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 argv = sys.argv[:1] 373 argv = sys.argv[:1]
360 if args.verbose: 374 if args.verbose:
361 argv.append('-v') # pragma: no cover 375 argv.append('-v') # pragma: no cover
362 if args.test_case: 376 if args.test_case:
363 argv.append(args.test_case) # pragma: no cover 377 argv.append(args.test_case) # pragma: no cover
364 unittest.main(argv=argv) 378 unittest.main(argv=argv)
365 379
366 380
367 if __name__ == '__main__': 381 if __name__ == '__main__':
368 sys.exit(main()) 382 sys.exit(main())
OLDNEW
« no previous file with comments | « appengine/third_party/python-adb/high_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698