feat:install测试用例补充

Signed-off-by: m30058418 <maliang87@huawei.com>
This commit is contained in:
m30058418 2024-07-26 18:52:51 +08:00
parent 2a1bca4e62
commit 65c640406c
2 changed files with 45 additions and 12 deletions

View File

@ -401,7 +401,10 @@ def check_file_recv(remote, local):
def check_app_install(app, bundle, args=""):
app = os.path.join(GP.local_path, app)
install_cmd = f"install {args} {app}"
return check_shell(install_cmd, "successfully") and _check_app_installed(bundle, "s" in args)
if (args == "-s" and app.endswith(".hap")) or (args == "" and app.endswith(".hsp")):
return check_shell(install_cmd, "failed to install bundle")
else:
return check_shell(install_cmd, "successfully") and _check_app_installed(bundle, "s" in args)
def check_app_uninstall(bundle, args=""):
@ -420,12 +423,17 @@ def check_app_install_multi(tables, args=""):
apps_str = " ".join(apps)
install_cmd = f"install {args} {apps_str}"
if not check_shell(install_cmd, "successfully"):
return False
for bundle in bundles:
if not _check_app_installed(bundle, "s" in args):
if ((args == "-s" and re.search(".hap", apps_str)) or (re.search(".hsp", apps_str) and re.search(".hap", apps_str))
or (args == "" and 0 == apps_str.count(".hap"))):
if not check_shell(install_cmd, "failed to install bundle"):
return False
else:
if not check_shell(install_cmd, "successfully"):
return False
for bundle in bundles:
if not _check_app_installed(bundle, "s" in args):
return False
return True
@ -879,4 +887,4 @@ def check_rom(baseline):
return False
else:
print(f"rom size is {all_size}, underlimit baseline {baseline}")
return True
return True

View File

@ -114,7 +114,7 @@ def test_hap_install():
@pytest.mark.repeat(5)
def test_app_cmd():
def test_install_hap():
package_hap = "entry-default-signed-debug.hap"
app_name_default = "com.hmos.diagnosis"
@ -131,12 +131,21 @@ def test_app_cmd():
assert check_app_uninstall(app_name_default, "-k")
# -s
package_hap = "analyticshsp-default-signed.hsp"
app_name_default = "com.huawei.hms.hsp.analyticshsp"
assert check_app_install(package_hap, app_name_default, "-s")
assert check_app_uninstall(app_name_default, "-s")
@pytest.mark.repeat(5)
def test_install_hsp():
package_hsp = "libA_v10001.hsp"
hsp_name_default = "com.example.liba"
assert check_app_install(package_hsp, hsp_name_default, "-s")
assert check_app_uninstall(hsp_name_default, "-s")
assert check_app_install(package_hsp, hsp_name_default)
@pytest.mark.repeat(5)
def test_install_multi_hap():
# default multi hap
tables = {
"entry-default-signed-debug.hap" : "com.hmos.diagnosis",
@ -144,6 +153,7 @@ def test_app_cmd():
}
assert check_app_install_multi(tables)
assert check_app_uninstall_multi(tables)
assert check_app_install_multi(tables, "-s")
# default multi hap -r -k
tables = {
@ -153,6 +163,9 @@ def test_app_cmd():
assert check_app_install_multi(tables, "-r")
assert check_app_uninstall_multi(tables, "-k")
@pytest.mark.repeat(5)
def test_install_multi_hsp():
# default multi hsp -s
tables = {
"libA_v10001.hsp" : "com.example.liba",
@ -160,6 +173,18 @@ def test_app_cmd():
}
assert check_app_install_multi(tables, "-s")
assert check_app_uninstall_multi(tables, "-s")
assert check_app_install_multi(tables)
@pytest.mark.repeat(5)
def test_install_hsp_and_hap():
#default multi hsp and hsp
tables = {
"libA_v10001.hsp" : "com.example.liba",
"entry-default-signed-debug.hap" : "com.hmos.diagnosis",
}
assert check_app_install_multi(tables)
assert check_app_install_multi(tables, "-s")
def test_server_kill():