6import isystem.connect
as ic
12def init_target() -> ic.ConnectionMgr:
13 cmgr = ic.ConnectionMgr()
14 cmgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
16 debug_ctrl = ic.CDebugFacade(cmgr)
17 session_ctrl = ic.CSessionCtrl(cmgr)
19 session_ctrl.begin_reset()
21 debug_ctrl.runUntilFunction(
"main")
22 debug_ctrl.waitUntilStopped()
27def run_test(cmgr: ic.ConnectionMgr):
28 test_controller = ic.CSystemTestController(cmgr)
32 stub_controller = test_controller.createStub(
'process_strings')
35 test_controller.createUserStub(
'get_random',
'stub_demo')
37 test_controller.init()
41 test_controller.waitUntilStopped()
42 testStatus = test_controller.getStatus()
43 if testStatus == ic.IConnectTest.stateStub:
44 print(f
"Stub '{stub_controller.getStubName()}' hit.")
46 raise Exception(f
"Execution did not stop on stub. Status = {testStatus}")
50 test_controller.stop()
52 g_process_counter = int(test_controller.evaluate(
'g_process_counter,d'), 0)
53 if g_process_counter == 0:
54 print(
'OK, function was stubbed!')
56 print(f
'ERROR: function was NOT stubbed! g_process_counter = {g_process_counter}')
58 test_controller.destroy()
68if __name__ ==
'__main__':