Added reg tests from HARMONY-2141, HARMONY-2144, HARMONY-2147
updated README for regression tests
git-svn-id: https://svn.apache.org/repos/asf/harmony/enhanced/drlvm/trunk@766525 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/test/regression/H2141/AbcdTest.java b/src/test/regression/H2141/AbcdTest.java
new file mode 100644
index 0000000..cb43f3d
--- /dev/null
+++ b/src/test/regression/H2141/AbcdTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.drlvm.tests.regression.h2141;
+
+import junit.framework.TestCase;
+
+public class AbcdTest extends TestCase {
+
+ public void test() {
+ int i = 0;
+ int arr[] = new int[300000];
+ try {
+ for(i=0; i<100000; i++) {
+ while(i<3) {
+ arr[i-1] = 1;
+ i++;
+ }
+ }
+ fail("ArrayIndexOutOfBoundsException wasn't thrown");
+ } catch (ArrayIndexOutOfBoundsException e) {
+ System.out.println("TEST 1 PASSED");
+ }
+
+ i = 0;
+ try {
+ for(i=0; i<100000; i++) {
+ if (i>5) {
+ arr[i-100] = 1;
+ i++;
+ }
+ }
+ fail("ArrayIndexOutOfBoundsException wasn't thrown");
+ } catch (ArrayIndexOutOfBoundsException e) {
+ System.out.println("TEST 2 PASSED");
+ }
+ }
+}
diff --git a/src/test/regression/H2141/run.test.xml b/src/test/regression/H2141/run.test.xml
new file mode 100644
index 0000000..888ed2c
--- /dev/null
+++ b/src/test/regression/H2141/run.test.xml
@@ -0,0 +1,25 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. -->
+
+<project name="RUN HARMONY-2141 Regression Test">
+ <target name="run-test">
+ <run-junit-test
+ test="org.apache.harmony.drlvm.tests.regression.h2141.AbcdTest"
+ vmarg="-Xem:server_static">
+ </run-junit-test>
+ </target>
+</project>
+
diff --git a/src/test/regression/H2144/Abcd2Test.java b/src/test/regression/H2144/Abcd2Test.java
new file mode 100644
index 0000000..580d817
--- /dev/null
+++ b/src/test/regression/H2144/Abcd2Test.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.drlvm.tests.regression.h2144;
+
+import junit.framework.TestCase;
+
+public class Abcd2Test extends TestCase {
+
+ private final int limit = 10000;
+
+ public void test() {
+ int arr[] = new int[limit];
+ int j=1;
+ try {
+ for(int k=2; k<limit; k=1+k+k*j) {
+ if (k<0) System.out.println("---Overflow---");
+ System.out.println("k=" + k + ": arr[" + (k-2) + "] will be called");
+ arr[k] = arr[k-2];
+ j = k*k;
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ System.out.println("TEST PASSED ArrayIndexOutOfBoundsException was thrown");
+ return;
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("TEST FAILED: unexpected exception was thrown");
+ }
+ fail("TEST FAILED: ArrayIndexOutOfBoundsException wasn't thrown");
+ }
+}
diff --git a/src/test/regression/H2144/run.test.xml b/src/test/regression/H2144/run.test.xml
new file mode 100644
index 0000000..2193e48
--- /dev/null
+++ b/src/test/regression/H2144/run.test.xml
@@ -0,0 +1,25 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. -->
+
+<project name="RUN HARMONY-2144 Regression Test">
+ <target name="run-test">
+ <run-junit-test
+ test="org.apache.harmony.drlvm.tests.regression.h2144.Abcd2Test"
+ vmarg="-Xem:server_static">
+ </run-junit-test>
+ </target>
+</project>
+
diff --git a/src/test/regression/H2147/Abcd1Test.java b/src/test/regression/H2147/Abcd1Test.java
new file mode 100644
index 0000000..2c72d75
--- /dev/null
+++ b/src/test/regression/H2147/Abcd1Test.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.drlvm.tests.regression.h2147;
+
+import junit.framework.TestCase;
+
+public class Abcd1Test extends TestCase {
+
+ private final int limit = 1000;
+
+ public void test() {
+ int arr[] = new int[limit];
+ try {
+ for(int k=1; k<limit; ) {
+ System.out.println("k=" + k + ": arr[" + (k-1) + "] will be called");
+ k=arr[k-1];
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ System.out.println("TEST PASSED: ArrayIndexOutOfBoundsException was thrown");
+ return;
+ }
+ fail("TEST FAILED: ArrayIndexOutOfBoundsException wasn't thrown");
+ }
+}
diff --git a/src/test/regression/H2147/LowBoundCheckTest.java b/src/test/regression/H2147/LowBoundCheckTest.java
new file mode 100644
index 0000000..595c861
--- /dev/null
+++ b/src/test/regression/H2147/LowBoundCheckTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.drlvm.tests.regression.h2147;
+
+import junit.framework.TestCase;
+
+public class LowBoundCheckTest extends TestCase {
+
+ static int num = 0;
+
+ public void test() {
+ try {
+ int[] arr = new int[5];
+ int limit = arr.length-1;
+ for (int j=limit; j > 0; j--) {
+ System.out.println("Call arr[" + (j-3) + "]");
+ num = arr[j-3];
+ }
+ fail("TEST FAILED: ArrayIndexOutOfBoundsException wasn't thrown");
+ } catch (ArrayIndexOutOfBoundsException ae) {
+ System.out.println("TEST PASSED");
+ }
+ }
+}
diff --git a/src/test/regression/H2147/run.test.xml b/src/test/regression/H2147/run.test.xml
new file mode 100644
index 0000000..e00bc6c
--- /dev/null
+++ b/src/test/regression/H2147/run.test.xml
@@ -0,0 +1,29 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. -->
+
+<project name="RUN HARMONY-2147 Regression Test">
+ <target name="run-test">
+ <run-junit-test
+ test="org.apache.harmony.drlvm.tests.regression.h2147.Abcd1Test"
+ vmarg="-Xem:server_static">
+ </run-junit-test>
+ <run-junit-test
+ test="org.apache.harmony.drlvm.tests.regression.h2147.LowBoundCheckTest"
+ vmarg="-Xem:server_static">
+ </run-junit-test>
+ </target>
+</project>
+
diff --git a/src/test/regression/README.txt b/src/test/regression/README.txt
index d76e028..4a36257 100644
--- a/src/test/regression/README.txt
+++ b/src/test/regression/README.txt
@@ -108,9 +108,9 @@
--------------
To execute the Regression Test Suite type
- > build reg.test
+ > ant reg.test
-in build directory of DRLVM workspace. This will execute all non-excluded
+in top level directory of DRLVM workspace. This will execute all non-excluded
regression tests for your platform configuration.
Also by providing the value for 'test.case' property you can choose
@@ -118,12 +118,12 @@
For example, to run only H1234 regression test type the following
on your command line:
- > build -Dtest.case=H1234 reg.test
+ > ant -Dtest.case=H1234 reg.test
To check for several regressions use coma or space separated list as a value for
the property. So the following command:
- > build -Dtest.case="H1234,H4321" reg.test
+ > ant -Dtest.case="H1234,H4321" reg.test
will execute two regression tests - H1234 and H4321.