harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r502595 - in /harmony/enhanced/drlvm/trunk/src/test/regression/H3027: ./ AgentLib.cpp AgentLibTest.java run.test.xml
Date Fri, 02 Feb 2007 13:08:26 GMT
Author: gshimansky
Date: Fri Feb  2 05:08:25 2007
New Revision: 502595

URL: http://svn.apache.org/viewvc?view=rev&rev=502595
Log:
Applied HARMONY-3108 [drlvm][jvmti] Regression test for HARMONY-3027

Tested on ia32 linux and windows


Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H3027/
    harmony/enhanced/drlvm/trunk/src/test/regression/H3027/AgentLib.cpp   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H3027/AgentLibTest.java   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H3027/run.test.xml   (with props)

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3027/AgentLib.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3027/AgentLib.cpp?view=auto&rev=502595
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3027/AgentLib.cpp (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3027/AgentLib.cpp Fri Feb  2 05:08:25
2007
@@ -0,0 +1,49 @@
+#include <string.h>
+#include <jvmti.h>
+
+static void JNICALL vm_init_callback(jvmtiEnv* jvmti_env, JNIEnv* jni_env, jthread thread)
+{
+    jclass cl = jni_env->FindClass("org/apache/harmony/drlvm/tests/regression/h3027/Status");
+    if (NULL == cl)
+        return;
+
+    jfieldID fid = jni_env->GetStaticFieldID(cl, "status", "Z");
+    if (NULL == fid)
+        return;
+
+    jni_env->SetStaticBooleanField(cl, fid, JNI_TRUE);
+}
+
+JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
+{
+    jvmtiEnv *jvmti_env;
+    if(vm->GetEnv((void**)&jvmti_env, JVMTI_VERSION_1_0) != JNI_OK)
+        return JNI_ERR;
+
+    // Get all supported capabilities
+    jvmtiCapabilities capabilities;
+    jvmtiError result = jvmti_env->GetPotentialCapabilities(&capabilities);
+    if (JVMTI_ERROR_NONE != result)
+        return JNI_ERR;
+
+    // Enabled all supported capabilities
+    result = jvmti_env->AddCapabilities(&capabilities);
+    if (JVMTI_ERROR_NONE != result)
+        return JNI_ERR;
+
+    jvmtiEventCallbacks callbacks;
+    memset(&callbacks, 0, sizeof(jvmtiEventCallbacks));
+    callbacks.VMInit = vm_init_callback;
+
+    // Set callback for VMInit
+    result = jvmti_env->SetEventCallbacks(&callbacks, (jint)sizeof(callbacks));
+    if (JVMTI_ERROR_NONE != result)
+        return JNI_ERR;
+
+    // Set event mode to true
+    result = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
+    if (JVMTI_ERROR_NONE != result)
+        return JNI_ERR;
+
+    return JNI_OK;
+}

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H3027/AgentLib.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3027/AgentLibTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3027/AgentLibTest.java?view=auto&rev=502595
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3027/AgentLibTest.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3027/AgentLibTest.java Fri Feb  2 05:08:25
2007
@@ -0,0 +1,24 @@
+package org.apache.harmony.drlvm.tests.regression.h3027;
+
+import junit.framework.TestCase;
+
+/**
+ * Test case for -agentlib: command line option. 
+ * Should be executed with all JVMTI capabilie enabled.
+ */
+public class AgentLibTest extends TestCase {
+    public static void main(String args[]) {
+        (new AgentLibTest()).test();
+    }
+
+    public void test() {
+        System.out.println("test done");
+
+        assertTrue(Status.status);
+    }
+}
+
+class Status {
+    public static boolean status = false;
+}
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H3027/AgentLibTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H3027/run.test.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H3027/run.test.xml?view=auto&rev=502595
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H3027/run.test.xml (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H3027/run.test.xml Fri Feb  2 05:08:25
2007
@@ -0,0 +1,14 @@
+<project name="RUN HARMONY-3027 Regression Test">
+    <target name="run-test">
+        <run-junit-test 
+            test="org.apache.harmony.drlvm.tests.regression.h3027.AgentLibTest">
+            <junit-element>
+                <jvmarg value="-Dvm.assert_dialog=0"/>
+                <jvmarg value="-agentlib:AgentLib"/>
+                <env key="PATH" path="${reg.test.2launch.native.path}:${env.PATH}"/>
+                <env key="LD_LIBRARY_PATH" path="${reg.test.2launch.native.path}:${env.LD_LIBRARY_PATH}"/>
+            </junit-element>
+        </run-junit-test>
+    </target>
+</project>
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H3027/run.test.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message