Home
last modified time | relevance | path

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

123

/Zephyr-Core-3.5.0/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()
45 ret = ring_buf_put(&mock->tx_rb, buf, size); in modem_backend_mock_transmit()
[all …]
Dmodem_backend_mock.h18 struct modem_backend_mock *mock; member
54 struct modem_pipe *modem_backend_mock_init(struct modem_backend_mock *mock,
57 void modem_backend_mock_reset(struct modem_backend_mock *mock);
59 int modem_backend_mock_get(struct modem_backend_mock *mock, uint8_t *buf, size_t size);
61 void modem_backend_mock_put(struct modem_backend_mock *mock, const uint8_t *buf, size_t size);
63 void modem_backend_mock_prime(struct modem_backend_mock *mock,
/Zephyr-Core-3.5.0/scripts/tests/twister/
Dtest_handlers.py10 import mock
37 instance = mock.Mock()
39 testsuite = mock.Mock()
40 type(testsuite).source_dir = mock.PropertyMock(return_value='')
45 type(instance).build_dir = mock.PropertyMock(return_value=str(build_dir))
47 platform = mock.Mock()
48 type(platform).binaries = mock.PropertyMock(return_value=[])
51 type(instance.testsuite).timeout = mock.PropertyMock(return_value=60)
52 type(instance.platform).timeout_multiplier = mock.PropertyMock(
110 with mock.patch('os.name', os_name), \
[all …]
Dtest_environment.py9 import mock
153 with mock.patch('sys.argv', ['twister'] + args):
159 which_mock = mock.Mock(side_effect=mock_which)
161 with mock.patch('os.name', os_name) \
163 mock.patch('shutil.which', which_mock) \
165 mock.patch('twisterlib.environment' \
180 with mock.patch('sys.argv', ['twister'] + args):
183 mock_calc_parent = mock.Mock()
184 mock_calc_parent.child = mock.Mock(return_value=mock.Mock())
189 with mock.patch('twisterlib.size_calc.SizeCalculator', mock_calc):
[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_testsuite.py10 import mock
248 with mock.patch('mmap.mmap', mock.Mock(side_effect=assert_mmap)), \
249 mock.patch('builtins.open', mock.mock_open(read_data='dummy data')), \
250 mock.patch('os.name', os_name), \
251 mock.patch('contextlib.closing', raise_exception):
370 mock.Mock(
371 start=mock.Mock(return_value=0),
372 end=mock.Mock(return_value=0)
381 mock.Mock(
382 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_runner.py9 import mock
25 instance = mock.Mock()
26 testsuite = mock.Mock()
29 platform = mock.Mock()
40 env = mock.Mock()
41 options = mock.Mock()
48 jobserver = mock.Mock()
80 @mock.patch("os.path.exists")
Dtest_log_helper.py10 import mock
35 with mock.patch('platform.system', return_value=system):
/Zephyr-Core-3.5.0/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()
92 if (mock.do_check == false) { in log_frontend_msg()
96 mock.msg_proc_idx++; in log_frontend_msg()
137 mock.panic = true; in log_frontend_panic()
/Zephyr-Core-3.5.0/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-Core-3.5.0/scripts/west_commands/tests/
Dtest_canopen_program.py7 from unittest.mock import patch, call
67 mock = cpd.return_value
68 mock.flash_status.return_value = 0
69 mock.wait_for_flash_status_ok.return_value = 0
70 mock.swid.return_value = 0
97 mock.connect.assert_called_once()
100 mock.wait_for_flash_status_ok.assert_called_with(timeout)
101 mock.swid.assert_called_once()
102 mock.enter_pre_operational.assert_called_once()
103 mock.zephyr_confirm_program.assert_called_once()
[all …]
/Zephyr-Core-3.5.0/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-Core-3.5.0/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-Core-3.5.0/tests/subsys/modem/modem_chat/src/
Dmain.c27 static struct modem_backend_mock mock; variable
270 mock_pipe = modem_backend_mock_init(&mock, &mock_config); in test_modem_chat_setup()
282 modem_backend_mock_reset(&mock); in test_modem_chat_before()
314 modem_backend_mock_get(&mock, buffer, ARRAY_SIZE(buffer)); in ZTEST()
318 modem_backend_mock_put(&mock, at_response, sizeof(at_response) - 1); in ZTEST()
319 modem_backend_mock_put(&mock, ok_response, sizeof(ok_response) - 1); in ZTEST()
328 modem_backend_mock_get(&mock, buffer, ARRAY_SIZE(buffer)); in ZTEST()
332 modem_backend_mock_put(&mock, ok_response, sizeof(ok_response) - 1); in ZTEST()
342 modem_backend_mock_get(&mock, buffer, ARRAY_SIZE(buffer)); in ZTEST()
346 modem_backend_mock_put(&mock, imei_response, sizeof(imei_response) - 1); in ZTEST()
[all …]
/Zephyr-Core-3.5.0/scripts/pylib/pytest-twister-harness/tests/fixtures/
Dmcumgr_fixture_test.py8 from unittest import mock
17 @mock.patch('twister_harness.helpers.mcumgr.MCUmgr.run_command', return_value='')
19 patched_run_command: mock.Mock, mcumgr: MCUmgr
47 mcumgr.run_command = mock.Mock(return_value=cmd_output)
67 mcumgr.run_command = mock.Mock(return_value=cmd_output)
/Zephyr-Core-3.5.0/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-Core-3.5.0/tests/drivers/sensor/ina230/src/
Dina230_test.c19 const struct emul *mock; member
54 ina230_mock_set_register(fixture->mock->data, INA230_REG_BUS_VOLT, 9584); in test_datasheet_example()
55 ina230_mock_set_register(fixture->mock->data, INA230_REG_CURRENT, 10000); in test_datasheet_example()
56 ina230_mock_set_register(fixture->mock->data, INA230_REG_POWER, 4792); in test_datasheet_example()
86 zassert_ok(ina230_mock_get_register(fixture->mock->data, INA230_REG_CALIB, in test_shunt_cal()
113 ina230_mock_set_register(fixture->mock->data, INA230_REG_CURRENT, current_register); in test_current()
127 zassert_not_null(fixture->mock); in test_bus_voltage()
142 ina230_mock_set_register(fixture->mock->data, INA230_REG_BUS_VOLT, in test_bus_voltage()
178 ina230_mock_set_register(fixture->mock->data, INA230_REG_POWER, power_register); in test_power()
196 .mock = EMUL_DT_GET(DT_DRV_INST(inst)), \
/Zephyr-Core-3.5.0/scripts/tests/build_helpers/
Dtest_domains.py9 import mock
42 return mock.mock_open(read_data=f_contents)(args, kwargs)
45 init_mock = mock.Mock(return_value=None)
47 with mock.patch('domains.Domains.__init__', init_mock), \
48 mock.patch('builtins.open', mock_open), \
115 with mock.patch('domains.Domain', side_effect=mock_domain), \
/Zephyr-Core-3.5.0/tests/subsys/modem/modem_ppp/
DCMakeLists.txt8 target_sources(app PRIVATE src/main.c ../mock/modem_backend_mock.c)
9 include_directories(../mock)
/Zephyr-Core-3.5.0/tests/subsys/modem/modem_chat/
DCMakeLists.txt8 target_sources(app PRIVATE src/main.c ../mock/modem_backend_mock.c)
9 target_include_directories(app PRIVATE ../mock)
/Zephyr-Core-3.5.0/tests/subsys/modem/modem_cmux/
DCMakeLists.txt8 target_sources(app PRIVATE src/main.c ../mock/modem_backend_mock.c)
9 target_include_directories(app PRIVATE ../mock)
/Zephyr-Core-3.5.0/tests/subsys/modem/modem_ppp/src/
Dmain.c34 static struct modem_backend_mock mock; variable
278 mock_pipe = modem_backend_mock_init(&mock, &mock_config); in test_modem_ppp_setup()
295 modem_backend_mock_reset(&mock); in test_modem_ppp_before()
307 modem_backend_mock_put(&mock, ppp_frame_wrapped, sizeof(ppp_frame_wrapped)); in ZTEST()
335 modem_backend_mock_put(&mock, corrupt_start_end_ppp_frame_wrapped, in ZTEST()
379 ret = modem_backend_mock_get(&mock, buffer, sizeof(buffer)); in ZTEST()
391 modem_backend_mock_put(&mock, ip_frame_wrapped, sizeof(ip_frame_wrapped)); in ZTEST()
434 ret = modem_backend_mock_get(&mock, buffer, sizeof(buffer)); in ZTEST()
462 ret = modem_backend_mock_get(&mock, buffer, TEST_MODEM_PPP_MOCK_PIPE_RX_BUF_SIZE); in ZTEST()
484 ret = modem_backend_mock_get(&mock, buffer, TEST_MODEM_PPP_MOCK_PIPE_RX_BUF_SIZE); in ZTEST()
[all …]
/Zephyr-Core-3.5.0/scripts/tests/twister_blackbox/
Dtest_printouts.py10 import mock
19 @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock)
102 with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
130 with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
159 with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \

123