faft: Support servod in a different host on FAFT control files
The servo_host and servo_port arguments are now handled in SiteHost class, not
the original ServoTest class. So all FAFT control files should be changed.
This change is created by the following script:
grep -lrsI "use_faft=True" * | grep control | xargs \
sed -i -e "s/AUTHOR =/from autotest_lib.server import utils\n\n&/" \
-e "s/def run_.*:/args_dict = utils.args_to_dict(args)\n"\
"servo_host = args_dict.get('servo_host', 'localhost')\n"\
"servo_port = args_dict.get('servo_port', None)\n\n&/" \
-e "s/ host = hosts.create_host(machine)/"\
" host = hosts.create_host(machine, servo_host=servo_host,\n"\
" servo_port=servo_port)/" \
-e "s/ client = hosts.create_host(machine)/"\
" client = hosts.create_host(machine, servo_host=servo_host,\n"\
" servo_port=servo_port)/"
BUG=chromium-os:34787
TEST=manaul
Run servod in the same host:
$ run_remote_tests.sh --remote $DUT $CONTROL
Run servod in a different host, $SERVO_HOST
$ run_remote_tests.sh --remote $DUT --args "servo_host=$SERVO_HOST" $CONTROL
Some tests may fail since FAFT is not supported servod on a different host yet.
Change-Id: I879bb786999c585c81ef532a84dfa2df7fbf4854
Reviewed-on: https://gerrit.chromium.org/gerrit/34277
Reviewed-by: Mike Truty <truty@chromium.org>
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/site_tests/firmware_CorruptBothFwBodyAB/control.dev b/server/site_tests/firmware_CorruptBothFwBodyAB/control.dev
index 7ac363d..a698f03 100644
--- a/server/site_tests/firmware_CorruptBothFwBodyAB/control.dev
+++ b/server/site_tests/firmware_CorruptBothFwBodyAB/control.dev
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from autotest_lib.server import utils
+
AUTHOR = "Chrome OS Team"
NAME = "firmware_CorruptFwBodyAB"
PURPOSE = "Servo based both firmware body A and B corruption test"
@@ -24,8 +26,13 @@
Chrome OS test image (built by "build_image --test").
"""
+args_dict = utils.args_to_dict(args)
+servo_host = args_dict.get('servo_host', 'localhost')
+servo_port = args_dict.get('servo_port', None)
+
def run_corruptbothfwbodyab(machine):
- host = hosts.create_host(machine)
+ host = hosts.create_host(machine, servo_host=servo_host,
+ servo_port=servo_port)
job.run_test("firmware_CorruptBothFwBodyAB", host=host, cmdline_args=args,
use_faft=True, disable_sysinfo=True,
dev_mode=True, tag="dev")