Skip to content

Commit 7efa7bf

Browse files
committed
JBMC: Regression tests for multi-threaded java programs
1 parent 4d91aa5 commit 7efa7bf

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

+778
-8
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import java.lang.Thread;
2+
import org.cprover.CProver;
3+
4+
public class A
5+
{
6+
int x = 0;
7+
8+
// expected verfication success
9+
public void me()
10+
{
11+
Thread t = new Thread()
12+
{
13+
public void run()
14+
{
15+
x = 44;
16+
int local_x = x;
17+
assert(local_x == 44 || x == 10);
18+
}
19+
};
20+
t.start();
21+
x = 10;
22+
}
23+
24+
// expected verfication failure
25+
public void me2()
26+
{
27+
Thread t = new Thread()
28+
{
29+
public void run()
30+
{
31+
x = 44;
32+
int local_x = x;
33+
assert(local_x == 44);
34+
}
35+
};
36+
t.start();
37+
x = 10;
38+
}
39+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
A.class
3+
--function 'A.me:()V' --lazy-methods --cp `../../../../scripts/format_classpath.sh . ../../../src/java_bytecode/library/core-models.jar` --java-threading
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CORE
2+
A.class
3+
--function 'A.me2:()V' --lazy-methods --java-threading --cp `../../../../scripts/format_classpath.sh . ../../../src/java_bytecode/library/core-models.jar`
4+
^SIGNAL=0$
5+
^VERIFICATION FAILED$
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
CORE
22
A.class
3-
--function "A.me:()V" --lazy-methods --java-threading
4-
3+
--function 'A.me:()V' --lazy-methods --java-threading
54
^EXIT=0$
65
^SIGNAL=0$
76
^VERIFICATION SUCCESSFUL
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CORE
2+
A.class
3+
--function 'A.me2:()V' --lazy-methods --java-threading
4+
^SIGNAL=0$
5+
^VERIFICATION FAILED

0 commit comments

Comments
 (0)