summaryrefslogtreecommitdiffstats
path: root/test/IntMath
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2011-09-22 18:57:50 -0700
committerIan Rogers <irogers@google.com>2011-09-22 20:05:44 -0700
commit932746a4f22951abcba7b7c4c94c27b1bf164272 (patch)
tree4a841e3990467b22c36c74cca1e7a952754e49e6 /test/IntMath
parenta0841a83323a82e3bed3d0b5f2e6ec3795f496be (diff)
downloadart-932746a4f22951abcba7b7c4c94c27b1bf164272.zip
art-932746a4f22951abcba7b7c4c94c27b1bf164272.tar.gz
art-932746a4f22951abcba7b7c4c94c27b1bf164272.tar.bz2
Stack overflow error and unit test.
Change-Id: Ie7198569207b1b87c50d986df002c551ad5d7d3a
Diffstat (limited to 'test/IntMath')
-rw-r--r--test/IntMath/IntMath.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/IntMath/IntMath.java b/test/IntMath/IntMath.java
index c43d09e..e5fa806 100644
--- a/test/IntMath/IntMath.java
+++ b/test/IntMath/IntMath.java
@@ -786,6 +786,25 @@ class IntMath extends IntMathBase {
return res;
}
+ static long recursion_count_;
+ static void throwStackOverflow(long l) {
+ recursion_count_++;
+ throwStackOverflow(recursion_count_);
+ }
+
+ static long testStackOverflow() {
+ try {
+ throwStackOverflow(0);
+ if (recursion_count_ != 0) {
+ return recursion_count_;
+ } else {
+ return -1;
+ }
+ } catch(StackOverflowError soe) {
+ return 0;
+ }
+ }
+
public static void main(String[] args) {
boolean failure = false;
int res;
@@ -947,6 +966,14 @@ class IntMath extends IntMathBase {
failure = true;
}
+ lres= testStackOverflow();
+ if (lres == 0) {
+ System.out.println("testStackOverflow PASSED");
+ } else {
+ System.out.println("testStackOverflow FAILED: " + lres);
+ failure = true;
+ }
+
res = manyArgs(0, 1L, 2, 3L, 4, 5L, 6, 7, 8.0, 9.0f, 10.0,
(short)11, 12, (char)13, 14, 15, (byte)-16, true, 18,
19, 20L, 21L, 22, 23, 24, 25, 26);