diff options
| author | 2016-02-24 15:18:55 -0800 | |
|---|---|---|
| committer | 2016-02-24 15:23:11 -0800 | |
| commit | 6ab903c1ada868d9e7368107385f0de0b17ae646 (patch) | |
| tree | 928c57ac4dc36fefca6150b8f18cc4a921cfe4da | |
| parent | dcf7db26bdf098b507623b5bf99c4e2bd045b2d1 (diff) | |
Avoid single expensive test in 530-checker-loops.
Rationale:
All tests run in "no time", except one instance
that iterates over full iteration space before
going OOB. Protect that instance with a HEAVY
boolean to avoid timing out in interpretation mode.
Impact on interpreted runtime:
1m6.936s -> 0m0.031s
Change-Id: I413939b683c76b7be0f1259da8533d4b069eac6d
| -rw-r--r-- | test/530-checker-loops/src/Main.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/test/530-checker-loops/src/Main.java b/test/530-checker-loops/src/Main.java index 9f344dda11..0c32491e4e 100644 --- a/test/530-checker-loops/src/Main.java +++ b/test/530-checker-loops/src/Main.java @@ -914,7 +914,7 @@ public class Main { int[] a = { 1 } ; for (int i = 0; i < hi; i++) { // Dangerous loop where careless static range analysis would yield strict lower bound - // on index j of 5. When, for instance, lo and thus i = 2147483647, the upper bound + // on index j of 5. When, for instance, hi and thus i = 2147483647, the upper bound // becomes really negative due to arithmetic wrap-around, causing OOB. // Dynamic BCE is feasible though, since it checks the range. for (int j = 6; j > i + 5; j--) { @@ -1325,6 +1325,9 @@ public class Main { // public static void main(String[] args) { + // Set to run expensive tests for correctness too. + boolean HEAVY = false; + int[] empty = { }; int[] x = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; @@ -1510,13 +1513,15 @@ public class Main { sResult += 1000; } expectEquals(1, sResult); - sResult = 0; - try { - hiddenOOB2(2147483647); // OOB - } catch (ArrayIndexOutOfBoundsException e) { - sResult += 1000; + if (HEAVY) { + sResult = 0; + try { + hiddenOOB2(2147483647); // OOB + } catch (ArrayIndexOutOfBoundsException e) { + sResult += 1000; + } + expectEquals(1002, sResult); } - expectEquals(1002, sResult); sResult = 0; try { hiddenInfiniteOOB(); |