Software Engineering Laboratory Department of Computer Science Graduate
回帰テストにおける実行系列の差分の 効率的な検出手法 井上研究室 松田 直人 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
研究背景 (2/3) • 回帰テストはプログラムの出力のみを検証 → バグを見落としてしまう可能性 • 回帰テストが行われているにもかかわらず、バグ修 正の 14. 8~ 24. 4%は別のバグを生み出している[1] 出力だけではなく、テストの動作そのものの検証が必要 [1] Zuoning Yin, Ding Yuan, Yuanyuan Zhou, Shankar Pasupathy, and Lakshmi Bairavasundaram. How do fixes become bugs? In Proceedings of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering, pp. 26– 36, September 2011. 3 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
サンプルプログラム (Java) public class Main { public static void main(String[] args) { int i; if (call(1, 2) > 0) { i = 0; } else { i = 1; } System. out. println(i); } } static int call(int op 1, int op 2) { return op 1 + op 2; } 修正 static int call(int op 1, int op 2) { return op 1 - op 2; } 6 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
動的依存グラフ 修正後 修正前 1 2 op 1 op 2 + call メソッド return if if main メソッド i=1 i=0 println(i) - データ依存 制御依存 println(i) Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 7
バイトコード単位のフォワードスライス 修正後 修正前 4 $s 1 = call($s 1, $s 2) 5 if ($s 1 > 0) 8 $s 1 = 0 9 i = $s 1 比較 16 $s 1 = 1 17 i = $s 1 22 $s 1 = i 23 println($s 1) ※ 頂点の数字はバイトコード命令を識別するための番号 $s 1, $s 2 はスタック上の領域 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 9
先行研究での手法 (1/2) • 各頂点に到達する経路上の頂点集合を計算 4 {} 修正前 5 5 { 4} 8 9 { 4, 5} { 4, 5, 8} 比較 修正後 16 17 { 4, 5} { 4, 5, 16} 22 22 { 4, 5, 8, 9} { 4, 5, 16, 17} 23 23 { 4, 5, 8, 9, 22} { 4, 5, 16, 17, 22} 10 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
先行研究での手法 (2/2) • 頂点の番号と頂点集合の両方が等しいものを除く → 各グラフに固有な頂点が残る = 動作の差分 8 $s 1 = 0 { 4, 5} 9 i = $s 1 { 4, 5, 8} 16 $s 1 = 1 { 4, 5} 17 i = $s 1 { 4, 5, 16} 22 $s 1 = i { 4, 5, 8, 9} 22 $s 1 = i { 4, 5, 16, 17} 23 println($s 1) { 4, 5, 8, 9, 22} 23 println($s 1) { 4, 5, 16, 17, 22} 11 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
提案手法 (1/2) • フォワードスライスを辺の列(時系列順)として出力 修正前 D 4 4 D 5 5 C 8 8 D 9 5 C 9 9 D 22 22 D 23 修正後 比較 D: データ依存 C: 制御依存 D 4 4 D 5 5 C 16 16 D 17 5 C 17 17 D 22 22 D 23 12 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
提案手法 (2/2) • 文書比較プログラムの diff [3] を用いて比較 → 各グラフに固有な辺が残る = 3, 6 c 3, 6 < 5 C 8 < 8 D 9 < 5 C 9 < 9 D 22 --> 5 C 16 > 16 D 17 > 5 C 17 > 17 D 22 動作の差分 5 if ($s 1 > 0) 8 $s 1 = 0 5 if ($s 1 > 0) 9 i = $s 1 16 $s 1 = 1 22 $s 1 = i [3] GNU Diffutils. https: //www. gnu. org/software/diffutils/. Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 17 i = $s 1 22 $s 1 = i 13
評価実験 目的 スケーラビリティが向上したことを確かめる 対象 バグ修正データセット Defects 4 j [4] に収録されて いる Apache Commons Lang のバグ 10個 方法 バグ修正前後のテストの実行に対して 先行研究での手法と提案手法をそれぞれ適用し、 差分検出結果を比較する 環境 OS: Windows 8. 1 上の仮想環境 Ubuntu 16. 04 CPU: Intel Xeon 2. 90 GHz メモリ: 256 GB [4] Ren´e Just, Darioush Jalali, and Michael D. Ernst. Defects 4 J: A database of existing faults to enable controlled testing studies for Java programs. In Proceedings of the International Symposium on Software Testing and Analysis, pp. 437– 440, July 2014. 15 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
評価実験の結果 (1/2) 先行研究での手法 番号 1 (前) 1 (後) 2 (前) 2 (後) 3 (前) 3 (後) 4 (前) 4 (後) 5 (前) 5 (後) 比較時間 0. 054 0. 016 0. 059 N/A 0. 008 頂点 提案手法 固有頂点 6260 0 6996 42 1298 1 1328 12 6015 17 6078 33 51491332 N/A 330 1 396 19 比較時間 辺 11894 0 13280 1386 1410 2 1470 62 11430 62 11552 184 104945779 0 429 1 508 80 0. 002 0. 003 3. 423 固有辺 0. 001 16 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
評価実験の結果 (2/2) 先行研究での手法 番号 6 (前) 6 (後) 7 (前) 7 (後) 8 (前) 8 (後) 9 (前) 9 (後) 10(前) 10(後) 比較時間 N/A 0. 040 0. 023 556. 170 1. 250 頂点 提案手法 固有頂点 83584442 N/A 83586850 N/A 4769 5 4868 5 1580 0 1583 33 36795442 34 36798484 19 631407 0 比較時間 43. 744 辺 165156523 0 165161272 4749 9004 9 9201 206 2980 57 2993 70 81033323 10729 81034003 11409 679846 2649 766242 89045 0. 002 0. 001 6. 198 固有辺 0. 130 17 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
- Slides: 18