from devicetest.core.test_case import TestCase, Step
class testBundleInstallVerify(TestCase):
def __init__(self, controllers):
self.TAG = self.__class__.__name__
super().__init__(self.TAG, controllers)
def setup(self):
Step("Setup")
def process(self):
Step("Process")
errorList = []
errorList = self.versionCodeVerify(errorList)
errorList = self.multipleHapsVerify(errorList)
if len(errorList) > 0:
self.log.info('errorList: [' + ', '.join(errorList) + ']')
assert False
def versionCodeVerify(self, errorList):
installResult = self.device1.execute_shell_command("bm install -p /data/local/tmp/bundle_first.hap")
if 'install bundle successfully' not in installResult.strip():
errorList.append('install application failed')
return errorList
dumpResult = self.device1.execute_shell_command("bm dump -n com.pcs.software.bundle.first")
if dumpResult.count('\"versionCode\": 1100000') < 1:
errorList.append('get version code failed')
return errorList
installResult = self.device1.execute_shell_command("bm install -p /data/local/tmp/bundle_second.hap")
if 'error: install version downgrade' not in installResult.strip():
errorList.append('version code downgrade verify failed')
return errorList
dumpResult = self.device1.execute_shell_command("bm dump -n com.pcs.software.bundle.first")
if dumpResult.count('\"versionCode\": 1100000') < 1:
errorList.append('get version code failed')
return errorList
installResult = self.device1.execute_shell_command("bm install -p /data/local/tmp/bundle_third.hap")
if 'install bundle successfully' not in installResult.strip():
errorList.append('version code upgrade verify failed')
return errorList
dumpResult = self.device1.execute_shell_command("bm dump -n com.pcs.software.bundle.first")
if dumpResult.count('\"versionCode\": 1200000') < 1:
errorList.append('get version code failed')
return errorList
return errorList
def multipleHapsVerify(self, errorList):
installResult = self.device1.execute_shell_command("bm install -p /data/local/tmp/bundle_fourth.hap")
if 'install bundle successfully' not in installResult.strip():
errorList.append('install application failed')
return errorList
installResult = self.device1.execute_shell_command("bm install -p /data/local/tmp/feature_first.hap")
if 'install bundle successfully' not in installResult.strip():
errorList.append('install multiple haps failed')
return errorList
installResult = self.device1.execute_shell_command("bm install -p /data/local/tmp/feature_second.hap")
if 'error: install version not compatible' not in installResult.strip():
errorList.append('install multiple haps versioncode verify failed')
return errorList
installResult = self.device1.execute_shell_command("bm install -p /data/local/tmp/feature_third.hap")
if 'error: verify signature failed' not in installResult.strip():
errorList.append('install multiple haps signature verify failed')
return errorList
return errorList
def teardown(self):
Step("Teardown")