-
Notifications
You must be signed in to change notification settings - Fork 273
Feature/new instrumentation runtime exceptions #912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
cristina-david
wants to merge
13
commits into
diffblue:test-gen-support
from
cristina-david:feature/new-instrumentation-runtime-exceptions
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
27b4597
Add instrumentation that throws exceptions
cristina-david b8d9415
Add --java-throw-runtime-exceptions flag
cristina-david 17575c5
Add instrumentation for throwing NullPointerException and ClassCastEx…
cristina-david adb3b18
Add instrumentation for NegativeArraySizeException
cristina-david 58e2ca3
Add instrumentation for NegativeArraySizeException
cristina-david 7894cbb
Add instrumentation for ArrayIndexOutOfBoundsException
cristina-david 9f9b22d
Add regression test for NegativeArraySizeException
cristina-david 3ac8e40
Add regression test for ArrayIndexOutOfBoundsException
cristina-david e960c50
Use better function names
cristina-david 60c7c8c
Address reviewers comments
cristina-david 30e7349
Added regression test for throwing NullPointerException
cristina-david 18714d5
Added more comments
cristina-david 20f8791
Added more regression tests for runtime exceptions
cristina-david File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+918 Bytes
regression/cbmc-java/ArrayIndexOutOfBoundsException/ArrayIndexOutOfBoundsExceptionTest.class
Binary file not shown.
14 changes: 14 additions & 0 deletions
14
regression/cbmc-java/ArrayIndexOutOfBoundsException/ArrayIndexOutOfBoundsExceptionTest.java
This file contains hidden or 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,14 @@ | ||
public class ArrayIndexOutOfBoundsExceptionTest { | ||
public static void main(String args[]) { | ||
try { | ||
int[] a=new int[4]; | ||
a[6]=0; | ||
// TODO: fix the bytecode convertion such that there is no need for | ||
// an explicit throw in order to convert the handler | ||
throw new RuntimeException(); | ||
} | ||
catch(ArrayIndexOutOfBoundsException exc) { | ||
assert false; | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
regression/cbmc-java/ArrayIndexOutOfBoundsException/test.desc
This file contains hidden or 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 @@ | ||
CORE | ||
ArrayIndexOutOfBoundsExceptionTest.class | ||
--java-throw-runtime-exceptions | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^.*assertion at file ArrayIndexOutOfBoundsExceptionTest.java line 11 function.*: FAILURE$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+976 Bytes
regression/cbmc-java/ClassCastException1/ClassCastExceptionTest.class
Binary file not shown.
21 changes: 21 additions & 0 deletions
21
regression/cbmc-java/ClassCastException1/ClassCastExceptionTest.java
This file contains hidden or 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,21 @@ | ||
class A { | ||
int i; | ||
} | ||
|
||
class B { | ||
int j; | ||
} | ||
|
||
public class ClassCastExceptionTest { | ||
public static void main(String args[]) { | ||
try { | ||
Object x = new Integer(0); | ||
String y=(String)x; | ||
throw new RuntimeException(); | ||
} | ||
catch (ClassCastException exc) { | ||
assert false; | ||
} | ||
|
||
} | ||
} |
This file contains hidden or 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 @@ | ||
CORE | ||
ClassCastExceptionTest.class | ||
--java-throw-runtime-exceptions | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^.*assertion at file ClassCastExceptionTest.java line 17 function.*: FAILURE$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+976 Bytes
regression/cbmc-java/ClassCastException2/ClassCastExceptionTest.class
Binary file not shown.
21 changes: 21 additions & 0 deletions
21
regression/cbmc-java/ClassCastException2/ClassCastExceptionTest.java
This file contains hidden or 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,21 @@ | ||
class A { | ||
int i; | ||
} | ||
|
||
class B { | ||
int j; | ||
} | ||
|
||
public class ClassCastExceptionTest { | ||
public static void main(String args[]) { | ||
try { | ||
Object x = new Integer(0); | ||
String y=(String)x; | ||
throw new RuntimeException(); | ||
} | ||
catch (ClassCastException exc) { | ||
assert false; | ||
} | ||
|
||
} | ||
} |
This file contains hidden or 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 @@ | ||
CORE | ||
ClassCastExceptionTest.class | ||
|
||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^.*Dynamic cast check: FAILURE$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file added
BIN
+889 Bytes
regression/cbmc-java/NegativeArraySizeException/NegativeArraySizeExceptionTest.class
Binary file not shown.
11 changes: 11 additions & 0 deletions
11
regression/cbmc-java/NegativeArraySizeException/NegativeArraySizeExceptionTest.java
This file contains hidden or 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 NegativeArraySizeExceptionTest { | ||
public static void main(String args[]) { | ||
try { | ||
int a[]=new int[-1]; | ||
throw new RuntimeException(); | ||
} | ||
catch (NegativeArraySizeException exc) { | ||
assert false; | ||
} | ||
} | ||
} |
This file contains hidden or 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 @@ | ||
CORE | ||
NegativeArraySizeExceptionTest.class | ||
--java-throw-runtime-exceptions | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^.*assertion at file NegativeArraySizeExceptionTest.java line 8 function.*: FAILURE$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or 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 @@ | ||
class B extends RuntimeException {} | ||
|
||
class A { | ||
int i; | ||
} | ||
|
||
public class Test { | ||
public static void main(String args[]) { | ||
A a=null; | ||
try { | ||
int i=a.i; | ||
throw new B(); | ||
} | ||
catch (NullPointerException exc) { | ||
assert false; | ||
} | ||
} | ||
} |
This file contains hidden or 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 @@ | ||
CORE | ||
Test.class | ||
--java-throw-runtime-exceptions | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^.*assertion at file Test.java line 15 function.*: FAILURE$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or 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 @@ | ||
class B extends RuntimeException {} | ||
|
||
class A { | ||
int i; | ||
} | ||
|
||
public class Test { | ||
public static void main(String args[]) { | ||
A a=null; | ||
try { | ||
int i=a.i; | ||
throw new B(); | ||
} | ||
catch (NullPointerException exc) { | ||
assert false; | ||
} | ||
} | ||
} |
This file contains hidden or 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 @@ | ||
CORE | ||
Test.class | ||
|
||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^.*reference is null in \*a: FAILURE$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing help documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.