Lines Matching refs:device
15 from twister_harness.device.binary_adapter import (
33 …device = NativeSimulatorAdapter(DeviceConfig(build_dir=build_dir, type='native', base_timeout=5.0))
35 yield device
37 device.close() # to make sure all running processes are closed
42 device: NativeSimulatorAdapter, script_path: str
44 device.command = ['python3', script_path]
46 device.launch()
47 yield device
49 device.close() # to make sure all running processes are closed
57 device = launched_device
58 lines = device.readlines_until(regex='Returns with code')
59 device.close()
61 assert os.path.isfile(device.handler_log_path)
62 with open(device.handler_log_path, 'r') as file:
68 device: NativeSimulatorAdapter, script_path: str
71 device.base_timeout = 0.3
72 device.command = ['python3', script_path, '--long-sleep', '--sleep=5']
73 device.launch()
75 device.readlines_until(regex='Returns with code')
76 device.close()
77 assert device._process is None
78 with open(device.handler_log_path, 'r') as file:
84 def test_if_binary_adapter_raises_exception_empty_command(device: NativeSimulatorAdapter) -> None:
85 device.command = []
88 device._flash_and_run()
93 patched_popen, device: NativeSimulatorAdapter
95 device.command = ['echo', 'TEST']
97 device._flash_and_run()
102 patched_popen, device: NativeSimulatorAdapter
104 device.command = ['echo', 'TEST']
106 device._flash_and_run()
111 patched_popen, device: NativeSimulatorAdapter
113 device.command = ['echo', 'TEST']
115 device._flash_and_run()
121 device = launched_device
122 assert device._device_connected.is_set() and device.is_device_connected()
124 device.connect()
131 device.disconnect()
132 assert not device._device_connected.is_set() and not device.is_device_connected()
133 device.disconnect()
145 device = launched_device
146 assert device._device_run.is_set() and device.is_device_running()
147 device.close()
148 assert not device._device_run.is_set() and not device.is_device_running()
150 device.connect()
152 device.write(b'')
153 device.clear_buffer()
155 device.readline()
161 device = launched_device
162 device.disconnect()
164 device.write(b'')
165 device.clear_buffer()
167 device.readline()
171 device: NativeSimulatorAdapter, script_path: str
173 device.command = ['python3', script_path, '--sleep=0.05']
174 device.launch()
175 device.readlines_until(regex='Beautiful is better than ugly.')
177 device.disconnect()
178 assert len(device.readlines()) > 0
179 device.connect()
180 device.readlines_until(regex='Flat is better than nested.')
182 device.close()
183 assert len(device.readlines()) > 0
190 device = shell_simulator_adapter
192 device.write(b'zen\n')
194 lines = device.readlines_until(regex='Namespaces are one honking great idea')
198 def test_if_native_binary_adapter_get_command_returns_proper_string(device: NativeSimulatorAdapter)…
199 device.generate_command()
200 assert isinstance(device.command, list)
201 assert device.command == [str(device.device_config.build_dir / 'zephyr' / 'zephyr.exe')]
206 device = CustomSimulatorAdapter(DeviceConfig(build_dir=tmp_path, type='custom'))
207 device.generate_command()
208 assert isinstance(device.command, list)
209 assert device.command == ['west', 'build', '-d', str(tmp_path), '-t', 'run']
214 device = CustomSimulatorAdapter(DeviceConfig(build_dir=tmp_path, type='custom'))
216 device.generate_command()
220 device = UnitSimulatorAdapter(DeviceConfig(build_dir=tmp_path, type='unit'))
221 device.generate_command()
222 assert isinstance(device.command, list)
223 assert device.command == [str(tmp_path / 'testbinary')]