Home
last modified time | relevance | path

Searched refs:mock (Results 1 – 25 of 88) sorted by relevance

1234

/Zephyr-latest/tests/subsys/modem/mock/
Dmodem_backend_mock.c13 struct modem_backend_mock *mock = (struct modem_backend_mock *)data; in modem_backend_mock_open() local
15 modem_pipe_notify_opened(&mock->pipe); in modem_backend_mock_open()
19 static bool modem_backend_mock_update(struct modem_backend_mock *mock, const uint8_t *buf, in modem_backend_mock_update() argument
22 if (mock->transaction == NULL) { in modem_backend_mock_update()
27 __ASSERT(buf[i] == mock->transaction->get[mock->transaction_match_cnt], in modem_backend_mock_update()
30 mock->transaction_match_cnt++; in modem_backend_mock_update()
31 if (mock->transaction_match_cnt == mock->transaction->get_size) { in modem_backend_mock_update()
41 struct modem_backend_mock *mock = (struct modem_backend_mock *)data; in modem_backend_mock_transmit() local
44 size = (mock->limit < size) ? mock->limit : size; in modem_backend_mock_transmit()
46 if (mock->bridge) { in modem_backend_mock_transmit()
[all …]
Dmodem_backend_mock.h50 struct modem_pipe *modem_backend_mock_init(struct modem_backend_mock *mock,
53 void modem_backend_mock_reset(struct modem_backend_mock *mock);
55 int modem_backend_mock_get(struct modem_backend_mock *mock, uint8_t *buf, size_t size);
57 void modem_backend_mock_put(struct modem_backend_mock *mock, const uint8_t *buf, size_t size);
59 void modem_backend_mock_prime(struct modem_backend_mock *mock,
/Zephyr-latest/scripts/tests/twister/
Dtest_runner.py10 import mock
41 instance = mock.Mock()
42 testsuite = mock.Mock()
45 platform = mock.Mock()
57 env = mock.Mock()
58 options = mock.Mock()
66 jobserver = mock.Mock()
98 @mock.patch("os.path.exists")
245 testsuite_mock = mock.Mock()
246 platform_mock = mock.Mock()
[all …]
Dtest_handlers.py11 import mock
43 instance = mock.Mock()
45 testsuite = mock.Mock()
46 type(testsuite).source_dir = mock.PropertyMock(return_value='')
51 type(instance).build_dir = mock.PropertyMock(return_value=str(build_dir))
53 platform = mock.Mock()
54 type(platform).binaries = mock.PropertyMock(return_value=[])
57 type(instance.testsuite).timeout = mock.PropertyMock(return_value=60)
58 type(instance.platform).timeout_multiplier = mock.PropertyMock(
116 with mock.patch('os.name', os_name), \
[all …]
Dtest_jobserver.py10 import mock
78 proc_mock = mock.Mock()
79 popen_mock = mock.Mock(return_value=proc_mock)
82 with mock.patch('subprocess.Popen', popen_mock), \
83 mock.patch('os.environ', env_mock):
104 inherit_read_fd = mock.Mock()
105 inherit_write_fd = mock.Mock()
109 internal_read_fd = mock.Mock()
110 internal_write_fd = mock.Mock()
115 close_mock = mock.Mock()
[all …]
Dtest_hardwaremap.py9 import mock
34 hm = HardwareMap(env=mock.Mock())
44 {'baud': 115200, 'lock': mock.ANY, 'flash_timeout': 60},
70 'lock': mock.ANY,
118 ('ghm.yaml', mock.ANY, mock.ANY, [], mock.ANY, mock.ANY, mock.ANY, 0,
120 (None, False, 'hm.yaml', [], mock.ANY, mock.ANY, mock.ANY, 0,
122 (None, True, 'hm.yaml', [], mock.ANY, mock.ANY, ['fix'], 1,
124 (None, True, 'hm.yaml', ['pX'], mock.ANY, mock.ANY, ['fix'], 1,
167 mocked_hm.scan = mock.Mock()
168 mocked_hm.save = mock.Mock()
[all …]
Dtest_environment.py10 import mock
169 with mock.patch('sys.argv', ['twister'] + args):
175 which_mock = mock.Mock(side_effect=mock_which)
177 with mock.patch('os.name', os_name) \
179 mock.patch('shutil.which', which_mock) \
181 mock.patch('twisterlib.environment' \
196 with mock.patch('sys.argv', ['twister'] + args):
199 mock_calc_parent = mock.Mock()
200 mock_calc_parent.child = mock.Mock(return_value=mock.Mock())
205 with mock.patch('twisterlib.size_calc.SizeCalculator', mock_calc):
[all …]
Dtest_testinstance.py14 import mock
72 env = mock.Mock(
73 options=mock.Mock(
85 with mock.patch('os.name', 'nt'):
91 with mock.patch('os.environ', {'QEMU_BIN_PATH': ''}):
241 testinstance.testcases = [mock.Mock()]
245 with mock.patch(
247 mock.mock_open(read_data='')
249 mock.patch(
251 mock.Mock()
[all …]
Dtest_testplan.py11 import mock
406 testplan = TestPlan(env=mock.Mock())
407 lvl1 = mock.Mock()
409 lvl2 = mock.Mock()
411 lvl3 = mock.Mock()
425 lvl_missed = mock.Mock()
466 testplan = TestPlan(env=mock.Mock())
499 testplan = TestPlan(env=mock.Mock())
500 testplan.options = mock.Mock(sub_test=sub_tests)
503 'ts1': mock.Mock(
[all …]
Dtest_scl.py10 import mock
53 cloader_mock = mock.Mock()
54 loader_mock = mock.Mock()
55 csafeloader_mock = mock.Mock()
56 safeloader_mock = mock.Mock()
57 cdumper_mock = mock.Mock()
58 dumper_mock = mock.Mock()
72 with mock.patch.dict('sys.modules', modules_mock, clear=True), \
73 mock.patch('sys.meta_path', meta_path_mock):
112 with mock.patch.dict('sys.modules', modules_mock, clear=True), \
[all …]
Dtest_config_parser.py12 import mock
67 with mock.patch('builtins.open', mock.mock_open(read_data=yaml_data)):
93 with mock.patch('builtins.open', mock.mock_open(read_data=yaml_data)):
156 with mock.patch('warnings.warn') as warn_mock:
161 warn_mock.assert_called_once_with(*expected_warning, stacklevel=mock.ANY)
176 with mock.patch('builtins.open', mock.mock_open(read_data=yaml_data)):
195 with mock.patch('builtins.open', mock.mock_open(read_data=yaml_data)):
Dtest_testsuite.py10 import mock
264 with mock.patch('mmap.mmap', mock.Mock(side_effect=assert_mmap)), \
265 mock.patch('builtins.open', mock.mock_open(read_data='dummy data')), \
266 mock.patch('os.name', os_name), \
267 mock.patch('contextlib.closing', raise_exception):
386 mock.Mock(
387 start=mock.Mock(return_value=0),
388 end=mock.Mock(return_value=0)
397 mock.Mock(
398 start=mock.Mock(return_value=0),
[all …]
Dtest_cmakecache.py9 import mock
181 with mock.patch('builtins.open', mock.mock_open(read_data=file_data)):
203 with mock.patch('builtins.open', mock.mock_open(read_data=file_data)):
236 with mock.patch('builtins.open', mock.mock_open(read_data=file_data)):
252 with mock.patch('builtins.open', mock.mock_open(read_data=file_data)):
Dtest_harness.py9 import mock
184 mock.patch.object(Harness, "parse_record", return_value=None)
198 mock_platform = mock.Mock()
202 mock_testsuite = mock.Mock(id="id", testcases=[])
229 mock_platform = mock.Mock()
233 mock_testsuite = mock.Mock(id="id", testcases=[])
272 handler = mock.Mock()
279 mock_platform = mock.Mock()
283 mock_testsuite = mock.Mock(id="id", testcases=[mock.Mock()])
295 open_mock = mock.mock_open()
[all …]
/Zephyr-latest/tests/subsys/logging/log_api/src/
Dmock_backend.c13 struct mock_log_backend *mock = backend->cb->ctx; in mock_log_backend_reset() local
15 mock->msg_rec_idx = 0; in mock_log_backend_reset()
16 mock->msg_proc_idx = 0; in mock_log_backend_reset()
17 mock->do_check = true; in mock_log_backend_reset()
18 mock->exp_drop_cnt = 0; in mock_log_backend_reset()
19 mock->drop_cnt = 0; in mock_log_backend_reset()
20 mock->panic = false; in mock_log_backend_reset()
25 struct mock_log_backend *mock = backend->cb->ctx; in mock_log_backend_check_enable() local
27 mock->do_check = true; in mock_log_backend_check_enable()
32 struct mock_log_backend *mock = backend->cb->ctx; in mock_log_backend_check_disable() local
[all …]
Dmock_frontend.c19 static struct mock_log_backend mock; variable
21 .ctx = &mock
35 mock.do_check = true; in mock_log_frontend_check_enable()
40 mock.do_check = false; in mock_log_frontend_check_disable()
90 struct mock_log_backend_msg *exp_msg = &mock.exp_msgs[mock.msg_proc_idx]; in log_frontend_msg()
93 if (mock.do_check == false) { in log_frontend_msg()
97 mock.msg_proc_idx++; in log_frontend_msg()
143 mock.panic = true; in log_frontend_panic()
/Zephyr-latest/scripts/build/
Dcheck_init_priorities_test.py9 import mock
58 @mock.patch("check_init_priorities.ZephyrInitLevels.__init__", return_value=None)
60 mock_elf = mock.Mock()
62 sts = mock.Mock(spec=SymbolTableSection)
63 rel = mock.Mock(spec=Section)
66 s0 = mock.Mock()
73 s1 = mock.Mock()
76 s2 = mock.Mock()
91 @mock.patch("check_init_priorities.ZephyrInitLevels.__init__", return_value=None)
93 mock_elf = mock.Mock()
[all …]
/Zephyr-latest/scripts/west_commands/tests/
Dtest_canopen_program.py7 from unittest.mock import patch, call
70 mock = cpd.return_value
71 mock.flash_status.return_value = 0
72 mock.wait_for_flash_status_ok.return_value = 0
73 mock.swid.return_value = 0
102 mock.connect.assert_called_once()
105 mock.wait_for_flash_status_ok.assert_called_with(timeout)
106 mock.swid.assert_called_once()
107 mock.enter_pre_operational.assert_called_once()
108 mock.zephyr_confirm_program.assert_called_once()
[all …]
/Zephyr-latest/tests/subsys/logging/log_links/src/
Dmock_log_link.c11 struct mock_log_link *mock = (struct mock_log_link *)link->ctx; in initiate() local
13 link->ctrl_blk->domain_cnt = mock->domain_cnt; in initiate()
15 for (int i = 0; i < mock->domain_cnt; i++) { in initiate()
16 link->ctrl_blk->source_cnt[i] = mock->domains[i]->source_cnt; in initiate()
30 struct mock_log_link *mock = (struct mock_log_link *)link->ctx; in get_domain_name() local
32 *length = strlen(mock->domains[domain_id]->name); in get_domain_name()
35 strncpy(buf, mock->domains[domain_id]->name, *length); in get_domain_name()
44 struct mock_log_link *mock = (struct mock_log_link *)link->ctx; in get_source_name() local
46 strncpy(buf, mock->domains[domain_id]->sources[source_id].source, in get_source_name()
48 *length = strlen(mock->domains[domain_id]->sources[source_id].source); in get_source_name()
[all …]
/Zephyr-latest/scripts/pylib/pytest-twister-harness/tests/device/
Dhardware_adapter_test.py8 from unittest import mock
32 @mock.patch('shutil.which', return_value=None)
38 @mock.patch('shutil.which', return_value='west')
46 @mock.patch('shutil.which', return_value='west')
57 @mock.patch('shutil.which', return_value='west')
68 @mock.patch('shutil.which', return_value='west')
81 @mock.patch('shutil.which', return_value='west')
94 @mock.patch('shutil.which', return_value='west')
106 @mock.patch('shutil.which', return_value='west')
118 @mock.patch('shutil.which', return_value='west')
[all …]
/Zephyr-latest/scripts/tests/twister_blackbox/
Dtest_hardwaremap.py9 import mock
19 @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock)
121 mock.Mock(device='/dev/ttyUSB23',
131 with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
132 mock.patch('serial.tools.list_ports.comports',
173 mock.Mock(device='/dev/ttyUSB23',
178 mock.Mock(device='/dev/ttyUSB24',
183 mock.Mock(device='/dev/ttyUSB24',
188 mock.Mock(device='/dev/ttyUSB25',
195 with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
[all …]
Dtest_addon.py10 import mock
45 @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock)
56 with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
72 @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock)
83 with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
105 @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock)
116 with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
129 @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock)
141 with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
160 @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock)
[all …]
/Zephyr-latest/tests/subsys/modem/modem_chat/src/
Dmain.c27 static struct modem_backend_mock mock; variable
282 mock_pipe = modem_backend_mock_init(&mock, &mock_config); in test_modem_chat_setup()
294 modem_backend_mock_reset(&mock); in test_modem_chat_before()
326 modem_backend_mock_get(&mock, buffer, ARRAY_SIZE(buffer)); in ZTEST()
330 modem_backend_mock_put(&mock, at_response, sizeof(at_response) - 1); in ZTEST()
331 modem_backend_mock_put(&mock, ok_response, sizeof(ok_response) - 1); in ZTEST()
340 modem_backend_mock_get(&mock, buffer, ARRAY_SIZE(buffer)); in ZTEST()
344 modem_backend_mock_put(&mock, ok_response, sizeof(ok_response) - 1); in ZTEST()
354 modem_backend_mock_get(&mock, buffer, ARRAY_SIZE(buffer)); in ZTEST()
358 modem_backend_mock_put(&mock, imei_response, sizeof(imei_response) - 1); in ZTEST()
[all …]
/Zephyr-latest/tests/drivers/sensor/ina237/src/
Dina237_test.c19 const struct emul *mock; member
62 zassert_ok(ina237_mock_get_register(fixture->mock->data, INA237_REG_CALIB, in test_shunt_cal()
89 ina237_mock_set_register(fixture->mock->data, INA237_REG_CURRENT, current_register); in test_current()
103 zassert_not_null(fixture->mock); in test_bus_voltage()
118 ina237_mock_set_register(fixture->mock->data, INA237_REG_BUS_VOLT, in test_bus_voltage()
154 ina237_mock_set_register(fixture->mock->data, INA237_REG_POWER, power_register); in test_power()
168 zassert_not_null(fixture->mock); in test_temperature()
185 ina237_mock_set_register(fixture->mock->data, INA237_REG_DIETEMP, in test_temperature()
202 zassert_not_null(fixture->mock); in test_vshunt()
221 ina237_mock_set_register(fixture->mock->data, INA237_REG_SHUNT_VOLT, in test_vshunt()
[all …]
/Zephyr-latest/scripts/pylib/pytest-twister-harness/tests/fixtures/
Dmcumgr_fixture_test.py6 from unittest import mock
17 @mock.patch('twister_harness.helpers.mcumgr.MCUmgr.run_command', return_value='')
19 patched_run_command: mock.Mock, mcumgr: MCUmgr
50 mcumgr.run_command = mock.Mock(return_value=cmd_output)
70 mcumgr.run_command = mock.Mock(return_value=cmd_output)

1234