Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hardcoded versions from device_name_mapping.py and resolve device name in platform classes. #502

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions benchmarking/platforms/android/android_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,22 @@ def __init__(self, tempdir, adb, args, usb_controller=None):
args.device_name_mapping,
)
self.args = args
self.setPlatformHash(adb.device)
self.rel_version = adb.getprop("ro.build.version.release")
self.build_version = adb.getprop("ro.build.version.sdk")
platform = (
adb.getprop("ro.product.model")
+ "-"
+ self.rel_version
+ "-"
+ self.build_version
)
if self.platform:
self.platform_model = (
re.findall("(.*)-[0-9]*-[0-9]*", self.platform) or [self.platform]
)[0]
else:
self.platform_model = adb.getprop("ro.product.model").replace(" ", "-")
self.platform = (
self.platform_model + "-" + self.rel_version + "-" + self.build_version
)
self.platform_abi = adb.getprop("ro.product.cpu.abi")
self.os_version = "{}-{}".format(self.rel_version, self.build_version)
self.type = "android"
self.setPlatform(platform)
self.setPlatformHash(adb.device)
self.setPlatform(self.platform)
self.device_label = self.getMangledName()
self.usb_controller = usb_controller
self._setLogCatSize()
Expand All @@ -63,8 +65,6 @@ def __init__(self, tempdir, adb, args, usb_controller=None):
self.util.setFrequency(self.args.set_freq)

def getKind(self):
if self.platform_model and self.platform_os_version:
return "{}-{}".format(self.platform_model, self.platform_os_version)
return self.platform

def getOS(self):
Expand Down
4 changes: 2 additions & 2 deletions benchmarking/platforms/platform_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def getOS(self):

@abc.abstractmethod
def getName(self):
if self.device_name_mapping and self.getKind() in self.device_name_mapping:
return self.device_name_mapping[self.getKind()]
if self.device_name_mapping and self.platform_model in self.device_name_mapping:
return self.device_name_mapping[self.platform_model]
else:
return "null"

Expand Down