mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-22 12:58:36 +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'
|
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)
|
super(ApkFile, self).__init__(owner)
|
||||||
self.variant = variant
|
self.variant = variant
|
||||||
self.version = version
|
self.version = version
|
||||||
|
self.uiauto = uiauto
|
||||||
|
|
||||||
def match(self, path):
|
def match(self, path):
|
||||||
name_matches = True
|
name_matches = True
|
||||||
version_matches = True
|
version_matches = True
|
||||||
|
uiauto_matches = uiauto_test_matches(path, self.uiauto)
|
||||||
if self.version is not None:
|
if self.version is not None:
|
||||||
version_matches = apk_version_matches(path, self.version)
|
version_matches = apk_version_matches(path, self.version)
|
||||||
if self.variant is not None:
|
if self.variant is not None:
|
||||||
name_matches = file_name_matches(path, self.variant)
|
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):
|
def __str__(self):
|
||||||
text = '<{}\'s apk'.format(self.owner)
|
text = '<{}\'s apk'.format(self.owner)
|
||||||
@ -163,6 +165,8 @@ class ApkFile(Resource):
|
|||||||
text += ' {}'.format(self.variant)
|
text += ' {}'.format(self.variant)
|
||||||
if self.version:
|
if self.version:
|
||||||
text += ' {}'.format(self.version)
|
text += ' {}'.format(self.version)
|
||||||
|
if self.uiauto:
|
||||||
|
text += 'uiautomator test'
|
||||||
text += '>'
|
text += '>'
|
||||||
return text
|
return text
|
||||||
|
|
||||||
@ -271,3 +275,6 @@ def file_name_matches(path, pattern):
|
|||||||
return True
|
return True
|
||||||
return False
|
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