[autotest] Support scheduling FAFT with released RO firmware.
This change allows task configuration to have RO firmware spec like:
firmware_ro_build_spec: released_ro_2
The index of `2` in above example can be mapped to a released RO
firmware build defined in shadow config, for example:
[CROS]
RELEASED_RO_BUILDS_veyron_jerry:
veyron_jerry-release/R51-8091.0.0,veyron_jerry-release/R51-8092.0.0
In above example, the value of `released_ro_2` is mapped to build
veyron_jerry-release/R51-8092.0.0
If a board does not have RELEASED_RO_BUILDS_ in global config, or the
number of released RO is less than the index specified in the task,
suite scheduler will skip scheduling the suite.
BUG=chromium:575394
TEST=local run suite scheduler
sample task config:
[EC3POFaftEcNightly]
run_on: nightly
hour: 16
suite: dummy
branch_specs: ==tot
firmware_rw_build_spec: firmware
firmware_ro_build_spec: released_ro_2
test_source: cros
pool: suites
run command:
/usr/local/autotest/site_utils/suite_scheduler/suite_scheduler.py \
-d /usr/local/autotest/logs -f /usr/local/autotest/ss_test.ini -e nightly \
-i veyron_jerry-release/R51-8089.0.0 -r /tmp/_autotmp_0pjXWQ_suite_scheduler
suite should create with following build config:
builds={'fwro-version': 'veyron_jerry-release/R51-8092.0.0',
'cros-version': 'veyron_jerry-release/R51-8089.0.0',
'fwrw-version': 'veyron_jerry-firmware/R41-6588.182.0'}
Change-Id: Ib74cb7c8aa892427fa46cae3fc13e0046f7b29b4
Reviewed-on: https://chromium-review.googlesource.com/335315
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
diff --git a/site_utils/suite_scheduler/task.py b/site_utils/suite_scheduler/task.py
index f786f13..4fbc1ca 100644
--- a/site_utils/suite_scheduler/task.py
+++ b/site_utils/suite_scheduler/task.py
@@ -16,9 +16,13 @@
from constants import Builds
import common
+from autotest_lib.client.common_lib import global_config
from autotest_lib.server import utils as server_utils
from autotest_lib.server.cros.dynamic_suite import constants
+
+CONFIG = global_config.global_config
+
OS_TYPE_CROS = 'cros'
OS_TYPE_BRILLO = 'brillo'
OS_TYPE_ANDROID = 'android'
@@ -730,7 +734,13 @@
def _GetFirmwareBuild(self, spec, mv, board):
"""Get the firmware build name to test with ChromeOS build.
- @param spec: build spec for RO or RW firmware, e.g., firmware, cros
+ @param spec: build spec for RO or RW firmware, e.g., firmware, cros.
+ For RO firmware, the value can also be in the format of
+ released_ro_X, where X is the index of the list or RO builds
+ defined in global config RELEASED_RO_BUILDS_[board].
+ For example, for spec `released_ro_2`, and global config
+ CROS/RELEASED_RO_BUILDS_veyron_jerry: build1,build2
+ the return firmare RO build should be build2.
@param mv: an instance of manifest_versions.ManifestVersions.
@param board: the board against which to run self._suite.
@@ -742,6 +752,17 @@
'supported yet.')
if not spec:
return None
+
+ if spec.startswith('released_ro_'):
+ index = int(spec[12:])
+ released_ro_builds = CONFIG.get_config_value(
+ 'CROS', 'RELEASED_RO_BUILDS_%s' % board, type=str,
+ default='').split(',')
+ if not released_ro_builds or len(released_ro_builds) < index:
+ return None
+ else:
+ return released_ro_builds[index-1]
+
# build_type is the build type of the firmware build, e.g., factory,
# firmware or release. If spec is set to cros, build type should be
# mapped to release.
@@ -877,12 +898,21 @@
self.firmware_rw_build_spec, mv, board)
firmware_ro_build = self._GetFirmwareBuild(
self.firmware_ro_build_spec, mv, board)
+ # If RO firmware is specified, force to create suite, because
+ # dedupe based on test source build does not reflect the change
+ # of RO firmware.
+ if firmware_ro_build:
+ force = True
except manifest_versions.QueryException as e:
logging.error(e)
logging.error('Running %s on %s is failed. Failed to find build '
'required to run the suite.', self._name, board)
return False
+ # Return if there is no firmware RO build found for given spec.
+ if not firmware_ro_build and self.firmware_ro_build_spec:
+ return True
+
builds = []
for branch, build in branch_builds.iteritems():
logging.info('Checking if %s fits spec %r',