Shadow of a Doubt: Testing for Divergences Between Software Versions
Hristina Palikareva Tomasz Kuchta Cristian Cadar
ICSE’16, 20th May 2016
This work is supported by EPSRC and Microsoft Research
Shadow of a Doubt: Testing for Divergences Between Software - - PowerPoint PPT Presentation
Shadow of a Doubt: Testing for Divergences Between Software Versions Hristina Palikareva Tomasz Kuchta Cristian Cadar ICSE16, 20 th May 2016 This work is supported by EPSRC and Microsoft Research Motivation Software patches
This work is supported by EPSRC and Microsoft Research
2
01 int gt_100(unsigned x) { 02 unsigned y = x; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
3
01 int gt_100(unsigned x) { 02 unsigned y = x + 1 x + 1; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
4
01 int gt_100(unsigned x) { 02 unsigned y = x; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
5 01 int gt_100(unsigned x) { 02 unsigned y = x + 1 x + 1; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 } 01 int gt_100(unsigned x) { 02 unsigned y = x; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
6 01 int gt_100(unsigned x) { 02 unsigned y = x + 1 x + 1; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 } 01 int gt_100(unsigned x) { 02 unsigned y = x; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
7
8
01 int gt_100(unsigned x) { 02 unsigned y = x + 1 x + 1; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
9 x+1 > 100 x+1 ≤ 100
01 int gt_100(unsigned x) { 02 unsigned y = x + 1 x + 1; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
10 x+1 > 100 x+1 ≤ 100
01 int gt_100(unsigned x) { 02 unsigned y = x + 1 x + 1; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
11 x+1 > 100 x+1 ≤ 100
01 int gt_100(unsigned x) { 02 unsigned y = x + 1 x + 1; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
12 x+1 > 100 x+1 ≤ 100
01 int gt_100(unsigned x) { 02 unsigned y = x + 1 x + 1; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
x + 1 ≤ 100 13 x + 1 > 100 x+1 > 100 x+1 ≤ 100
01 int gt_100(unsigned x) { 02 unsigned y = x + 1 x + 1; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
x + 1 > 100 14
x+1 > 100 x+1 ≤ 100
01 int gt_100(unsigned x) { 02 unsigned y = x + 1 x + 1; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 } x + 1 ≤ 100
16
01 int gt_100(unsigned x) { 02 unsigned y = x + 1 x + 1; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 } 01 int gt_100(unsigned x) { 02 unsigned y = x; 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 } 17
01 int gt_100(unsigned x) { 02 unsigned y = change(x, x + 1) change(x, x + 1); 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 } 18
19
01 int gt_100(unsigned x) { 02 unsigned y = change(x, x + 1) change(x, x + 1); 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
01 int gt_100(unsigned x) { 02 unsigned y = change(x, x + 1) change(x, x + 1); 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 } 20
21
01 int gt_100(unsigned x) { 02 unsigned y = change(x, x + 1) change(x, x + 1); 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
22 x+1 ≤ 100 x+1 > 100
01 int gt_100(unsigned x) { 02 unsigned y = change(x, change(x, x + 1 x + 1); 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
23 x ≤ 100 x > 100 x+1 ≤ 100 x+1 > 100 x ≤ 100 x > 100
01 int gt_100(unsigned x) { 02 unsigned y = change( change(x, x + 1) , x + 1); 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
24 new:else
new:else
new:then
new:then
x+1 ≤ 100 x+1 > 100
x ≤ 100 x > 100 x ≤ 100 x > 100 01 int gt_100(unsigned x) { 02 unsigned y = change( change(x, x + 1 x, x + 1); 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 }
25 x+1 ≤ 100 x+1 > 100
x ≤ 100 x > 100 x ≤ 100 x > 100 01 int gt_100(unsigned x) { 02 unsigned y = change( change(x, x + 1 x, x + 1); 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 } new:else
new:else
new:then
new:then
01 int gt_100(unsigned x) { 02 unsigned y = change( change(x, x + 1 x, x + 1); 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 } 26
x+1 ≤ 100 x+1 > 100
x ≤ 100 x > 100 x ≤ 100 x > 100 new:else
new:else
new:then
new:then
27
x+1 ≤ 100 x+1 > 100
x ≤ 100 x > 100 x ≤ 100 x > 100 01 int gt_100(unsigned x) { 02 unsigned y = change( change(x, x + 1 x, x + 1); 03 if (y > 100) 04 return 1; 05 else 06 return 0; 07 } new:else
new:else
new:then
new:then
01 int gt_100(unsigned x) { 02 unsigned y = x; 03 if (change(y > 100, y change(y > 100, y ≥ 100) 100)) 04 return 1; 05 else 06 return 0; 07 } 28
y < 100 y ≤ 100 y ≥ 100 y ≤ 100 y ≥ 100 y > 100
y < 100 y > 100 y > 200
29
31
01 if (change(argc - optind, n_args) change(argc - optind, n_args) < 1 < 1) 02 { 03 error (...); 04 usage (EXIT_FAILURE); 05 }
32
01 if (argc – optind argc – optind < 1 < 1) 02 { 03 error (...); 04 usage (EXIT_FAILURE); 05 }
01 if (n_args n_args < 1 < 1) 02 { 03 error (...); 04 usage (EXIT_FAILURE); 05 }
33
01 byte_idx = 0; 02 print_delimiter = false; 03 current_rp = rp; current_rp = rp;
01 byte_idx = 0; 02 print_delimiter = false; 03 01 byte_idx = 0; 02 print_delimiter = false; 03 current_rp = change(current_rp, rp) change(current_rp, rp);
35
Old version New version Test suite
36
Unify versions Select test cases Shadow Enhanced checks
Old version New version Test suite
37
Unify versions Select test cases Shadow Enhanced checks
Old version New version Test suite Regression bugs Expected divergences
38
Unify versions Select test cases Shadow Enhanced checks
Old version New version Test suite Regression bugs Expected divergences
39
Unify versions Select test cases Shadow Enhanced checks
40
Unify versions Select test cases Shadow Enhanced checks
41
Unify versions Select test cases Shadow Enhanced checks
42
Unify versions Select test cases Shadow Enhanced checks
43
✓ ✗ ✓
Unify versions Select test cases Shadow Enhanced checks
44
✗ ✓ BSE BSE ✓
Unify versions Select test cases Shadow Enhanced checks
45
Unify versions Select test cases Shadow Enhanced checks
47
48
49
Patch atch Tool
Patch size atch size Annotations Annotations LOC Hunks
1 mv, rm 45 17 12 3 cut 294 35 14 4 tail 21 4 4 5=16 tail 275 13 1 6 cut 8 3 3 7 seq 148 5 5 8 seq 37 4 12 10 cp 16 8 2 11 cut 2 1 1 12=17 cut 110 17 4 13 ls 13 2 2 14 ls 15 5 4 15 du 3 1 1 19 seq 40 9 6 21 cut 31 10 6 22 expr 54 6 4
50
Patch atch Tool
Patch size atch size Annotations Annotations LOC Hunks
1 mv, rm 45 17 12 3 cut 294 35 14 4 tail 21 4 4 5=16 tail 275 13 1 6 cut 8 3 3 7 seq 148 5 5 8 seq 37 4 12 10 cp 16 8 2 11 cut 2 1 1 12=17 cut 110 17 4 13 ls 13 2 2 14 ls 15 5 4 15 du 3 1 1 19 seq 40 9 6 21 cut 31 10 6 22 expr 54 6 4
51
Patch atch Tool
Patch size atch size Annotations Annotations LOC Hunks
1 mv, rm 45 17 12 3 cut 294 35 14 4 tail 21 4 4 5=16 tail 275 13 1 6 cut 8 3 3 7 seq 148 5 5 8 seq 37 4 12 10 cp 16 8 2 11 cut 2 1 1 12=17 cut 110 17 4 13 ls 13 2 2 14 ls 15 5 4 15 du 3 1 1 19 seq 40 9 6 21 cut 31 10 6 22 expr 54 6 4
52
Gener Generated input ated input Behaviour Behaviour Old New
cut -s -d: -f0- <file> file contains “:::\n:1” :::\n1 \n\n cut –d: -f1,0- <file> file contains “a:b:c” a:b:c a tail --retry ///s\x01\x00g\x00 tail: warning: -- retry is useful mainly when following by name… tail: warning: -- retry ignored; -- retry is useful only when following…
53
Gener Generated input ated input Behaviour Behaviour Old New
cut -c1-3,8- --output-d=: <file> file contains “abcdefg” abc abc + buffer overflow cut -c1-7,8- --output-d=: <file> file contains “abcdefg” abcdefg abcdefg + buffer
cut -b0-2,2- --output-d=: <file> file contains “abc” abc signal abort
Gener Generated input ated input Behaviour Behaviour Old New
cut -c1-3,8- --output-d=: <file> file contains “abcdefg” abc abc + buffer overflow cut -c1-7,8- --output-d=: <file> file contains “abcdefg” abcdefg abcdefg + buffer
cut -b0-2,2- --output-d=: <file> file contains “abc” abc signal abort
54
55
Patch atch Diver Divergences gences Output dif Output differ ferences ences Expected Bug
1 39K 3
15K
39 36
14
6 1.4K
7 124 5
54K
6
11 874 9
4.2K
13 11 1 1 14 2
1 1
33K 7
21K 151 684 22
56
Patch atch Diver Divergences gences Output dif Output differ ferences ences Expected Bug
1 39K 3
15K
39 36
14
6 1.4K
7 124 5
54K
6
11 874 9
4.2K
13 11 1 1 14 2
1 1
33K 7
21K 151 684 22
57
Patch atch Diver Divergences gences Output dif Output differ ferences ences Expected Bug
1 39K 3
15K
39 36
14
6 1.4K
7 124 5
54K
6
11 874 9
4.2K
13 11 1 1 14 2
1 1
33K 7
21K 151 684 22
58
Patch atch Diver Divergences gences Output dif Output differ ferences ences Expected Bug
1 39K 3
15K
39 36
14
6 1.4K
7 124 5
54K
6
11 874 9
4.2K
13 11 1 1 14 2
1 1
33K 7
21K 151 684 22
59