1import logging
2import re
3
4import pytest
5
6
7class Test:
8    pid_list = [
9        'com.ohos.launcher',
10        'render_service',
11    ]
12
13    ps_list = [
14        'hdf_devmgr',
15        'param_watcher',
16        'storage_manager',
17        'appspawn',
18        'hilogd',
19        'samgr',
20        'storage_daemon',
21        'uinput_inject',
22        'multimodalinput',
23        'huks_service',
24        'memmgrservice',
25        'bluetooth_servi',
26        'resource_schedu',
27        'bgtaskmgr_servi',
28        'audio_server',
29        'deviceauth_service',
30        'softbus_server',
31        'wifi_hal_service',
32        'faultloggerd',
33        'accountmgr',
34        'time_service',
35        'distributeddata',
36        'useriam',
37        'inputmethod_ser',
38        'ui_service',
39        'netmanager',
40        'sensors',
41        'media_service',
42        'wifi_manager_se',
43        'installs',
44        'hiview',
45        'telephony',
46        'camera_service',
47        'foundation',
48        'hdcd',
49        'light_host',
50        'vibrator_host',
51        'sensor_host',
52        'input_user_host',
53        'camera_host',
54        'audio_host',
55        'wifi_host',
56        'usb_host',
57        'blue_host',
58        'wifi_hal_service',
59        'com.ohos.systemui',
60        'power_host',
61    ]
62
63    @pytest.mark.parametrize('setup_teardown', [None], indirect=True)
64    def test(self, setup_teardown, device):
65        lost_process = []
66        logging.info('check pid is exist or not')
67        for process in self.pid_list:
68            pid = device.get_pid(process)
69            if not re.search(r'\d+', pid):
70                lost_process.append(process)
71
72        ps_elf_rst = device.hdc_shell('ps -elf')
73        for pname in self.ps_list:
74            if pname not in ps_elf_rst:
75                lost_process.append(pname)
76
77        logging.info('lost process are {}'.format(lost_process))
78        assert not lost_process
79