Add client attribute object to FAFT test
This enables us to define some per-platform attributes and take
different action during test.
BUG=chrome-os-partner:10874
TEST=Check we can get attribute in test.
Change-Id: I6051aa6e6f1da5ff4a4229853939554973ab6aeb
Reviewed-on: https://gerrit.chromium.org/gerrit/26092
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
diff --git a/server/cros/faft_client_attribute.py b/server/cros/faft_client_attribute.py
new file mode 100644
index 0000000..bebffdd
--- /dev/null
+++ b/server/cros/faft_client_attribute.py
@@ -0,0 +1,29 @@
+# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+class FAFTClientAttribute(object):
+ """Class that tests platform name and gives client machine attributes."""
+ version = 1
+
+ DEFAULT_SETTING = {'keyboard_dev': True}
+
+ def __init__(self, platform):
+ """Initialized.
+
+ Args:
+ platform: Platform name returned by FAFT client.
+ """
+ self.__dict__.update(self.DEFAULT_SETTING)
+ self.__dict__.update(self._get_platform_setting(platform))
+
+
+ def _get_platform_setting(self, platform):
+ """Return platform-specific settings."""
+ setting = dict()
+
+ if platform in ['Aebl', 'Alex', 'Kaen', 'Lumpy', 'Mario', 'Seaboard',
+ 'Stumpy', 'ZGB']:
+ setting['keyboard_dev'] = False
+
+ return setting
diff --git a/server/cros/faftsequence.py b/server/cros/faftsequence.py
index a940a16..adabd08 100644
--- a/server/cros/faftsequence.py
+++ b/server/cros/faftsequence.py
@@ -14,6 +14,7 @@
from autotest_lib.client.bin import utils
from autotest_lib.client.common_lib import error
+from autotest_lib.server.cros.faft_client_attribute import FAFTClientAttribute
from autotest_lib.server.cros.servo_test import ServoTest
from autotest_lib.site_utils import lab_test
@@ -221,6 +222,9 @@
super(FAFTSequence, self).initialize(host, cmdline_args, use_pyauto,
use_faft)
+ if use_faft:
+ self.client_attr = FAFTClientAttribute(
+ self.faft_client.get_platform_name())
def setup(self):