provision_Cr50*: add 'force' arg
Add the force arg to actually run a cr50 update. Running the update has
been disabled by default until we figure out the scheduling part.
BUG=none
TEST=run on octopus
Change-Id: Ide77e042509682b1a6cee242aee0c0a86c5480a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2026708
Commit-Queue: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Dana Goyette <dgoyette@chromium.org>
diff --git a/server/site_tests/provision_Cr50TOT/control b/server/site_tests/provision_Cr50TOT/control
index 68c5f09..5d320c0 100644
--- a/server/site_tests/provision_Cr50TOT/control
+++ b/server/site_tests/provision_Cr50TOT/control
@@ -26,10 +26,11 @@
args_dict.update(utils.args_to_dict(args))
servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
+force = args_dict.get("force", "true").lower() == "true"
def run(machine):
host = hosts.create_host(machine, servo_args=servo_args)
- job.run_test('provision_Cr50TOT', host=host, cmdline_args=args)
+ job.run_test('provision_Cr50TOT', host=host, cmdline_args=args, force=force)
job.parallel_simple(run, machines)
diff --git a/server/site_tests/provision_Cr50TOT/provision_Cr50TOT.py b/server/site_tests/provision_Cr50TOT/provision_Cr50TOT.py
index d540524..7c3f568 100644
--- a/server/site_tests/provision_Cr50TOT/provision_Cr50TOT.py
+++ b/server/site_tests/provision_Cr50TOT/provision_Cr50TOT.py
@@ -70,11 +70,13 @@
return re.findall('cr50_v\S+\s', version_output)[0].strip()
- def run_once(self, host):
+ def run_once(self, host, force=False):
"""Update cr50 to the TOT image from the reef builder."""
# TODO(mruthven): remove once the test is successfully scheduled.
logging.info('SUCCESSFULLY SCHEDULED PROVISION CR50 TOT UPDATE')
- return
+ if not force:
+ logging.info('skipping update')
+ return
logging.info('cr50 version %s', host.servo.get('cr50_version'))
self.host = host
cr50_path = self.get_latest_cr50_build()
diff --git a/server/site_tests/provision_Cr50Update/control b/server/site_tests/provision_Cr50Update/control
index 20d950d..f05dd25 100644
--- a/server/site_tests/provision_Cr50Update/control
+++ b/server/site_tests/provision_Cr50Update/control
@@ -44,11 +44,13 @@
chip_bid_str = args_dict.get('chip_bid', '')
+force = args_dict.get("force", "true").lower() == "true"
+
def run(machine):
host = hosts.create_host(machine, servo_args=servo_args)
job.run_test('provision_Cr50Update', host=host, cmdline_args=args,
full_args=args_dict, value=value, release_path=release_path,
- chip_bid_str=chip_bid_str)
+ chip_bid_str=chip_bid_str, force=force)
job.parallel_simple(run, machines)
diff --git a/server/site_tests/provision_Cr50Update/provision_Cr50Update.py b/server/site_tests/provision_Cr50Update/provision_Cr50Update.py
index 1ceb4c7..b070330 100644
--- a/server/site_tests/provision_Cr50Update/provision_Cr50Update.py
+++ b/server/site_tests/provision_Cr50Update/provision_Cr50Update.py
@@ -32,14 +32,15 @@
version = 1
def initialize(self, host, cmdline_args, full_args, value='',
- release_path='', chip_bid_str=''):
+ release_path='', chip_bid_str='', force=False):
"""Initialize get the cr50 update version information"""
super(provision_Cr50Update, self).initialize(host, cmdline_args,
full_args, provision_update=True)
# TODO(mruthven): remove once the test is successfully scheduled.
logging.info('SUCCESSFULLY SCHEDULED PROVISION CR50 UPDATE with %r',
value)
- return
+ if not force:
+ return
self.host = host
self.chip_bid_str = chip_bid_str
@@ -228,11 +229,12 @@
raise error.TestFail('Update failures: %s', ', '.join(failed))
- def run_once(self):
+ def run_once(self, force=False):
"""The method called by the control file to start the update."""
# TODO(mruthven): remove once the test is successfully scheduled.
- logging.info('skipping update')
- return
+ if not force:
+ logging.info('skipping update')
+ return
chip_bid_info, set_bid = self.get_new_chip_bid()
logging.info('Updating to image %s with chip board id %s',