mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-21 20:38:57 +00:00
Resource: Added support for uiautomator apks
As uiautomator2 uses apk for instrumented tests this allows for distinguishing between a normal application apk and a uiauto test apk based on the apks package name.
This commit is contained in:
parent
c0f5d36b9b
commit
238ae18491
@ -143,19 +143,21 @@ class ApkFile(Resource):
|
||||
|
||||
kind = 'apk'
|
||||
|
||||
def __init__(self, owner, variant=None, version=None):
|
||||
def __init__(self, owner, variant=None, version=None, uiauto=False):
|
||||
super(ApkFile, self).__init__(owner)
|
||||
self.variant = variant
|
||||
self.version = version
|
||||
self.uiauto = uiauto
|
||||
|
||||
def match(self, path):
|
||||
name_matches = True
|
||||
version_matches = True
|
||||
uiauto_matches = uiauto_test_matches(path, self.uiauto)
|
||||
if self.version is not None:
|
||||
version_matches = apk_version_matches(path, self.version)
|
||||
if self.variant is not None:
|
||||
name_matches = file_name_matches(path, self.variant)
|
||||
return name_matches and version_matches
|
||||
return name_matches and version_matches and uiauto_matches
|
||||
|
||||
def __str__(self):
|
||||
text = '<{}\'s apk'.format(self.owner)
|
||||
@ -163,6 +165,8 @@ class ApkFile(Resource):
|
||||
text += ' {}'.format(self.variant)
|
||||
if self.version:
|
||||
text += ' {}'.format(self.version)
|
||||
if self.uiauto:
|
||||
text += 'uiautomator test'
|
||||
text += '>'
|
||||
return text
|
||||
|
||||
@ -271,3 +275,6 @@ def file_name_matches(path, pattern):
|
||||
return True
|
||||
return False
|
||||
|
||||
def uiauto_test_matches(path, uiauto):
|
||||
info = ApkInfo(path)
|
||||
return uiauto == ('com.arm.wa.uiauto' in info.package)
|
||||
|
Loading…
x
Reference in New Issue
Block a user