Skip to content

Commit 8762296

Browse files
author
svorenova
committed
Add a regression test for nondet-static
1 parent 846abe4 commit 8762296

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
760 Bytes
Binary file not shown.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
public class My {
2+
public static int s_non_init;
3+
public static int s_init = 1;
4+
public static int s_static_init;
5+
static { s_static_init = 2; }
6+
7+
public static final int sf_init = 1;
8+
public static final int sf_static_init;
9+
static { sf_static_init = 2; }
10+
11+
public int field;
12+
public My(int i) {
13+
String s = "bla";
14+
field = i;
15+
if (s_non_init != 0)
16+
field = 108; // this line can only be covered with nondet-static
17+
if (s_init != 1)
18+
field = 108; // this line can only be covered with nondet-static
19+
if (s_static_init != 2)
20+
field = 108; // this line can only be covered with nondet-static
21+
22+
if (sf_init != 1)
23+
field = 108; // this line cannot be covered even with nondet-static
24+
if (sf_static_init != 2)
25+
field = 108; // this line cannot be covered even with nondet-static
26+
if (s != "bla")
27+
field = 108; // this line cannot be covered even with nondet-static
28+
}
29+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
CORE symex-driven-lazy-loading-expected-failure
2+
My.class
3+
--function "My.<init>" --cover location --nondet-static
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
file My\.java line 18 function java::My\.\<init\>:\(I\)V.*SATISFIED$
7+
file My\.java line 19 function java::My\.\<init\>:\(I\)V.*SATISFIED$
8+
file My\.java line 20 function java::My\.\<init\>:\(I\)V.*SATISFIED$
9+
file My\.java line 25 function java::My\.\<init\>:\(I\)V.*FAILED$
10+
file My\.java line 27 function java::My\.\<init\>:\(I\)V.*FAILED$
11+
--
12+
file My\.java line 23 function java::My\.\<init\>:\(I\)V.*SATISFIED$
13+
--
14+
This tests nondet-static option, namely that static (non-final) variables are
15+
non-det initialized regardless of whether they are given a (static) initializer
16+
or not but constants such as strings are not non-det initialized
17+
18+
This fails under symex-driven lazy loading because nondet-static cannot be used
19+
with it

0 commit comments

Comments
 (0)