File tree Expand file tree Collapse file tree 18 files changed +488
-31
lines changed
regression/cbmc-path-progressive
loop-functional-correctness Expand file tree Collapse file tree 18 files changed +488
-31
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ regression/**/*.smt2
59
59
60
60
# These files are generated from the test.in file in their directories
61
61
regression /cbmc-path-fifo /* /test.desc
62
+ regression /cbmc-path-progressive /* /test.desc
62
63
63
64
# files stored by editors
64
65
* ~
Original file line number Diff line number Diff line change
1
+ default : tests.log
2
+
3
+ test : gen-desc
4
+ @../test.pl -p -c " ../../../src/cbmc/cbmc --paths progressive-fifo --verbosity 10"
5
+
6
+ tests.log : ../test.pl gen-desc
7
+ @../test.pl -p -c " ../../../src/cbmc/cbmc --paths progressive-fifo --verbosity 10"
8
+
9
+ gen-desc :
10
+ @../../scripts/make_descs.py
11
+
12
+ show :
13
+ @for dir in * ; do \
14
+ if [ -d " $$ dir" ]; then \
15
+ vim -o " $$ dir/*.c" " $$ dir/*.out" ; \
16
+ fi ; \
17
+ done ;
18
+
19
+ clean :
20
+ find -name ' test.desc' -execdir $(RM ) ' {}' \;
21
+ find -name ' *.out' -execdir $(RM ) ' {}' \;
22
+ find -name ' *.gb' -execdir $(RM ) ' {}' \;
23
+ $(RM ) tests.log
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int x ;
4
+ if (x )
5
+ x = 1 ;
6
+ else
7
+ x = 0 ;
8
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ activate-multi-line-match
5
+ EXIT=0
6
+ SIGNAL=0
7
+ --
8
+ ^warning: ignoring
9
+ --
10
+ This tests that the next path is resumed before the jump path.
11
+
12
+ Test that the following happens in order:
13
+ execute line 4
14
+ save next 5
15
+ save jump 7
16
+ any lines
17
+ execute line 4
18
+ resume jump 7
19
+ execute line 7
20
+ any lines
21
+ path is successful
22
+ any lines
23
+ execute line 4
24
+ resume next 5
25
+ execute line 5
26
+ any lines
27
+ path is successful
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int x ;
4
+ __CPROVER_assume (x == 1 );
5
+
6
+ while (x )
7
+ -- x ;
8
+
9
+ assert (x );
10
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --unwind 2
4
+ activate-multi-line-match
5
+ SIGNAL=0
6
+ EXIT=10
7
+ --
8
+ ^warning: ignoring
9
+ --
10
+ This strategy differs from 'fifo' because the failed path is the second
11
+ one, not the last one.
12
+
13
+ Test that the following happens in order:
14
+ execute line 6
15
+ save next 7
16
+ save jump 9
17
+
18
+ // We skip the loop first with this strategy. This path is infeasible,
19
+ // since x is 1 so we must have entered the loop; so the solver is happy.
20
+ any lines
21
+ execute line 6
22
+ resume jump 9
23
+ execute line 9
24
+ any lines
25
+ path is successful
26
+
27
+ // We now enter the loop and execute it; we then save "entering the loop
28
+ // twice" and "bailing out after the first spin".
29
+ any lines
30
+ execute line 6
31
+ resume next 7
32
+ execute line 7
33
+ any lines
34
+ save next 7
35
+ save jump 9
36
+
37
+ // Since the just saved "bailing out after the first spin" is a jump,
38
+ // execute that path. That path makes the assertion fail, since we
39
+ // decremented x from 1 to 0.
40
+ any lines
41
+ execute line 6
42
+ resume jump 9
43
+ execute line 9
44
+ any lines
45
+ path is unsuccessful
46
+
47
+ // Finally, execute "entering the loop twice". This path is infeasible
48
+ // because we cannot actually have entered the loop twice if x was only
49
+ // 1 to begin with, so the solver is happy.
50
+ any lines
51
+ execute line 6
52
+ resume next 7
53
+ execute line 7
54
+ any lines
55
+ path is successful
56
+ end
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int x , y ;
4
+ if (x )
5
+ {
6
+ if (y )
7
+ y = 1 ;
8
+ else
9
+ y = 0 ;
10
+ }
11
+ else
12
+ {
13
+ if (y )
14
+ y = 1 ;
15
+ else
16
+ y = 0 ;
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ activate-multi-line-match
5
+ EXIT=0
6
+ SIGNAL=0
7
+ --
8
+ ^warning: ignoring
9
+ --
10
+ Test that the following happens in order:
11
+ execute line 4
12
+ save next 6
13
+ save jump 13
14
+
15
+ any lines
16
+ execute line 4
17
+ resume jump 13
18
+ execute line 13
19
+ save next 14
20
+ save jump 16
21
+
22
+ any lines
23
+ execute line 13
24
+ resume jump 16
25
+ execute line 16
26
+ any lines
27
+ path is successful
28
+
29
+ any lines
30
+ execute line 4
31
+ resume next 6
32
+ execute line 6
33
+ save next 7
34
+ save jump 9
35
+
36
+ any lines
37
+ execute line 6
38
+ resume jump 9
39
+ execute line 9
40
+ any lines
41
+ path is successful
42
+
43
+ any lines
44
+ execute line 13
45
+ resume next 14
46
+ execute line 14
47
+ any lines
48
+ path is successful
49
+
50
+ any lines
51
+ execute line 6
52
+ resume next 7
53
+ execute line 7
54
+ any lines
55
+ path is successful
56
+ end
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int x ;
4
+ while (x )
5
+ {
6
+ int y ;
7
+ }
8
+ int y ;
9
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --unwind 2
4
+ activate-multi-line-match
5
+ EXIT=0
6
+ SIGNAL=0
7
+ --
8
+ ^warning: ignoring
9
+ --
10
+ Test that the following happens in order:
11
+ execute line 4
12
+ save next 6
13
+ save jump 8
14
+
15
+ // Bail out without having entered loop, ever
16
+ any lines
17
+ execute line 4
18
+ resume jump 8
19
+ execute line 8
20
+ any lines
21
+ path is successful
22
+
23
+ // Enter loop body for the first time
24
+ any lines
25
+ execute line 4
26
+ resume next 6
27
+ execute line 6
28
+ any lines
29
+ save next 6
30
+ save jump 8
31
+
32
+ // Bail out after executing loop once
33
+ any lines
34
+ execute line 4
35
+ resume jump 8
36
+ execute line 8
37
+ any lines
38
+ path is successful
39
+
40
+ // Execute loop for the second time
41
+ any lines
42
+ execute line 4
43
+ resume next 6
44
+ execute line 6
45
+ any lines
46
+ path is successful
47
+ end
You can’t perform that action at this time.
0 commit comments