Skip to content

Commit 7e00a30

Browse files
authored
Merge pull request #1759 from smowton/smowton/feature/symex-driven-program-loading
JBMC: Add symex-based program loading
2 parents 22e9b32 + 953e2df commit 7e00a30

File tree

64 files changed

+464
-117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+464
-117
lines changed

regression/cbmc-java/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
add_test_pl_tests(
22
"$<TARGET_FILE:jbmc>"
33
)
4+
5+
add_test_pl_profile(
6+
"cbmc-java-symex-driven-lazy-loading"
7+
"$<TARGET_FILE:jbmc> --symex-driven-lazy-loading"
8+
"-C;-X;symex-driven-lazy-loading-expected-failure"
9+
"CORE"
10+
)

regression/cbmc-java/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ default: tests.log
22

33
test:
44
@../test.pl -p -c ../../../src/jbmc/jbmc
5+
@../test.pl -p -c "../../../src/jbmc/jbmc --symex-driven-lazy-loading" -X symex-driven-lazy-loading-expected-failure
56

67
tests.log: ../test.pl
78
@../test.pl -p -c ../../../src/jbmc/jbmc
9+
@../test.pl -p -c "../../../src/jbmc/jbmc --symex-driven-lazy-loading" -X symex-driven-lazy-loading-expected-failure
810

911
show:
1012
@for dir in *; do \
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
CORE
1+
CORE symex-driven-lazy-loading-expected-failure
22
Test.class
33
--function Test.check --lazy-methods
44
^VERIFICATION SUCCESSFUL$
55
--
6+
--
7+
This doesn't work under symex-driven lazy loading because it is incompatible with --lazy-methods
Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
CORE
22
covered1.class
3-
--cover location --json-ui --show-properties
3+
--cover location --json-ui --show-properties --function 'covered1.<init>'
44
^EXIT=0$
55
^SIGNAL=0$
66
.*\"coveredLines\": \"22\",$
7-
.*\"coveredLines\": \"4\",$
8-
.*\"coveredLines\": \"6\",$
9-
.*\"coveredLines\": \"7\",$
10-
.*\"coveredLines\": \"23\",$
11-
.*\"coveredLines\": \"24\",$
12-
.*\"coveredLines\": \"25\",$
13-
.*\"coveredLines\": \"31\",$
14-
.*\"coveredLines\": \"32\",$
15-
.*\"coveredLines\": \"33\",$
16-
.*\"coveredLines\": \"36\",$
7+
(.*\"coveredLines\": \"4\")|(\"coveredLines\": \"4,6,7,23-25,31-33,36\"),$
8+
.*\"coveredLines\": \"6\"|(\"coveredLines\": \"4,6,7,23-25,31-33,36\"),$
9+
.*\"coveredLines\": \"7\"|(\"coveredLines\": \"4,6,7,23-25,31-33,36\"),$
10+
.*\"coveredLines\": \"23\"|(\"coveredLines\": \"4,6,7,23-25,31-33,36\"),$
11+
.*\"coveredLines\": \"24\"|(\"coveredLines\": \"4,6,7,23-25,31-33,36\"),$
12+
.*\"coveredLines\": \"25\"|(\"coveredLines\": \"4,6,7,23-25,31-33,36\"),$
13+
.*\"coveredLines\": \"31\"|(\"coveredLines\": \"4,6,7,23-25,31-33,36\"),$
14+
.*\"coveredLines\": \"32\"|(\"coveredLines\": \"4,6,7,23-25,31-33,36\"),$
15+
.*\"coveredLines\": \"33\"|(\"coveredLines\": \"4,6,7,23-25,31-33,36\"),$
16+
.*\"coveredLines\": \"36\"|(\"coveredLines\": \"4,6,7,23-25,31-33,36\"),$
1717
.*\"coveredLines\": \"26\",$
1818
.*\"coveredLines\": \"28\",$
1919
.*\"coveredLines\": \"28\",$
@@ -25,3 +25,9 @@ covered1.class
2525
.*\"coveredLines\": \"35\",$
2626
--
2727
^warning: ignoring
28+
--
29+
The alternation between the grouped and ungrouped reporting formats for coveredLines accommodates the
30+
difference between symex-driven-lazy-loading (which currently causes jbmc to use the grouped format)
31+
and normal loading (which uses the ungrouped format).
32+
The cause of the difference appears to be symex-driven loading being more pessimistic about possible
33+
exceptions coming from callees, which in turn changes the shape of the CFG.

regression/cbmc-java/exceptions26/test.desc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
CORE
22
test.class
3+
34
^VERIFICATION SUCCESSFUL$
45
--
56
^warning: ignoring

regression/cbmc-java/exceptions27/test.desc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
CORE
22
test.class
3+
34
VERIFICATION SUCCESSFUL
45
--
56
^warning: ignoring

regression/cbmc-java/generic_class_bound1/test.desc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
CORE symex-driven-lazy-loading-expected-failure
22
Gn.class
33
--cover location
44
^EXIT=0$
@@ -9,3 +9,6 @@ Gn.class
99
.*file Gn.java line 11 function java::Gn.foo1:\(LGn;\)V bytecode-index 5 block 3: FAILED
1010
.*file Gn.java line 13 function java::Gn.main:\(\[Ljava/lang/String;\)V bytecode-index 2 block 2: SATISFIED
1111
--
12+
--
13+
This fails under symex-driven lazy loading because the FAILED blocks occur in functions that are unreachable
14+
from the entry point, so with symex-driven loading the functions foo1 and the constructor don't get created at all.

regression/cbmc-java/jsr1/test.desc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
CORE
1+
CORE symex-driven-lazy-loading-expected-failure
22
edu/emory/mathcs/backport/java/util/concurrent/ConcurrentHashMap.class
33
--show-goto-functions
44
^EXIT=0$
55
^SIGNAL=0$
66
--
77
\\"statement\\" \(\\"jsr\\"\)
88
\\"statement\\" \(\\"ret\\"\)
9+
--
10+
This doesn't work under symex-driven lazy loading because no entry-point function is given.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
CORE
1+
CORE symex-driven-lazy-loading-expected-failure
22
SymStream.class
33
--verbosity 10 --show-goto-functions
44
^EXIT=0
55
^SIGNAL=0
66
--
77
--
88
just to test that it doesn't crash in this situation, cf. TG-2684
9+
Doesn't work with symex-driven loading because there is no entry point (we want to load the entire class)
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
CORE
1+
CORE symex-driven-lazy-loading-expected-failure
22
test.class
33
--lazy-methods --verbosity 10 --function test.main
44
^EXIT=0$
55
^SIGNAL=0$
66
elaborate java::A\.f:\(\)V
77
--
88
elaborate java::B\.g:\(\)V
9+
--
10+
This doesn't work under symex-driven lazy loading because it is incompatible with --lazy-methods

0 commit comments

Comments
 (0)