• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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        'faultloggerd',
32        'accountmgr',
33        'time_service',
34        'distributeddata',
35        'useriam',
36        'inputmethod_ser',
37        'ui_service',
38        'netmanager',
39        'sensors',
40        'media_service',
41        'wifi_manager_se',
42        'installs',
43        'hiview',
44        'telephony',
45        'camera_service',
46        'foundation',
47        'hdcd',
48        'light_host',
49        'vibrator_host',
50        'sensor_host',
51        'input_user_host',
52        'camera_host',
53        'audio_host',
54        'wifi_host',
55        'usb_host',
56        'blue_host',
57        'com.ohos.systemui',
58        'power_host',
59    ]
60
61    @pytest.mark.parametrize('setup_teardown', [None], indirect=True)
62    def test(self, setup_teardown, device):
63        lost_process = []
64        logging.info('check pid is exist or not')
65        for process in self.pid_list:
66            pid = device.get_pid(process)
67            if not re.search(r'\d+', pid):
68                lost_process.append(process)
69
70        ps_elf_rst = device.hdc_shell('ps -elf')
71        for pname in self.ps_list:
72            if pname not in ps_elf_rst:
73                lost_process.append(pname)
74
75        logging.info('lost process are {}'.format(lost_process))
76        assert not lost_process
77