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
diff --git a/test/530-checker-loops/src/Main.java b/test/530-checker-loops/src/Main.java
index 9f344dd..0c32491 100644
--- a/test/530-checker-loops/src/Main.java
+++ b/test/530-checker-loops/src/Main.java
@@ -914,7 +914,7 @@
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 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 @@
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();