Example #1
0
    def resolve_package(self, context):
        if not self.owner.package_names and not self.package_name:
            msg = 'Cannot Resolve package; No package name(s) specified'
            raise WorkloadError(msg)

        self.error_msg = None
        if self.prefer_host_package:
            self.resolve_package_from_host(context)
            if not self.apk_file:
                self.resolve_package_from_target()
        else:
            self.resolve_package_from_target()
            if not self.apk_file:
                self.resolve_package_from_host(context)

        if self.apk_file:
            self.apk_info = get_cacheable_apk_info(self.apk_file)
        else:
            if self.error_msg:
                raise WorkloadError(self.error_msg)
            else:
                if self.package_name:
                    message = 'Package "{package}" not found for workload {name} '\
                              'on host or target.'
                elif self.version:
                    message = 'No matching package found for workload {name} '\
                              '(version {version}) on host or target.'
                else:
                    message = 'No matching package found for workload {name} on host or target'
                raise WorkloadError(
                    message.format(name=self.owner.name,
                                   version=self.version,
                                   package=self.package_name))
Example #2
0
def apk_version_matches(path, version):
    version = list_or_string(version)
    info = get_cacheable_apk_info(path)
    for v in version:
        if v in (info.version_name, info.version_code):
            return True
        if loose_version_matching(v, info.version_name):
            return True
    return False
Example #3
0
def apk_abi_matches(path, supported_abi, exact_abi=False):
    supported_abi = list_or_string(supported_abi)
    info = get_cacheable_apk_info(path)
    # If no native code present, suitable for all devices.
    if not info.native_code:
        return True

    if exact_abi:  # Only check primary
        return supported_abi[0] in info.native_code
    else:
        for abi in supported_abi:
            if abi in info.native_code:
                return True
    return False
Example #4
0
 def init_resources(self, resolver):
     self.uiauto_file = resolver.get(ApkFile(self.owner, uiauto=True))
     if not self.uiauto_package:
         uiauto_info = get_cacheable_apk_info(self.uiauto_file)
         self.uiauto_package = uiauto_info.package
Example #5
0
def package_name_matches(path, package):
    info = get_cacheable_apk_info(path)
    return info.package == package
Example #6
0
def uiauto_test_matches(path, uiauto):
    info = get_cacheable_apk_info(path)
    return uiauto == ('com.arm.wa.uiauto' in info.package)
Example #7
0
def apk_version_matches_range(path, min_version=None, max_version=None):
    info = get_cacheable_apk_info(path)
    return range_version_matching(info.version_name, min_version, max_version)
Example #8
0
File: misc.py Project: bea-arm/lisa
 def setup(self, context):
     if hasattr(context.workload, 'apk_file'):
         self.apk_info = get_cacheable_apk_info(context.workload.apk_file)
     else:
         self.apk_info = None