7import isystem.connect
as ic
13def test_cvrg_all_code():
14 cmgr = ic.ConnectionMgr()
15 cmgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
17 debugCtrl = ic.CDebugFacade(cmgr)
21 coverage = ic.CCoverageController2(cmgr,
'sdk_example.trd',
'w')
24 if not coverage.waitUntilLoaded(5000):
25 print(
'isBusy = ', coverage.isBusy())
26 print(
"Warning - timeout ocurred when loading coverage document - some data may not be loaded!")
30 coverage.removeTrigger(
'coverageTrigger')
31 triggerIdx = coverage.createTrigger(
'coverageTrigger')
32 coverage.select(triggerIdx)
35 coverage.setScope(triggerIdx, ic.CCoverageController2.EScopeAllDownloadedCode)
40 print(
'Target is running, coverage is recording data...')
43 coverage.stopSampling()
45 print(
'Target stopped, loading coverage data...')
46 while not coverage.waitUntilLoaded(3000):
47 print(
"winIDEA is analyzing coverage recording, please wait ...!")
48 print(
' isBusy = ', coverage.isBusy())
51 exportCfg = ic.CCoverageExportConfig()
52 exportFmt = ic.CCoverageXMLExportFormat()
53 exportCfg.setFileName(
'coverageSample-1.xml') \
54 .setFormatter(exportFmt) \
55 .setExportModules(
True) \
56 .setExportModuleLines(
True) \
57 .setExportSources(
True) \
58 .setExportFunctions(
True) \
59 .setExportFunctionLines(
True) \
60 .setExportFunctionAsm(
True) \
62 .setExportRanges(
True)
64 coverage.exportData(exportCfg)
68if __name__ ==
"__main__":