cbuildbot: Refactor the logic for non-unibuild lab_board_name
Some board run on DUT with different board label(e.g. arcnext)
Add a function that replace the board name for non-unibuild board.
BUG=chromium:958037
TEST=unittest
Change-Id: Ic63bf17f1a89b89a5ca1822d3b9042464dccbaca
Signed-off-by: Po-Hsien Wang <pwang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1590690
Reviewed-by: Sean Abraham <seanabraham@chromium.org>
diff --git a/cbuildbot/commands.py b/cbuildbot/commands.py
index f9dfb86..9751683 100644
--- a/cbuildbot/commands.py
+++ b/cbuildbot/commands.py
@@ -1114,14 +1114,7 @@
A list of args for the `skylab create-suite` subcommand (not including)
the subcommand itself.
"""
- # TODO(crbug.com/958037): Figure out a way to remove this board-replacement
- # hack.
- board = board.replace('-arcnext', '')
- board = board.replace('-arcvm', '')
- board = board.replace('-kernelnext', '')
-
args = ['-image', build, '-board', board]
-
if model:
args += ['-model', model]
@@ -1399,11 +1392,6 @@
Returns:
A list of args for run_suite
"""
-
- # HACK(pwang): Delete this once better solution is out.
- board = board.replace('-arcnext', '')
- board = board.replace('-arcvm', '')
- board = board.replace('-kernelnext', '')
args = ['--build', build, '--board', board]
if model:
diff --git a/cbuildbot/stages/release_stages.py b/cbuildbot/stages/release_stages.py
index 283f12e..09f5a67 100644
--- a/cbuildbot/stages/release_stages.py
+++ b/cbuildbot/stages/release_stages.py
@@ -510,9 +510,11 @@
config_lib.GetHWTestEnv(self._run.config,
model_config=model)).Run()
else:
+ lab_board_name = config_lib.GetNonUniBuildLabBoardName(
+ archive_board)
PaygenTestStage(self._run, self.buildstore, suite_name,
- archive_board, None, archive_board, self.channel,
- archive_build, self.skip_duts_check,
+ archive_board, None, lab_board_name,
+ self.channel, archive_build, self.skip_duts_check,
self.debug,
payload_test_configs,
config_lib.GetHWTestEnv(self._run.config)).Run()
diff --git a/cbuildbot/stages/test_stages.py b/cbuildbot/stages/test_stages.py
index e95f1e1..5e78851 100644
--- a/cbuildbot/stages/test_stages.py
+++ b/cbuildbot/stages/test_stages.py
@@ -678,9 +678,9 @@
"option in the builder config is set to True.")
return
- # For non-uni builds, we don't pass a model (just board)
- models = [config_lib.ModelTestConfig(None, board)]
+ models = [config_lib.ModelTestConfig(
+ None, config_lib.GetNonUniBuildLabBoardName(board))]
if builder_run.config.models:
models = builder_run.config.models
diff --git a/lib/config_lib.py b/lib/config_lib.py
index 59f1cf4..f1f0177 100644
--- a/lib/config_lib.py
+++ b/lib/config_lib.py
@@ -11,6 +11,7 @@
import itertools
import json
import os
+import re
from chromite.lib import constants
from chromite.lib import memoize
@@ -1837,6 +1838,15 @@
return builder_to_boards_dict
+def GetNonUniBuildLabBoardName(board):
+ """Return the board name labeled in the lab for non-unibuild."""
+ # Those special string represent special configuration used in the image,
+ # and should run on DUT without those string.
+ # We strip those string from the board so that lab can handle it correctly.
+ SPECIAL_SUFFIX = ['-arcnext$', '-arcvm$', '-kernelnext$']
+ for suffix in SPECIAL_SUFFIX:
+ board = re.sub(suffix, '', board)
+ return board
def GetArchBoardDict(ge_build_config):
"""Get a dict mapping arch types to board names.