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

Side by Side Diff: client/site_tests/hardware_GPIOSwitches/hardware_GPIOSwitches.py

Issue 2819079: Make test failure messages more verbose (and thus useful to testing operators). (Closed) Base URL: ssh://gitrw.chromium.org/autotest.git
Patch Set: Add more test fail messages Created 10 years, 3 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
« no previous file with comments | « client/site_tests/factory_Leds/factory_Leds.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 # -*- coding: utf-8 -*-
2 #
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 5 # found in the LICENSE file.
4 6
5 __author__ = 'nsanders@chromium.org (Nick Sanders)' 7 __author__ = 'nsanders@chromium.org (Nick Sanders)'
6 8
7 import logging, os 9 import logging, os
8 10
9 from autotest_lib.client.bin import test, utils 11 from autotest_lib.client.bin import test, utils
10 from autotest_lib.client.common_lib import error 12 from autotest_lib.client.common_lib import error
11 13
12 class hardware_GPIOSwitches(test.test): 14 class hardware_GPIOSwitches(test.test):
13 version = 1 15 version = 1
14 16
15 17
16 def init_sku_table(self): 18 def init_sku_table(self):
17 self.sku_table = { 19 self.sku_table = {
18 # SKU: gpio_read, recovery GPIO, developer mode, 20 # SKU: gpio_read, recovery GPIO, developer mode,
19 # firmware writeprotect 21 # firmware writeprotect
20 'atom-proto': {'gpio_read': self.acpi_gpio_read} 22 'atom-proto': {'gpio_read': self.acpi_gpio_read}
21 } 23 }
22 24
23 def initialize(self, gpio_root='/home/gpio'): 25 def initialize(self, gpio_root='/home/gpio'):
24 # setup gpio's for reading. Must re-create after each POR 26 # setup gpio's for reading. Must re-create after each POR
25 if os.path.exists(gpio_root): 27 if os.path.exists(gpio_root):
26 utils.system("rm -rf %s" % gpio_root) 28 utils.system("rm -rf %s" % gpio_root)
27 utils.system("mkdir %s" % (gpio_root)) 29 utils.system("mkdir %s" % (gpio_root))
28 utils.system("/usr/sbin/gpio_setup") 30 try:
31 utils.system("/usr/sbin/gpio_setup")
32 except error.CmdError:
33 raise error.TestNAError('GPIO setup failed\nGPIO 設定失敗')
29 self._gpio_root=gpio_root 34 self._gpio_root=gpio_root
30 35
31 def run_once(self): 36 def run_once(self):
32 self.init_sku_table() 37 self.init_sku_table()
33 38
34 # TODO(nsanders): Detect actual system type here by HWQual ID (?) 39 # TODO(nsanders): Detect actual system type here by HWQual ID (?)
35 # and redirect to the correct check. 40 # and redirect to the correct check.
36 # We're just checking for any Atom here, and hoping for the best. 41 # We're just checking for any Atom here, and hoping for the best.
37 try: 42 try:
38 utils.system('cat /proc/cpuinfo | grep "model name" | ' 43 utils.system('cat /proc/cpuinfo | grep "model name" | '
(...skipping 13 matching lines...) Expand all
52 57
53 keyvals = {} 58 keyvals = {}
54 keyvals['level_recovery'] = self.gpio_read('recovery_button') 59 keyvals['level_recovery'] = self.gpio_read('recovery_button')
55 keyvals['level_developer'] = self.gpio_read('developer_switch') 60 keyvals['level_developer'] = self.gpio_read('developer_switch')
56 keyvals['level_firmware_writeprotect'] = self.gpio_read('write_protect') 61 keyvals['level_firmware_writeprotect'] = self.gpio_read('write_protect')
57 62
58 self.write_perf_keyval(keyvals) 63 self.write_perf_keyval(keyvals)
59 64
60 def acpi_gpio_read(self, name): 65 def acpi_gpio_read(self, name):
61 return int(utils.system_output("cat %s/%s" % (self._gpio_root, name))) 66 return int(utils.system_output("cat %s/%s" % (self._gpio_root, name)))
OLDNEW
« no previous file with comments | « client/site_tests/factory_Leds/factory_Leds.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698