-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression tests for initialization of Java main args
- Loading branch information
1 parent
0de2fd5
commit 4d0f984
Showing
53 changed files
with
352 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
public class Main | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
if(args.length>0) | ||
assert(args[0] != null); // must hold | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--refine-strings | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
17 changes: 17 additions & 0 deletions
17
regression/cbmc-java/main-args-elements-non-null2/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
public class Main | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
try { | ||
if(args.length>0) | ||
{ | ||
String s = args[0]; | ||
int i = s.length(); // must not fail | ||
} | ||
} | ||
catch(Exception e) { | ||
assert false; // unreachable | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--java-throw-runtime-exceptions --refine-strings | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
regression/cbmc-java/main-args-elements-non-null3/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
public class Main | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
if(args.length>1) | ||
{ | ||
assert(args[0] != null); // must hold | ||
assert(args[1] != null); // must hold | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--refine-strings | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
regression/cbmc-java/main-args-elements-non-null4/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
public class Main | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
try { | ||
if(args.length>0) { | ||
String s = args[0]; | ||
if(s != null) { | ||
int i = s.length(); // definitely must not fail | ||
} | ||
} | ||
} | ||
catch(Exception e) { | ||
assert false; // unreachable | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--java-throw-runtime-exceptions --refine-strings | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
8 changes: 8 additions & 0 deletions
8
regression/cbmc-java/main-args-non-null-with-function1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
public class Main | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
assert(args != null); // must hold | ||
} | ||
} | ||
|
8 changes: 8 additions & 0 deletions
8
regression/cbmc-java/main-args-non-null-with-function1/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
public class Main | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
assert(args != null); // must hold | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
public class Main | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
try { | ||
int i = args.length; // args must be non-null | ||
} | ||
catch(Exception e) { | ||
assert false; // unreachable | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--java-throw-runtime-exceptions --refine-strings | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
public class Main | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
assert(args == null); // must fail | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
|
||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
regression/cbmc-java/no-main-args-elements-maybe-null1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
public class Main | ||
{ | ||
static void main(String[] args) // not public! | ||
{ | ||
if(args != null && args.length>0) | ||
assert(args[0] != null); // allowed to fail | ||
} | ||
} | ||
|
8 changes: 8 additions & 0 deletions
8
regression/cbmc-java/no-main-args-elements-maybe-null1/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--function Main.main --refine-strings | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
10 changes: 10 additions & 0 deletions
10
regression/cbmc-java/no-main-args-elements-maybe-null2/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
public class Main | ||
{ | ||
static void main(String[] args) // not public! | ||
{ | ||
if(args != null && args.length>0 && args[0] != null) { | ||
assert(false); // allowed to fail | ||
} | ||
} | ||
} | ||
|
8 changes: 8 additions & 0 deletions
8
regression/cbmc-java/no-main-args-elements-maybe-null2/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--function Main.main --refine-strings | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
public class Main | ||
{ | ||
public void main(String[] args) // not static! | ||
{ | ||
assert(args != null); // allowed to fail | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
public class Main | ||
{ | ||
public void main(String[] args) // not static! | ||
{ | ||
assert(args == null); // allowed to fail | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
17 changes: 17 additions & 0 deletions
17
regression/cbmc-java/no-main-int-array-maybe-null1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
public class Main | ||
{ | ||
public static void main(int[] args) | ||
{ | ||
assert(args == null); // allowed to fail | ||
assert(args != null); // allowed to fail | ||
if(args != null && args.length > 0) { | ||
try { | ||
int i = args[0]; | ||
} | ||
catch(Exception e) { | ||
assert false; // must hold | ||
} | ||
} | ||
} | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
regression/cbmc-java/no-main-int-array-maybe-null1/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CORE | ||
Main.class | ||
--function Main.main --java-throw-runtime-exceptions | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
assertion at file Main\.java line 5 function .* bytecode-index 6: FAILURE | ||
assertion at file Main.java line 6 function .* bytecode-index 14: FAILURE | ||
assertion at file Main.java line 12 function .* bytecode-index 31: SUCCESS | ||
\*\* 2 of .* failed | ||
-- | ||
^warning: ignoring |
Binary file not shown.
11 changes: 11 additions & 0 deletions
11
regression/cbmc-java/no-main-multi-array-maybe-null1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
public class Main | ||
{ | ||
public static void main(String[][] args) | ||
{ | ||
assert(args == null || | ||
args.length == 0 || | ||
args[0] == null || | ||
args[0].length == 0 || | ||
args[0][0] != null); // allowed to fail | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
regression/cbmc-java/no-main-multi-array-maybe-null1/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
Main.class | ||
--function Main.main --refine-strings --java-max-input-array-length 2 | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
assertion at file Main\.java line 5 function .* bytecode-index 24: FAILURE | ||
\*\* 1 of .* failed | ||
-- | ||
^warning: ignoring |
Binary file not shown.
11 changes: 11 additions & 0 deletions
11
regression/cbmc-java/no-main-multi-array-maybe-null2/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
public class Main | ||
{ | ||
public static void main(String[][] args) | ||
{ | ||
assert(args == null || | ||
args.length == 0 || | ||
args[0] == null || | ||
args[0].length == 0 || | ||
args[0][0] == null); // allowed to fail | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
regression/cbmc-java/no-main-multi-array-maybe-null2/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
Main.class | ||
--function Main.main --refine-strings --java-max-input-array-length 2 | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
assertion at file Main\.java line 5 function .* bytecode-index 24: FAILURE | ||
\*\* 1 of .* failed | ||
-- | ||
^warning: ignoring |
Binary file added
BIN
+245 Bytes
regression/cbmc-java/no-main-object-array-elements-maybe-null1/Main$A.class
Binary file not shown.
Binary file added
BIN
+597 Bytes
regression/cbmc-java/no-main-object-array-elements-maybe-null1/Main.class
Binary file not shown.
16 changes: 16 additions & 0 deletions
16
regression/cbmc-java/no-main-object-array-elements-maybe-null1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
public class Main | ||
{ | ||
public static class A { | ||
int x; | ||
} | ||
public A a; | ||
|
||
public static void main(Main[] args) | ||
{ | ||
if(args != null && args.length > 0) { | ||
Main m = args[0]; | ||
assert(m == null); // allowed to fail | ||
} | ||
} | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
regression/cbmc-java/no-main-object-array-elements-maybe-null1/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
assertion at file Main\.java line 12 function .* bytecode-index 15: FAILURE | ||
\*\* 1 of .* failed | ||
-- | ||
^warning: ignoring |
Binary file not shown.
Binary file not shown.
20 changes: 20 additions & 0 deletions
20
regression/cbmc-java/no-main-object-array-maybe-null1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
public class Main | ||
{ | ||
public static class A { | ||
int x; | ||
} | ||
public A a; | ||
|
||
public static void main(Main[] args) | ||
{ | ||
assert(args != null); // allowed to fail | ||
if(args != null && args.length > 0) { | ||
Main m = args[0]; | ||
if(m != null) { | ||
assert(m.a == null); // allowed to fail | ||
assert(m.a != null); // allowed to fail | ||
} | ||
} | ||
} | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
regression/cbmc-java/no-main-object-array-maybe-null1/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
assertion at file Main\.java line 10 function .* bytecode-index 6: FAILURE | ||
assertion at file Main.java line 14 function .* bytecode-index 26: FAILURE | ||
assertion at file Main.java line 15 function .* bytecode-index 35: FAILURE | ||
\*\* 3 of .* failed | ||
-- | ||
^warning: ignoring |