Index: build/make/targets/reg.test.xml =================================================================== --- build/make/targets/reg.test.xml 2006-12-06 12:12:00.718750000 +0600 +++ build/make/targets/reg.test.xml 2006-12-08 15:40:23.593750000 +0600 @@ -20,9 +20,29 @@ - - + + + + + + + + + + + + + + + + + + + Is not designed for this platform! + + @@ -55,7 +75,7 @@ - + @@ -88,7 +108,7 @@ - + @@ -97,46 +117,59 @@ - - - - - + + + + + + + + + + + + + + + - - - - + + + - - + + + + + + + + + + - + + outfile="${reg.test.native.path}/${outfile}" + objdir="${objdir}"> - + - - @@ -165,6 +198,8 @@ - + Index: build/make/targets/reg.test.run.xml =================================================================== --- build/make/targets/reg.test.run.xml 2006-12-06 12:12:00.718750000 +0600 +++ build/make/targets/reg.test.run.xml 2006-12-08 15:00:28.484375000 +0600 @@ -15,41 +15,131 @@ See the License for the specific language governing permissions and limitations under the License. --> - - + + + + + - + - + + + + ================================== Run regression tests ================================== - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + @@ -62,10 +152,11 @@ @@ -75,6 +166,16 @@ + + + + + + + + + + @@ -87,16 +188,9 @@ - - Index: src/test/regression/README.txt =================================================================== --- src/test/regression/README.txt (revision 0) +++ src/test/regression/README.txt (revision 0) @@ -0,0 +1,94 @@ + Directions for Regression Test Developers + ========================================= + + This file describes conventions accepted for VM regression test suite + and steps needed to integrate new tests into the suite. + --------------------------------------------------------------------- + + +Test Format and Test Naming conventions +--------------------------------------- + + 1. The tests are supposed to be in JUnit test format + + 2. The source files of each regression test should be placed in a directory + named H{NUMBER}, where {NUMBER} (here and below) is an ID + of JIRA issue the test is related to. + For example: H1234 + + 3. The name of the main class should end with Test suffix + For example: SomethingTest.java + + 4. The package of the test should be + org.apache.harmony.drlvm.tests.regression.h{NUMBER} + For example: org.apache.harmony.drlvm.tests.regression.h1234 + + 5. The source files for the tests can be in Java, Java Assembler, and + C/C++ programming languages. + + +New Test Integration +-------------------- + +To integrate new test in the regression test suite: + + 1. Make sure it complies with conventions described above. + + 2. Put the test sources into H{NUMBER} directory. + + 3. By default test execution entry point is a class ending with Test + suffix. It will be automatically launched by regression test + infrastructure as a JUnit test. If there are several classes ending + with Test suffix all of them will be launched. + +After that regression test infrastructure will be able to compile and +execute your test. + + +Custom Test Launchers +--------------------- + +If there is a need in some more sophisticated test launching mechanism +(JVM parameters or environment variables need to be specified in order to +reproduce the problem, etc.) it can be done by using CUSTOM LAUNCHER. +It is an Ant build file named run.test.xml and placed near the test +sources. The target named "run-test" should specify the way in which the +test is launched. This Ant's file is executed in context of DRLVM build +system and inherits all the properties, references, and macrodefinitions +defined there. The custom launcher is started from + build/make/targets/reg.test.run.xml +file which contains some useful macrodefinitions to simplify custom +launchers. + + Note: If there are tests with Test suffix along with the custom launcher + ----- they won't be automatically launched by regression testing + infrastructure. + + +Some useful properties for custom launchers: +------------------------------------------- + + ${reg.test.class.path} - the path to where java and + java assembler sources were compiled + + ${reg.test.2launch.native.path} - the path to where native + sources were compiled + + +Examples +-------- +The best way to learn something is to use examples. Please, use existing +regression tests for this purpose. The following tests can act as a starting +points: + + H1694 - Simple JUnit test automatically compiled and + launched by regression testing framework. + + H2151 - The test consisting of java and native code. + It uses custom launcher for execution. + + H788 - The test consisting of java and java assembler + sources. Source files are automatically compiled by + regression testing framework. The entry point for the test + is JUnit test implemented by Test.java source file. + Index: src/test/regression/H0000/run.test.xml =================================================================== --- src/test/regression/H0000/run.test.xml (revision 482894) +++ src/test/regression/H0000/run.test.xml (working copy) @@ -1,13 +0,0 @@ - - - - - - - - - - - - Index: src/test/regression/H0000/DirectByteBufferTest.java =================================================================== --- src/test/regression/H0000/DirectByteBufferTest.java (revision 482894) +++ src/test/regression/H0000/DirectByteBufferTest.java (working copy) @@ -1,18 +0,0 @@ -package org.apache.harmony.drlvm.tests.regression.h0000; - -import junit.framework.TestCase; - -public class DirectByteBufferTest extends TestCase { - - static { System.loadLibrary("DirectByteBufferTest"); } - - public static void main(String[] args) { - new DirectByteBufferTest().testValidBuffer(); - } - - private native String testValidBuffer0(); - - public void testValidBuffer() { - assertNull(testValidBuffer0()); - } -} Index: src/test/regression/H0000/DirectByteBufferTest.c =================================================================== --- src/test/regression/H0000/DirectByteBufferTest.c (revision 482894) +++ src/test/regression/H0000/DirectByteBufferTest.c (working copy) @@ -1,50 +0,0 @@ -#include -#include -#include -#include - -JNIEXPORT jstring JNICALL Java_org_apache_harmony_drlvm_tests_regression_h0000_DirectByteBufferTest_testValidBuffer0 - (JNIEnv *, jobject); - - -/* - * Class: DirectByteBufferTest - * Method: testValidBuffer0 - * Signature: ()Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_org_apache_harmony_drlvm_tests_regression_h0000_DirectByteBufferTest_testValidBuffer0 - (JNIEnv *jenv, jobject unused) -{ - char* error = (char*)calloc(256, 1); - const jlong BUF_SIZE = 100; - void* buf = malloc(BUF_SIZE); - jobject jbuf = (*jenv)->NewDirectByteBuffer(jenv, buf, BUF_SIZE); - void* addr = (*jenv)->GetDirectBufferAddress(jenv, jbuf); - jlong size = (*jenv)->GetDirectBufferCapacity(jenv, jbuf); - jstring jstr; - if (jbuf) { - if (addr != buf) { - sprintf(error, "invalid buffer address: expected %p but was %p\n", buf, addr); - } - if (size != BUF_SIZE) { - sprintf(error + strlen(error), - "invalid buffer capacity: expected %d but was %d\n", BUF_SIZE, size); - } - } else { - // access to direct buffers not supported - if (addr != NULL | size != -1) { - sprintf(error, "inconsistent NIO support:\n" - "NewDirectByteBuffer() returned NULL;\n" - "GetDirectBufferAddress() returned %p\n" - "GetDirectBufferCapacity() returned %d\n", addr, size); - } else { - sprintf(error, "no NIO support\n"); - } - } - - jstr = strlen(error) ? (*jenv)->NewStringUTF(jenv, error) : NULL; - free(buf); - free(error); - - return jstr; -} Index: src/test/regression/H0000/readme.txt =================================================================== --- src/test/regression/H0000/readme.txt (revision 482894) +++ src/test/regression/H0000/readme.txt (working copy) @@ -1,10 +0,0 @@ -Test sources were taken and modified from src/test/jni/nio. -Currenlty the test fails with the following message: - -HMYEXEL062E Internal VM error: Failed to create Java VM -FAILED to invoke JVM. - -But it is impossible to determine wether the test pass or not -because in both cases VM returns 0 status code. - -It demonstrates limitations of using of JUnit test format for VM testing. \ No newline at end of file