Priority Measurement of Patches for Program Repair Based on Semantic Distance
Abstract
:1. Introduction
2. Related Work
2.1. Repair Strategy
2.2. Patch Prioritization
3. Evaluation of Patch Quality Based on Semantic Distance
3.1. Interval Distance
3.2. Output Coverage
3.3. Path Matching
4. Experiment and Result Analysis
4.1. Method Implementation
4.2. Experimental Data Collection
4.3. Ability to Evaluate Real Patches
4.4. Comparison with Existing Methods
4.5. Ability to Evaluate Patch Quality by Different Features
5. Threats to Validity
6. Conclusions
Author Contributions
Funding
Conflicts of Interest
References
- Gazzola, L.; Micucci, D.; Mariani, L. Automatic Software Repair: A Survey. IEEE Trans. Softw. Eng. 2019, 45, 34–67. [Google Scholar] [CrossRef] [Green Version]
- Le Goues, C.; Nguyen, T.; Forrest, S.; Weimer, W. GenProg: A Generic Method for Automatic Software Repair. IEEE Trans. Softw. Eng. 2012, 38, 54–72. [Google Scholar] [CrossRef]
- Le Goues, C.; Dewey-Vogt, M.; Forrest, S.; Weimer, W. A Systematic Study of Automated Program Repair: Fixing 55 out of 105 Bugs for $8 Each. In Proceedings of the International Conference on Software Engineering, Zurich, Switzerland, 2–9 June 2012. [Google Scholar]
- Wang, S.; Wen, M.; Chen, L.; Yi, X.; Mao, X. How Different Is It Between Machine-Generated and Developer-Provided Patches? An Empirical Study on the Correct Patches Generated by Automated Program Repair Techniques. In Proceedings of the 13th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement, Porto de Galinhas, Brazil, 19–20 September 2019. [Google Scholar]
- Qi, X.; Steven, R. Identifying Test-Suite-Overfitted Patches through Test Case Generation. In ISSTA; ACM: New York, NY, USA, 2017. [Google Scholar] [CrossRef]
- Le, D.X.; Bao, L.; Lo, D.; Xia, X.; Li, S. On Reliability of Patch Correctness Assessment. In Proceedings of the IEEE/ACM 41st International Conference on Software Engineering (ICSE), Montreal, QC, Canada, 25–31 May 2019. [Google Scholar]
- Le, X.B.D.; Lo, D.; Goues, C.L. History Driven Program Repair. In Proceedings of the IEEE International Conference on Software Analysis, Suita, Japan, 14–18 March 2016. [Google Scholar]
- Long, F.; Rinard, M. Automatic Patch Generation by Learning Correct Code. ACM Sigplan Notices 2016, 51, 298–312. [Google Scholar] [CrossRef] [Green Version]
- Yu, Z.; Martinez, M.; Danglot, B.; Durieux, T.; Monperrus, M. Alleviating Patch Overfitting with Automatic Test Generation: A Study of Feasibility and Effectiveness for the Nopol Repair System. Empir. Softw. Eng. 2019, 24, 33–67. [Google Scholar] [CrossRef] [Green Version]
- Xiong, Y.; Liu, X.; Zeng, M.; Zhang, L.; Huang, G. Identifying Patch Correctness in Test-based Program Repair. In Proceedings of the International Conference on Software Engineering, Gothenburg, Sweden, 27 May–3 June 2018; ACM: New York, NY, USA, 2018. [Google Scholar] [CrossRef] [Green Version]
- Xuan, J.; Martinez, M.; Demarco, F.; Clement, M.; Marcote, S.L.; Durieux, T.; Le Berre, D.; Monperrus, M. Nopol: Automatic Repair of Conditional Statement Bugs in Java Programs. IEEE Trans. Softw. Eng. 2017, 43, 34–55. [Google Scholar] [CrossRef] [Green Version]
- DeMarco, F.; Xuan, J.; Le Berre, D.; Monperrus, M. Automatic Repair of Buggy If Conditions and Missing Preconditions with SMT. In Proceedings of the 6th International Workshop on Constraints in Software Testing, Verification, and Analysis, CSTVA 2014, Hyderabad, India, 31 May 2014; ACM: New York, NY, USA, 2014. [Google Scholar] [CrossRef] [Green Version]
- Durieux, T.; Monperrus, M. DynaMoth: Dynamic Code Synthesis for Automatic Program Repair. In Proceedings of the International Workshop on Automation of Software Test; ACM: New York, NY, USA, 2016. [Google Scholar] [CrossRef] [Green Version]
- Xiong, Y.; Wang, J.; Yan, R.; Zhang, J.; Han, S.; Huang, G.; Zhang, L. Precise Condition Synthesis for Program Repair. In Proceedings of the 2017 IEEE/ACM 39th International Conference on Software Engineering (ICSE), Buenos Aires, Argentina, 20–28 May 2017. [Google Scholar]
- Matias, M.; Martin, M. ASTOR: A Program Repair Library for Java. In Proceedings of the International Symposium on Software Testing & Analysis, Saarbrücken, Germany, 18–20 July 2016; ACM: New York, NY, USA, 2016. [Google Scholar]
- Wen, M.; Chen, J.; Wu, R.; Hao, D.; Cheung, S.C. Context-Aware Patch Generation for Better Automated Program Repair. In Proceedings of the 2018 IEEE/ACM 40th International Conference on Software Engineering (ICSE), Gothenburg, Sweden, 27 May–3 June 2018. [Google Scholar]
- Saha, R.K.; Lyu, Y.; Yoshida, H.; Prasad, M.R. Elixir: Effective Object-oriented Program Repair. In Proceedings of the 2017 32nd IEEE/ACM International Conference on Automated Software Engineering (ASE), Urbana, IL, USA, 30 October–3 November 2017; pp. 648–659. [Google Scholar]
- Xin, Q.; Reiss, S.P. Leveraging Syntax-related Code for Automated Program Repair. In Proceedings of the IEEE/ACM International Conference on Automated Software Engineering, Urbana, IL, USA, 30 October–3 November 2017; pp. 660–670. [Google Scholar]
- Nguyen, H.D.; Qi, D.; Roychoudhury, A.; Chandra, S. SemFix: Program Repair via Semantic Analysis. In Proceedings of the International Conference on Software Engineering, San Francisco, CA, USA, 18–26 May 2013. [Google Scholar]
- Jiang, J.; Xiong, Y.; Zhang, H.; Gao, Q.; Chen, X. Shaping Program Repair Space with Existing Patches and Similar Code. In Proceedings of the International Symposium on Software Testing & Analysis; ACM: New York, NY, USA, 2018; pp. 298–309. [Google Scholar]
- Lou, Y.; Ghanbari, A.; Li, X.; Zhang, L.; Zhang, H.; Hao, D.; Zhang, L. Can Automated Program Repair Refine Fault Localization? A Unified Debugging Approach. In ISSTA’20: 29th ACM SIGSOFT International Symposium on Software Testing and Analysis; ACM: New York, NY, USA, 2020; pp. 75–87. [Google Scholar]
- Qi, Z.; Long, F.; Achour, S.; Rinard, M. An Analysis of Patch Plausibility and Correctness for Generate-and-validate Patch Generation Systems. In Proceedings of the 2015 International Symposium on Software Testing and Analysis, Baltimore, MD, USA, 12–17 July 2015; ACM: New York, NY, USA, 2015; pp. 24–36. [Google Scholar]
- Tao, Y.; Kim, J.; Kim, S.; Xu, C. Automatically Generated Patches as Debugging Aids: A Human Study. In FSE 2014: Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering; ACM: New York, NY, USA, 2014; pp. 64–74. [Google Scholar]
- javalang. Available online: https://github.com/c2nes/javalang (accessed on 30 March 2020).
- Martinez, M.; Durieux, T.; Sommerard, R.; Xuan, J.; Monperrus, M. Automatic repair of real bugs in Java: A large-scale experiment on the Defects4J dataset. Empir. Softw. Eng. 2016, 22, 1936–1964. [Google Scholar] [CrossRef] [Green Version]
- Smith, E.K.; Barr, E.T.; Le Goues, C.; Brun, Y. Is the Cure Worse Than the Disease? Overfitting in Automated Program Repair. In ESEC/FSE 2015: Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering; ACM: New York, NY, USA, 2015; pp. 532–543. [Google Scholar]
- Tan, S.H.; Yoshida, H.; Prasad, M.R.; Roychoudhury, A. Anti-patterns in Search-Based Program Repair. In FSE 2016: Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering; ACM: New York, NY, USA, 2016; pp. 727–738. [Google Scholar]
- Thomas, D.; Martin, M. IntroClassJava: A Benchmark of 297 Small and Buggy Java Programs. Ph.D. Thesis, Universite Lille 1, Villeneuve-d’Ascq, France, 2016. [Google Scholar]
- Claire, L.G.; Neal, H.; Edward, K.S.; Yuriy, B.; Premkumar, D.; Stephanie, F.; Westley, W. The ManyBugs and IntroClass benchmarks for automated repair of C programs. IEEE Trans. Softw. Eng. 2015, 41, 1236–1256. [Google Scholar]
Input | Output | |||
---|---|---|---|---|
a | b | c | m | i |
2 | true | true | 4,2,5 | error |
−1 | true | true | 4,2,5 | 2 |
−3 | false | true | 4,2,5,7,1 | 7 |
3 | true | true | 4,2,5,7,1 | error |
3 | false | true | 4,2,5,7,1 | 3 |
Input | Output | ||||||
---|---|---|---|---|---|---|---|
a | b | c | m | Incorrect | Correct | Original | |
Passing | 3 | false | true | 4,2,5,7,1 | 3,4,5,14 | 3,4,5,14 | 3,4,5,14 |
−1 | true | true | 4,2,5 | 3,4,8,11 | 3,4,8,9,14 | 3,4,7,9,14 | |
−3 | false | true | 4,2,5,7,1 | 3,4,8,11 | 3,4,8,9,14 | 3,4,7,9,14 | |
Failing | 3 | true | true | 4,2,5,7,1 | 3,4,8,11,14 | 3,4,8,11,14 | 3,4,7,9 |
2 | true | true | 4,2,5 | 3,4,8,11,14 | 3,4,8,11,14 | 3,4,7,9 |
Project | Nopol | DynaMoth | ACS | jGenProg | CapGen |
---|---|---|---|---|---|
Chart | 1/6 | 1/11 | 2/2 | 0/7 | 5/66 |
Lang | 3/7 | 0/6 | 3/4 | 0/0 | 9/29 |
Math | 1/21 | 1/28 | 12/16 | 5/18 | 14/152 |
Time | 0/1 | 0/5 | 1/1 | 0/2 | 0/0 |
Total | 5/35 | 2/50 | 18/23 | 5/27 | 28/247 |
Precision | 14.3% | 4% | 78.3% | 18.5% | 11.3% |
Project | Bug ID | Crt | Rv | Plausible | Rank |
---|---|---|---|---|---|
Chart | 8 | 1 | 0.625 | 62 | 1 |
Chart | 11 | 2 | 0.6525 | 2 | 1 |
Lang | 43 | 3 | 0.58 | 4 | 1 |
Lang | 57 | 3 | 0.7025 | 3 | 1 |
Lang | 59 | 1 | 0.52 | 20 | 1 |
Math | 5 | 1 | 0.7825 | 4 | 1 |
Math | 53 | 2 | 0.7367 | 2 | 1 |
Math | 63 | 1 | 0.415 | 9 | 3 |
Math | 80 | 1 | 0.6667 | 125 | 1 |
Math | 85 | 1 | 0.9333 | 4 | 1 |
Project | Bug ID | Rank | Rv | Plausible | ||||
---|---|---|---|---|---|---|---|---|
Nopol | DynaMoth | ACS | jGenProg | CapGen | ||||
Chart | 1 | 2 | 0.384 | - | 0/1 | - | 0/1 | 1/1 |
Chart | 3 | - | - | 0/1 | - | - | 0/1 | - |
Chart | 5 | 1 | 0.4585 | 1/1 | 0/1 | - | 0/1 | - |
Chart | 8 | 1 | 0.625 | - | - | - | - | 1/62 |
Chart | 11 | 1 | 0.6525 | - | - | - | - | 2/2 |
Chart | 13 | - | - | 0/1 | 0/1 | - | 0/1 | - |
Chart | 14 | 1 | 0.875 | - | - | 2/2 | - | - |
Chart | 15 | - | - | - | 0/1 | - | 0/1 | - |
Chart | 25 | - | - | 0/1 | 0/1 | - | 0/1 | - |
Math | 5 | 1 | 0.8333 | - | 0/1 | 1/1 | 1/1 | 1/4 |
Math | 33 | 1 | 0.4444 | 0/1 | 0/1 | - | - | 1/1 |
Math | 40 | - | - | 0/1 | 0/1 | - | 0/1 | - |
Math | 50 | 1 | 0.95 | 1/1 | 0/1 | - | 1/1 | - |
Math | 53 | 1 | 0.875 | - | - | - | 1/1 | 2/2 |
Math | 57 | 1 | 0.4444 | 0/1 | 0/1 | - | - | 1/1 |
Math | 58 | 1 | 0.5 | 0/1 | 0/1 | - | - | 1/1 |
Math | 63 | 3 | 0.415 | - | - | - | - | 1/9 |
Math | 73 | 2 | 0.381 | 0/1 | - | 0/1 | 1/1 | - |
Math | 80 | 1 | 0.6667 | 0/1 | 0/1 | - | 0/1 | 1/125 |
Math | 82 | 1 | 0.9167 | 0/1 | 0/1 | 1/1 | 0/1 | - |
Math | 85 | 1 | 0.9333 | 0/1 | 0/1 | 1/1 | 0/1 | 1/4 |
Lang | 59 | 1 | 0.52 | - | - | - | - | 1/20 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
Share and Cite
Dong, Y.; Wu, M.; Zhang, L.; Yin, W.; Wu, M.; Li, H. Priority Measurement of Patches for Program Repair Based on Semantic Distance. Symmetry 2020, 12, 2102. https://doi.org/10.3390/sym12122102
Dong Y, Wu M, Zhang L, Yin W, Wu M, Li H. Priority Measurement of Patches for Program Repair Based on Semantic Distance. Symmetry. 2020; 12(12):2102. https://doi.org/10.3390/sym12122102
Chicago/Turabian StyleDong, Yukun, Meng Wu, Li Zhang, Wenjing Yin, Mengying Wu, and Haojie Li. 2020. "Priority Measurement of Patches for Program Repair Based on Semantic Distance" Symmetry 12, no. 12: 2102. https://doi.org/10.3390/sym12122102