power: Add platform name to power dashboard board if set.
platform (AKA unibuild model) needed to distiguish data uploaded to
dashboard so lets combine board + platform name strings where
applicable.
BUG=chromium:862195
TEST=run power_Display
power_log.json is
for eve, "board": "eve"
for sona, "board": "nami_sona"
Change-Id: I2f7d39e882db2d068a22b5e19d1e1b7da7d2fd40
Reviewed-on: https://chromium-review.googlesource.com/1131684
Commit-Ready: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Puthikorn Voravootivat <puthik@chromium.org>
diff --git a/client/bin/utils.py b/client/bin/utils.py
index 582a520..2262a7f 100644
--- a/client/bin/utils.py
+++ b/client/bin/utils.py
@@ -1967,6 +1967,28 @@
return get_board_property('DEVICETYPE')
+def get_platform():
+ """
+ Get the ChromeOS platform name.
+
+ For unibuild this should be equal to model name. For non-unibuild
+ it will either be board name or empty string. In the case of
+ empty string return board name to match equivalent logic in
+ server/hosts/cros_host.py
+
+ @returns platform name
+ """
+ platform = ''
+ command = 'mosys platform model'
+ result = utils.run(command, ignore_status=True)
+ if result.exit_status == 0:
+ platform = result.stdout.strip()
+
+ if platform == '':
+ platform = get_board()
+ return platform
+
+
def get_ec_version():
"""Get the ec version as strings.
diff --git a/client/cros/power/power_dashboard.py b/client/cros/power/power_dashboard.py
index 5a5f97b..9b267fe 100644
--- a/client/cros/power/power_dashboard.py
+++ b/client/cros/power/power_dashboard.py
@@ -138,8 +138,14 @@
Returns:
DUT info dictionary
"""
+ board = utils.get_board()
+ platform = utils.get_platform()
+
+ if platform != board:
+ board += '_' + platform
+
dut_info_dict = {
- 'board': utils.get_board(),
+ 'board': board,
'version': {
'hw': utils.get_hardware_revision(),
'milestone': lsbrelease_utils.get_chromeos_release_milestone(),
diff --git a/server/cros/power/power_dashboard.py b/server/cros/power/power_dashboard.py
index b640aa9..782e51f 100644
--- a/server/cros/power/power_dashboard.py
+++ b/server/cros/power/power_dashboard.py
@@ -36,8 +36,15 @@
Returns:
DUT info dictionary
"""
+
+ board = self._host.get_board().replace('board:', '')
+ platform = self._host.get_platform()
+
+ if platform != board:
+ board += '_' + platform
+
dut_info_dict = {
- 'board': self._host.get_board().replace('board:', ''),
+ 'board': board,
'version': {
'hw': self._host.get_hardware_revision(),
'milestone': self._host.get_chromeos_release_milestone(),