Home
last modified time | relevance | path

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

123

/Zephyr-Core-3.6.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()
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-Core-3.6.0/scripts/tests/twister/
Dtest_runner.py10 import mock
40 instance = mock.Mock()
41 testsuite = mock.Mock()
44 platform = mock.Mock()
55 env = mock.Mock()
56 options = mock.Mock()
63 jobserver = mock.Mock()
95 @mock.patch("os.path.exists")
235 testsuite_mock = mock.Mock()
236 platform_mock = mock.Mock()
[all …]
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_jobserver.py10 import mock
80 proc_mock = mock.Mock()
81 popen_mock = mock.Mock(return_value=proc_mock)
84 with mock.patch('subprocess.Popen', popen_mock), \
85 mock.patch('os.environ', env_mock):
107 inherit_read_fd = mock.Mock()
108 inherit_write_fd = mock.Mock()
112 internal_read_fd = mock.Mock()
113 internal_write_fd = mock.Mock()
118 close_mock = mock.Mock()
[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_hardwaremap.py9 import mock
34 hm = HardwareMap(env=mock.Mock())
44 {'baud': 115200, 'lock': mock.ANY, 'flash_timeout': 60},
65 'lock': mock.ANY,
108 ('ghm.yaml', mock.ANY, mock.ANY, [], mock.ANY, mock.ANY, mock.ANY, 0,
110 (None, False, 'hm.yaml', [], mock.ANY, mock.ANY, mock.ANY, 0,
112 (None, True, 'hm.yaml', [], mock.ANY, mock.ANY, ['fix'], 1,
114 (None, True, 'hm.yaml', ['pX'], mock.ANY, mock.ANY, ['fix'], 1,
157 mocked_hm.scan = mock.Mock()
158 mocked_hm.save = mock.Mock()
[all …]
Dtest_testplan.py11 import mock
401 testplan = TestPlan(env=mock.Mock())
402 lvl1 = mock.Mock()
404 lvl2 = mock.Mock()
406 lvl3 = mock.Mock()
456 testplan = TestPlan(env=mock.Mock())
489 testplan = TestPlan(env=mock.Mock())
490 testplan.options = mock.Mock(sub_test=sub_tests)
493 'ts1': mock.Mock(
495 mock.Mock(),
[all …]
Dtest_testinstance.py14 import mock
74 with mock.patch('os.name', 'nt'):
407 (True, mock.ANY, mock.ANY, mock.ANY, None, [], False),
408 (False, True, mock.ANY, mock.ANY, 'device', [], True),
409 (False, False, 'qemu', mock.ANY, 'qemu', ['QEMU_PIPE=1'], True),
410 (False, False, 'dummy sim', mock.ANY, 'dummy sim', [], True),
433 testinstance.handler = mock.Mock() if preexisting_handler else None
437 env = mock.Mock(
438 options=mock.Mock(
444 with mock.patch.object(QEMUHandler, 'get_fifo', return_value=1), \
[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_harness.py9 import mock
78 mock_platform = mock.Mock()
81 mock_testsuite = mock.Mock(id = 'id', testcases = [])
101 mock_platform = mock.Mock()
104 mock_testsuite = mock.Mock(id = 'id', testcases = [])
135 handler = mock.Mock()
141 mock_platform = mock.Mock()
144 mock_testsuite = mock.Mock(id = 'id', testcases = [mock.Mock()])
151 open_mock = mock.mock_open()
156 proc_mock = mock.Mock(
[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)):
/Zephyr-Core-3.6.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.6.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.6.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.6.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.6.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.6.0/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_testplan.py10 import mock
61 @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock)
72 with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
93 @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock)
102 with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
126 @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock)
135 with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
156 @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock)
157 @mock.patch.object(TestPlan, 'SAMPLE_FILENAME', '')
167 with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \
/Zephyr-Core-3.6.0/tests/subsys/modem/modem_chat/src/
Dmain.c27 static struct modem_backend_mock mock; variable
269 mock_pipe = modem_backend_mock_init(&mock, &mock_config); in test_modem_chat_setup()
281 modem_backend_mock_reset(&mock); in test_modem_chat_before()
313 modem_backend_mock_get(&mock, buffer, ARRAY_SIZE(buffer)); in ZTEST()
317 modem_backend_mock_put(&mock, at_response, sizeof(at_response) - 1); in ZTEST()
318 modem_backend_mock_put(&mock, ok_response, sizeof(ok_response) - 1); in ZTEST()
327 modem_backend_mock_get(&mock, buffer, ARRAY_SIZE(buffer)); in ZTEST()
331 modem_backend_mock_put(&mock, ok_response, sizeof(ok_response) - 1); in ZTEST()
341 modem_backend_mock_get(&mock, buffer, ARRAY_SIZE(buffer)); in ZTEST()
345 modem_backend_mock_put(&mock, imei_response, sizeof(imei_response) - 1); in ZTEST()
[all …]
/Zephyr-Core-3.6.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.6.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.6.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
50 mcumgr.run_command = mock.Mock(return_value=cmd_output)
70 mcumgr.run_command = mock.Mock(return_value=cmd_output)

123