Computer Science ›› 2017, Vol. 44 ›› Issue (11): 191-194.doi: 10.11896/j.issn.1002-137X.2017.11.029

Previous Articles     Next Articles

Approach to C++ Code Instrumentation for Coverage Analysis with Clang/LLVM

LI Shu-fang, AN Jin-xia, LIU Yang and CHEN Liang   

  • Online:2018-12-01 Published:2018-12-01

Abstract: In recent years,many safety-critical software system have been running under domestic Linux operating systems,most of which are developed with C++.As C++ is expanding to new revision of the C++ ISO/IEC stan-dards,the existing source code instrumentation tools for coverage analysis cannot satisfy user’s requirements.In this paper,an approach to C++ source code instrumentation for coverage analysis with Clang/LLVM was proposed.Employing the Clang/LLVM library in open source community,which provides C++ source code parsing and manipulation functions,a framework of C++ coverage analysis for statement coverage,branch coverage and MC/DC coverage was constructed.Coverage information was collected in real-time,and was analyzed and exported to reports.Case study shows that the proposed approach is very convenient and practical in real world software testing activities.

Key words: C++,Clang,Code instrumentation,Coverage analysis

[1] AN J X,ZHU J .Software Reliability Modeling with Integrated Test Coverage [C]∥Proceedings of the 4th IEEE International Conference on Secure Software Integration and Reliability Improvement.Singapore,2012:106-112.
[2] YANG Q,LI J,WEISS D,et al.A Survey of Coverage-Based Testing Tools[J].The Computer Journal,2009,52(5):589-597.
[3] MAHRENHOLZ D,SPINCZYK O,SCHRDER-PREIKSCHAT,et al.Program Instrumentation for Debugging and Monitoring with AspectC++ [C]∥Proceedings of Fifth IEEE InternationalSymposium on Object-Oriented Real-Time Distributed Computing.Washington DC,2002:249-256.
[4] URBAN M,LOHMANN D,SPINCZYK O.The Aspect- Oriented Design of the PUMA C/C++ Parser Framework [C]∥Proceedings of the 9th International Conference on Aspect-Oriented Software Development.New York,NY,USA,2010:217-221.
[5] AN J X,WANG G Q,LI S F,et al.Dynamic Evaluation Method Based Multi-Dimensional Test Coverage for Software Testing[J].Journal of Software,2010,1(9):2135-2147.(in Chinese) 安金霞,王国庆,李树芳,等.基于多维度覆盖率的软件测试动态评价方法[J].软件学报,2010,1(9):2135-2147.
[6] DUAN F L,WU X,ZHANG F,et al.Rapidly Generating Algorithm for Minimum Test Case Set on MC/DC[J].Computer Engineering,2009,35(17):40-42.(in Chinese) 段飞雷,吴晓,张凡,等.MC/DC最小测试用例集快速生成算法[J].计算机工程,2009,35(17):40-42.
[7] LI S F,AN J X,ZHENG P F,et al.An Approach to Rapid Test Coverage Analysis for Large-scale Real-time Software [J].Journal of Southwest University of Science and Technology(Natural Science Edition),2013,28(3):89-94.(in Chinese) 李树芳,安金霞,郑鹏飞,等.面向大型实时软件的测试覆盖率快速分析方法[J].西南科技大学学报(自然科学版),2013,28(3):89-94.
[8] LI S F,CHEN X,AN J X,et al.Real-Time Software Memory Error Analysis with C++ Code Instrumentation[J].Journal of Frontiers of Computer Science and Technology,2014,8(6):704-711.(in Chinese) 李树芳,陈霞,安金霞,等.采用C++代码插装的实时软件内存错误分析[J].计算机科学与探索,2014,8(6):704-711.

No related articles found!
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
[1] LEI Li-hui and WANG Jing. Parallelization of LTL Model Checking Based on Possibility Measure[J]. Computer Science, 2018, 45(4): 71 -75, 88 .
[2] XIA Qing-xun and ZHUANG Yi. Remote Attestation Mechanism Based on Locality Principle[J]. Computer Science, 2018, 45(4): 148 -151, 162 .
[3] LI Bai-shen, LI Ling-zhi, SUN Yong and ZHU Yan-qin. Intranet Defense Algorithm Based on Pseudo Boosting Decision Tree[J]. Computer Science, 2018, 45(4): 157 -162 .
[4] WANG Huan, ZHANG Yun-feng and ZHANG Yan. Rapid Decision Method for Repairing Sequence Based on CFDs[J]. Computer Science, 2018, 45(3): 311 -316 .
[5] SUN Qi, JIN Yan, HE Kun and XU Ling-xuan. Hybrid Evolutionary Algorithm for Solving Mixed Capacitated General Routing Problem[J]. Computer Science, 2018, 45(4): 76 -82 .
[6] ZHANG Jia-nan and XIAO Ming-yu. Approximation Algorithm for Weighted Mixed Domination Problem[J]. Computer Science, 2018, 45(4): 83 -88 .
[7] WU Jian-hui, HUANG Zhong-xiang, LI Wu, WU Jian-hui, PENG Xin and ZHANG Sheng. Robustness Optimization of Sequence Decision in Urban Road Construction[J]. Computer Science, 2018, 45(4): 89 -93 .
[8] LIU Qin. Study on Data Quality Based on Constraint in Computer Forensics[J]. Computer Science, 2018, 45(4): 169 -172 .
[9] ZHONG Fei and YANG Bin. License Plate Detection Based on Principal Component Analysis Network[J]. Computer Science, 2018, 45(3): 268 -273 .
[10] SHI Wen-jun, WU Ji-gang and LUO Yu-chun. Fast and Efficient Scheduling Algorithms for Mobile Cloud Offloading[J]. Computer Science, 2018, 45(4): 94 -99, 116 .