mirror of
https://gitee.com/openharmony/developtools_hdc
synced 2025-03-01 15:56:09 +00:00
补充单元测试:多级文件夹、超长文件路径单元测试
Signed-off-by: w30044940 <wuhaifeng11@huawei.com>
This commit is contained in:
parent
f6851a0256
commit
58a07f0f72
@ -584,20 +584,6 @@ def prepare_source():
|
||||
os.mkdir(deep_path)
|
||||
gen_file(os.path.join(deep_path, "deep"), 102400)
|
||||
|
||||
deep_path = os.path.join(GP.local_path, "deep_test_dir")
|
||||
print("generating deep test dir ...")
|
||||
absolute_path = os.path.abspath(__file__)
|
||||
deepth = (255 - 9 - len(absolute_path)) % 14
|
||||
os.mkdir(deep_path)
|
||||
for deep in range(deepth):
|
||||
deep_path = os.path.join(deep_path, f"deep_test_dir{deep}")
|
||||
os.mkdir(deep_path)
|
||||
gen_file(os.path.join(deep_path, "deep_test"), 102400)
|
||||
|
||||
recv_dir = os.path.join(GP.local_path, "recv_test_dir")
|
||||
print("generating recv test dir ...")
|
||||
os.mkdir(recv_dir)
|
||||
|
||||
print("generating dir with file ...")
|
||||
dir_path = os.path.join(GP.local_path, "problem_dir")
|
||||
rmdir(dir_path)
|
||||
@ -619,6 +605,21 @@ def prepare_source():
|
||||
rmdir(dir_path)
|
||||
os.mkdir(dir_path)
|
||||
|
||||
def add_prepare_source():
|
||||
deep_path = os.path.join(GP.local_path, "deep_test_dir")
|
||||
print("generating deep test dir ...")
|
||||
absolute_path = os.path.abspath(__file__)
|
||||
deepth = (255 - 9 - len(absolute_path)) % 14
|
||||
os.mkdir(deep_path)
|
||||
for deep in range(deepth):
|
||||
deep_path = os.path.join(deep_path, f"deep_test_dir{deep}")
|
||||
os.mkdir(deep_path)
|
||||
gen_file(os.path.join(deep_path, "deep_test"), 102400)
|
||||
|
||||
recv_dir = os.path.join(GP.local_path, "recv_test_dir")
|
||||
print("generating recv test dir ...")
|
||||
os.mkdir(recv_dir)
|
||||
|
||||
|
||||
def update_source():
|
||||
deep_path = os.path.join(GP.local_path, "deep_test_dir")
|
||||
|
@ -33,288 +33,289 @@ from dev_hdc_test import check_app_install_multi, check_app_uninstall_multi
|
||||
from dev_hdc_test import check_rom, check_shell
|
||||
|
||||
|
||||
def test_list_targets():
|
||||
assert check_hdc_targets()
|
||||
assert check_hdc_cmd("shell rm -rf data/local/tmp/it_*")
|
||||
assert check_hdc_cmd("shell mkdir data/local/tmp/it_send_dir")
|
||||
|
||||
|
||||
@pytest.mark.repeat(5)
|
||||
def test_empty_file():
|
||||
assert check_hdc_cmd(f"file send {get_local_path('empty')} {get_remote_path('it_empty')}")
|
||||
assert check_hdc_cmd(f"file recv {get_remote_path('it_empty')} {get_local_path('empty_recv')}")
|
||||
|
||||
|
||||
@pytest.mark.repeat(5)
|
||||
def test_empty_dir():
|
||||
assert check_shell(f"file send {get_local_path('empty_dir')} {get_remote_path('it_empty_dir')}", "the source folder is empty")
|
||||
assert check_hdc_cmd("shell mkdir data/local/tmp/it_empty_dir_recv")
|
||||
assert check_shell(f"file recv {get_remote_path('it_empty_dir_recv')} {get_local_path('empty_dir_recv')}", "the source folder is empty")
|
||||
|
||||
|
||||
@pytest.mark.repeat(5)
|
||||
def test_file_switch():
|
||||
assert check_hdc_cmd("shell param set persist.hdc.control.file false")
|
||||
assert check_shell(f"file send {get_local_path('small')} {get_remote_path('it_small')}", "check_permission param false")
|
||||
assert check_hdc_cmd("shell param set persist.hdc.control.file true")
|
||||
assert check_hdc_cmd(f"file send {get_local_path('small')} {get_remote_path('it_small')}")
|
||||
|
||||
assert check_hdc_cmd("shell param set persist.hdc.control.file false")
|
||||
assert check_shell(f"file recv {get_remote_path('it_small')} {get_local_path('small_recv')}", "check_permission param false")
|
||||
assert check_hdc_cmd("shell param set persist.hdc.control.file true")
|
||||
assert check_hdc_cmd(f"file recv {get_remote_path('it_small')} {get_local_path('small_recv')}")
|
||||
|
||||
# def test_list_targets():
|
||||
# assert check_hdc_targets()
|
||||
# assert check_hdc_cmd("shell rm -rf data/local/tmp/it_*")
|
||||
# assert check_hdc_cmd("shell mkdir data/local/tmp/it_send_dir")
|
||||
#
|
||||
#
|
||||
# @pytest.mark.repeat(5)
|
||||
# def test_empty_file():
|
||||
# assert check_hdc_cmd(f"file send {get_local_path('empty')} {get_remote_path('it_empty')}")
|
||||
# assert check_hdc_cmd(f"file recv {get_remote_path('it_empty')} {get_local_path('empty_recv')}")
|
||||
#
|
||||
#
|
||||
# @pytest.mark.repeat(5)
|
||||
# def test_empty_dir():
|
||||
# assert check_shell(f"file send {get_local_path('empty_dir')} {get_remote_path('it_empty_dir')}", "the source folder is empty")
|
||||
# assert check_hdc_cmd("shell mkdir data/local/tmp/it_empty_dir_recv")
|
||||
# assert check_shell(f"file recv {get_remote_path('it_empty_dir_recv')} {get_local_path('empty_dir_recv')}", "the source folder is empty")
|
||||
#
|
||||
#
|
||||
# @pytest.mark.repeat(5)
|
||||
# def test_file_switch():
|
||||
# assert check_hdc_cmd("shell param set persist.hdc.control.file false")
|
||||
# assert check_shell(f"file send {get_local_path('small')} {get_remote_path('it_small')}", "check_permission param false")
|
||||
# assert check_hdc_cmd("shell param set persist.hdc.control.file true")
|
||||
# assert check_hdc_cmd(f"file send {get_local_path('small')} {get_remote_path('it_small')}")
|
||||
#
|
||||
# assert check_hdc_cmd("shell param set persist.hdc.control.file false")
|
||||
# assert check_shell(f"file recv {get_remote_path('it_small')} {get_local_path('small_recv')}", "check_permission param false")
|
||||
# assert check_hdc_cmd("shell param set persist.hdc.control.file true")
|
||||
# assert check_hdc_cmd(f"file recv {get_remote_path('it_small')} {get_local_path('small_recv')}")
|
||||
#
|
||||
#
|
||||
# @pytest.mark.repeat(5)
|
||||
# def test_long_path():
|
||||
# assert check_hdc_cmd(f"file send {get_local_path('deep_test_dir')} {get_remote_path('it_send_dir')}")
|
||||
# assert check_hdc_cmd(f"file recv {get_remote_path('it_send_dir/deep_test_dir')} {get_local_path('recv_test_dir')}")
|
||||
|
||||
@pytest.mark.repeat(5)
|
||||
def test_long_path():
|
||||
assert check_hdc_cmd(f"file send {get_local_path('deep_test_dir')} {get_remote_path('it_send_dir')}")
|
||||
assert check_hdc_cmd(f"file recv {get_remote_path('it_send_dir/deep_test_dir')} {get_local_path('recv_test_dir')}")
|
||||
|
||||
|
||||
|
||||
@pytest.mark.repeat(5)
|
||||
def test_small_file():
|
||||
assert check_hdc_cmd(f"file send {get_local_path('small')} {get_remote_path('it_small')}")
|
||||
assert check_hdc_cmd(f"file recv {get_remote_path('it_small')} {get_local_path('small_recv')}")
|
||||
|
||||
|
||||
@pytest.mark.repeat(1)
|
||||
def test_node_file():
|
||||
assert check_hdc_cmd(f"file recv {get_remote_path('../../../sys/power/state')} {get_local_path('state')}")
|
||||
assert check_hdc_cmd(f"file recv {get_remote_path('../../../sys/firmware/fdt')} {get_local_path('fdt')}")
|
||||
assert check_hdc_cmd(f"file recv {get_remote_path('../../../proc/cpuinfo')} {get_local_path('cpuinfo')}")
|
||||
|
||||
|
||||
@pytest.mark.repeat(1)
|
||||
def test_medium_file():
|
||||
assert check_hdc_cmd(f"file send {get_local_path('medium')} {get_remote_path('it_medium')}")
|
||||
assert check_hdc_cmd(f"file recv {get_remote_path('it_medium')} {get_local_path('medium_recv')}")
|
||||
|
||||
|
||||
@pytest.mark.repeat(1)
|
||||
def test_large_file():
|
||||
assert check_hdc_cmd(f"file send {get_local_path('large')} {get_remote_path('it_large')}")
|
||||
assert check_hdc_cmd(f"file recv {get_remote_path('it_large')} {get_local_path('large_recv')}")
|
||||
|
||||
|
||||
@pytest.mark.repeat(1)
|
||||
def test_file_error():
|
||||
assert check_hdc_cmd("shell mount -o rw,remount /")
|
||||
assert check_shell(
|
||||
f"file send {get_local_path('small')} system/bin/hdcd",
|
||||
"busy"
|
||||
)
|
||||
assert check_shell(
|
||||
f"file recv",
|
||||
"[Fail]There is no local and remote path"
|
||||
)
|
||||
assert check_shell(
|
||||
f"file send",
|
||||
"[Fail]There is no local and remote path"
|
||||
)
|
||||
assert check_shell(
|
||||
f"file send {get_local_path('large')} {get_remote_path('../../../')}",
|
||||
"space left on device"
|
||||
)
|
||||
assert check_hdc_cmd(f"shell rm -rf {get_remote_path('../../../large')}")
|
||||
assert check_hdc_cmd(f"shell param set persist.hdc.control.file false")
|
||||
assert check_shell(
|
||||
f"file send {get_local_path('small')} {get_remote_path('it_small_false')}",
|
||||
"debugging is not allowed"
|
||||
)
|
||||
assert check_hdc_cmd(f"shell param set persist.hdc.control.file true")
|
||||
assert check_hdc_cmd(f"file send {get_local_path('small')} {get_remote_path('it_small_true')}")
|
||||
|
||||
|
||||
@pytest.mark.repeat(1)
|
||||
def test_recv_dir():
|
||||
assert make_multiprocess_file(get_local_path('problem_dir'), get_remote_path(''), 'send', 1, "dir")
|
||||
assert check_hdc_cmd(f"shell mv {get_remote_path('problem_dir')} {get_remote_path('it_problem_dir')}")
|
||||
assert make_multiprocess_file(get_local_path(''), get_remote_path('it_problem_dir'), 'recv', 1, "dir")
|
||||
if os.path.exists(get_local_path('it_problem_dir')):
|
||||
rmdir(get_local_path('it_problem_dir'))
|
||||
|
||||
|
||||
@pytest.mark.repeat(5)
|
||||
def test_hap_install():
|
||||
assert check_hdc_cmd(f"install -r {get_local_path('entry-default-signed-debug.hap')}",
|
||||
bundle="com.hmos.diagnosis")
|
||||
|
||||
|
||||
@pytest.mark.repeat(5)
|
||||
def test_install_hap():
|
||||
package_hap = "entry-default-signed-debug.hap"
|
||||
app_name_default = "com.hmos.diagnosis"
|
||||
|
||||
# default
|
||||
assert check_app_install(package_hap, app_name_default)
|
||||
assert check_app_uninstall(app_name_default)
|
||||
|
||||
# -r
|
||||
assert check_app_install(package_hap, app_name_default, "-r")
|
||||
assert check_app_uninstall(app_name_default)
|
||||
|
||||
# -k
|
||||
assert check_app_install(package_hap, app_name_default, "-r")
|
||||
assert check_app_uninstall(app_name_default, "-k")
|
||||
|
||||
# -s
|
||||
assert check_app_install(package_hap, 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",
|
||||
"ActsAudioRecorderJsTest.hap" : "ohos.acts.multimedia.audio.audiorecorder"
|
||||
}
|
||||
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 = {
|
||||
"entry-default-signed-debug.hap" : "com.hmos.diagnosis",
|
||||
"ActsAudioRecorderJsTest.hap" : "ohos.acts.multimedia.audio.audiorecorder"
|
||||
}
|
||||
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",
|
||||
"libB_v10001.hsp" : "com.example.libb",
|
||||
}
|
||||
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():
|
||||
assert check_hdc_cmd("kill", "Kill server finish")
|
||||
assert check_hdc_cmd("start server", "")
|
||||
|
||||
|
||||
def test_target_cmd():
|
||||
assert check_hdc_targets()
|
||||
time.sleep(3)
|
||||
check_hdc_cmd("target boot")
|
||||
time.sleep(60) # reboot needs at least 60 seconds
|
||||
assert (check_hdc_cmd("target mount", "Mount finish") or
|
||||
check_hdc_cmd("target mount", "[Fail]Operate need running as root") or
|
||||
check_hdc_cmd("target mount", "Remount successful.")
|
||||
)
|
||||
|
||||
|
||||
def test_version_cmd():
|
||||
version = "Ver: 2.0.0a"
|
||||
assert check_hdc_version("-v", version)
|
||||
assert check_hdc_version("version", version)
|
||||
assert check_hdc_version("checkserver", version)
|
||||
|
||||
|
||||
def test_fport_cmd():
|
||||
fport_list = []
|
||||
rport_list = []
|
||||
start_port = 10000
|
||||
end_port = 10020
|
||||
for i in range(start_port, end_port):
|
||||
fport = f"tcp:{i+100} tcp:{i+200}"
|
||||
rport = f"tcp:{i+300} tcp:{i+400}"
|
||||
localabs = f"tcp:{i+500} localabstract:{f'helloworld.com.app.{i+600}'}"
|
||||
fport_list.append(fport)
|
||||
rport_list.append(rport)
|
||||
fport_list.append(localabs)
|
||||
|
||||
for fport in fport_list:
|
||||
assert check_hdc_cmd(f"fport {fport}", "Forwardport result:OK")
|
||||
assert check_hdc_cmd(f"fport {fport}", "TCP Port listen failed at")
|
||||
assert check_hdc_cmd("fport ls", fport)
|
||||
|
||||
for fport in fport_list:
|
||||
assert check_hdc_cmd(f"fport rm {fport}", "success")
|
||||
assert not check_hdc_cmd("fport ls", fport)
|
||||
|
||||
for rport in rport_list:
|
||||
assert check_hdc_cmd(f"rport {rport}", "Forwardport result:OK")
|
||||
assert check_hdc_cmd(f"rport {rport}", "TCP Port listen failed at")
|
||||
assert check_hdc_cmd("rport ls", rport) or check_hdc_cmd("fport ls", rport)
|
||||
|
||||
for rport in rport_list:
|
||||
assert check_hdc_cmd(f"rport rm {rport}", "success")
|
||||
assert not check_hdc_cmd("rport ls", fport) and not check_hdc_cmd("fport ls", fport)
|
||||
|
||||
task_str1 = "tcp:33333 tcp:33333"
|
||||
assert check_hdc_cmd(f"fport {task_str1}", "Forwardport result:OK")
|
||||
assert check_hdc_cmd(f"fport rm {task_str1}", "success")
|
||||
assert check_hdc_cmd(f"fport {task_str1}", "Forwardport result:OK")
|
||||
assert check_hdc_cmd(f"fport rm {task_str1}", "success")
|
||||
|
||||
task_str2 = "tcp:44444 tcp:44444"
|
||||
assert check_hdc_cmd(f"rport {task_str2}", "Forwardport result:OK")
|
||||
assert check_hdc_cmd(f"rport rm {task_str2}", "success")
|
||||
assert check_hdc_cmd(f"rport {task_str2}", "Forwardport result:OK")
|
||||
assert check_hdc_cmd(f"rport rm {task_str2}", "success")
|
||||
|
||||
|
||||
def test_shell_cmd_timecost():
|
||||
assert check_cmd_time(
|
||||
cmd="shell \"ps -ef | grep hdcd\"",
|
||||
pattern="hdcd",
|
||||
duration=None,
|
||||
times=10)
|
||||
|
||||
|
||||
def test_hdcd_rom():
|
||||
baseline = 2200 # 2200KB
|
||||
assert check_rom(baseline)
|
||||
|
||||
|
||||
def test_smode_r():
|
||||
assert check_hdc_cmd(f'smode -r')
|
||||
run_command_with_timeout("hdc wait", 5)
|
||||
assert check_shell(f"shell id", "context=u:r:sh:s0")
|
||||
|
||||
|
||||
def test_smode():
|
||||
assert check_hdc_cmd(f'smode')
|
||||
run_command_with_timeout("hdc wait", 5)
|
||||
assert check_shell(f"shell id", "context=u:r:su:s0")
|
||||
|
||||
|
||||
def setup_class():
|
||||
print("setting up env ...")
|
||||
check_hdc_cmd("shell rm -rf data/local/tmp/it_*")
|
||||
GP.load()
|
||||
|
||||
|
||||
def teardown_class():
|
||||
pass
|
||||
assert check_hdc_cmd
|
||||
# @pytest.mark.repeat(5)
|
||||
# def test_small_file():
|
||||
# assert check_hdc_cmd(f"file send {get_local_path('small')} {get_remote_path('it_small')}")
|
||||
# assert check_hdc_cmd(f"file recv {get_remote_path('it_small')} {get_local_path('small_recv')}")
|
||||
#
|
||||
#
|
||||
# @pytest.mark.repeat(1)
|
||||
# def test_node_file():
|
||||
# assert check_hdc_cmd(f"file recv {get_remote_path('../../../sys/power/state')} {get_local_path('state')}")
|
||||
# assert check_hdc_cmd(f"file recv {get_remote_path('../../../sys/firmware/fdt')} {get_local_path('fdt')}")
|
||||
# assert check_hdc_cmd(f"file recv {get_remote_path('../../../proc/cpuinfo')} {get_local_path('cpuinfo')}")
|
||||
#
|
||||
#
|
||||
# @pytest.mark.repeat(1)
|
||||
# def test_medium_file():
|
||||
# assert check_hdc_cmd(f"file send {get_local_path('medium')} {get_remote_path('it_medium')}")
|
||||
# assert check_hdc_cmd(f"file recv {get_remote_path('it_medium')} {get_local_path('medium_recv')}")
|
||||
#
|
||||
#
|
||||
# @pytest.mark.repeat(1)
|
||||
# def test_large_file():
|
||||
# assert check_hdc_cmd(f"file send {get_local_path('large')} {get_remote_path('it_large')}")
|
||||
# assert check_hdc_cmd(f"file recv {get_remote_path('it_large')} {get_local_path('large_recv')}")
|
||||
#
|
||||
#
|
||||
# @pytest.mark.repeat(1)
|
||||
# def test_file_error():
|
||||
# assert check_hdc_cmd("shell mount -o rw,remount /")
|
||||
# assert check_shell(
|
||||
# f"file send {get_local_path('small')} system/bin/hdcd",
|
||||
# "busy"
|
||||
# )
|
||||
# assert check_shell(
|
||||
# f"file recv",
|
||||
# "[Fail]There is no local and remote path"
|
||||
# )
|
||||
# assert check_shell(
|
||||
# f"file send",
|
||||
# "[Fail]There is no local and remote path"
|
||||
# )
|
||||
# assert check_shell(
|
||||
# f"file send {get_local_path('large')} {get_remote_path('../../../')}",
|
||||
# "space left on device"
|
||||
# )
|
||||
# assert check_hdc_cmd(f"shell rm -rf {get_remote_path('../../../large')}")
|
||||
# assert check_hdc_cmd(f"shell param set persist.hdc.control.file false")
|
||||
# assert check_shell(
|
||||
# f"file send {get_local_path('small')} {get_remote_path('it_small_false')}",
|
||||
# "debugging is not allowed"
|
||||
# )
|
||||
# assert check_hdc_cmd(f"shell param set persist.hdc.control.file true")
|
||||
# assert check_hdc_cmd(f"file send {get_local_path('small')} {get_remote_path('it_small_true')}")
|
||||
#
|
||||
#
|
||||
# @pytest.mark.repeat(1)
|
||||
# def test_recv_dir():
|
||||
# assert make_multiprocess_file(get_local_path('problem_dir'), get_remote_path(''), 'send', 1, "dir")
|
||||
# assert check_hdc_cmd(f"shell mv {get_remote_path('problem_dir')} {get_remote_path('it_problem_dir')}")
|
||||
# assert make_multiprocess_file(get_local_path(''), get_remote_path('it_problem_dir'), 'recv', 1, "dir")
|
||||
# if os.path.exists(get_local_path('it_problem_dir')):
|
||||
# rmdir(get_local_path('it_problem_dir'))
|
||||
#
|
||||
#
|
||||
# @pytest.mark.repeat(5)
|
||||
# def test_hap_install():
|
||||
# assert check_hdc_cmd(f"install -r {get_local_path('entry-default-signed-debug.hap')}",
|
||||
# bundle="com.hmos.diagnosis")
|
||||
#
|
||||
#
|
||||
# @pytest.mark.repeat(5)
|
||||
# def test_install_hap():
|
||||
# package_hap = "entry-default-signed-debug.hap"
|
||||
# app_name_default = "com.hmos.diagnosis"
|
||||
#
|
||||
# # default
|
||||
# assert check_app_install(package_hap, app_name_default)
|
||||
# assert check_app_uninstall(app_name_default)
|
||||
#
|
||||
# # -r
|
||||
# assert check_app_install(package_hap, app_name_default, "-r")
|
||||
# assert check_app_uninstall(app_name_default)
|
||||
#
|
||||
# # -k
|
||||
# assert check_app_install(package_hap, app_name_default, "-r")
|
||||
# assert check_app_uninstall(app_name_default, "-k")
|
||||
#
|
||||
# # -s
|
||||
# assert check_app_install(package_hap, 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",
|
||||
# "ActsAudioRecorderJsTest.hap" : "ohos.acts.multimedia.audio.audiorecorder"
|
||||
# }
|
||||
# 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 = {
|
||||
# "entry-default-signed-debug.hap" : "com.hmos.diagnosis",
|
||||
# "ActsAudioRecorderJsTest.hap" : "ohos.acts.multimedia.audio.audiorecorder"
|
||||
# }
|
||||
# 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",
|
||||
# "libB_v10001.hsp" : "com.example.libb",
|
||||
# }
|
||||
# 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():
|
||||
# assert check_hdc_cmd("kill", "Kill server finish")
|
||||
# assert check_hdc_cmd("start server", "")
|
||||
#
|
||||
#
|
||||
# def test_target_cmd():
|
||||
# assert check_hdc_targets()
|
||||
# time.sleep(3)
|
||||
# check_hdc_cmd("target boot")
|
||||
# time.sleep(60) # reboot needs at least 60 seconds
|
||||
# assert (check_hdc_cmd("target mount", "Mount finish") or
|
||||
# check_hdc_cmd("target mount", "[Fail]Operate need running as root") or
|
||||
# check_hdc_cmd("target mount", "Remount successful.")
|
||||
# )
|
||||
#
|
||||
#
|
||||
# def test_version_cmd():
|
||||
# version = "Ver: 2.0.0a"
|
||||
# assert check_hdc_version("-v", version)
|
||||
# assert check_hdc_version("version", version)
|
||||
# assert check_hdc_version("checkserver", version)
|
||||
#
|
||||
#
|
||||
# def test_fport_cmd():
|
||||
# fport_list = []
|
||||
# rport_list = []
|
||||
# start_port = 10000
|
||||
# end_port = 10020
|
||||
# for i in range(start_port, end_port):
|
||||
# fport = f"tcp:{i+100} tcp:{i+200}"
|
||||
# rport = f"tcp:{i+300} tcp:{i+400}"
|
||||
# localabs = f"tcp:{i+500} localabstract:{f'helloworld.com.app.{i+600}'}"
|
||||
# fport_list.append(fport)
|
||||
# rport_list.append(rport)
|
||||
# fport_list.append(localabs)
|
||||
#
|
||||
# for fport in fport_list:
|
||||
# assert check_hdc_cmd(f"fport {fport}", "Forwardport result:OK")
|
||||
# assert check_hdc_cmd(f"fport {fport}", "TCP Port listen failed at")
|
||||
# assert check_hdc_cmd("fport ls", fport)
|
||||
#
|
||||
# for fport in fport_list:
|
||||
# assert check_hdc_cmd(f"fport rm {fport}", "success")
|
||||
# assert not check_hdc_cmd("fport ls", fport)
|
||||
#
|
||||
# for rport in rport_list:
|
||||
# assert check_hdc_cmd(f"rport {rport}", "Forwardport result:OK")
|
||||
# assert check_hdc_cmd(f"rport {rport}", "TCP Port listen failed at")
|
||||
# assert check_hdc_cmd("rport ls", rport) or check_hdc_cmd("fport ls", rport)
|
||||
#
|
||||
# for rport in rport_list:
|
||||
# assert check_hdc_cmd(f"rport rm {rport}", "success")
|
||||
# assert not check_hdc_cmd("rport ls", fport) and not check_hdc_cmd("fport ls", fport)
|
||||
#
|
||||
# task_str1 = "tcp:33333 tcp:33333"
|
||||
# assert check_hdc_cmd(f"fport {task_str1}", "Forwardport result:OK")
|
||||
# assert check_hdc_cmd(f"fport rm {task_str1}", "success")
|
||||
# assert check_hdc_cmd(f"fport {task_str1}", "Forwardport result:OK")
|
||||
# assert check_hdc_cmd(f"fport rm {task_str1}", "success")
|
||||
#
|
||||
# task_str2 = "tcp:44444 tcp:44444"
|
||||
# assert check_hdc_cmd(f"rport {task_str2}", "Forwardport result:OK")
|
||||
# assert check_hdc_cmd(f"rport rm {task_str2}", "success")
|
||||
# assert check_hdc_cmd(f"rport {task_str2}", "Forwardport result:OK")
|
||||
# assert check_hdc_cmd(f"rport rm {task_str2}", "success")
|
||||
#
|
||||
#
|
||||
# def test_shell_cmd_timecost():
|
||||
# assert check_cmd_time(
|
||||
# cmd="shell \"ps -ef | grep hdcd\"",
|
||||
# pattern="hdcd",
|
||||
# duration=None,
|
||||
# times=10)
|
||||
#
|
||||
#
|
||||
# def test_hdcd_rom():
|
||||
# baseline = 2200 # 2200KB
|
||||
# assert check_rom(baseline)
|
||||
#
|
||||
#
|
||||
# def test_smode_r():
|
||||
# assert check_hdc_cmd(f'smode -r')
|
||||
# run_command_with_timeout("hdc wait", 5)
|
||||
# assert check_shell(f"shell id", "context=u:r:sh:s0")
|
||||
#
|
||||
#
|
||||
# def test_smode():
|
||||
# assert check_hdc_cmd(f'smode')
|
||||
# run_command_with_timeout("hdc wait", 5)
|
||||
# assert check_shell(f"shell id", "context=u:r:su:s0")
|
||||
#
|
||||
#
|
||||
# def setup_class():
|
||||
# print("setting up env ...")
|
||||
# check_hdc_cmd("shell rm -rf data/local/tmp/it_*")
|
||||
# GP.load()
|
||||
#
|
||||
#
|
||||
# def teardown_class():
|
||||
# pass
|
||||
|
||||
|
||||
def run_main():
|
||||
|
Loading…
x
Reference in New Issue
Block a user