6import isystem.connect
as ic
7import test_getCoverageMetaInfo
as cvrg
13def test_getStatistic():
14 connMgr = ic.ConnectionMgr()
15 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
17 ideCtrl = ic.CIDEController(connMgr)
18 xmlFilePath = os.path.join(ideCtrl.getPath(ic.CIDEController.WORKSPACE_DIR),
"cvrgExport.xml")
19 cvrg._exportCoverageToXML(connMgr,
'example.trd',
"cvrgExport.xml")
20 covData = ic.CCoverageData2.createInstance(xmlFilePath,
True)
22 print(f
"Get execution statistics for module 'main' (by name):")
23 stat = covData.getStatistic(ic.CCoverageStatistic2.EModule,
"main.cpp")
24 print(
"\tNumber of called functions:", stat.getExecutionCount(),
"(function 'main')")
25 print(
"\tExecuted lines:", stat.getLinesExecuted(),
"out of:", stat.getLinesAll())
27 print(f
"Get statistics explicitly defined by symbol data:")
28 stat = covData.getStatistic(
"sdk_example_stm32.elf",
'build/debug',
"utils.cpp",
"fibonacci")
29 print(
"\tFunction calls count:", stat.getCallCount())
30 print(
"\tExecuted code (in bytes):", stat.getBytesExecuted(),
"out of:", stat.getBytesAll())
35if __name__ ==
"__main__":