harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r597138 [9/15] - in /harmony/enhanced/drlvm/trunk: build/make/ build/make/components/vm/ vm/include/ vm/include/open/ vm/jitrino/src/codegenerator/ia32/ vm/port/src/encoder/ia32_em64t/ vm/port/src/lil/ia32/pim/ vm/tests/ncai/ vm/tests/ncai/...
Date Wed, 21 Nov 2007 16:29:54 GMT
Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/SuspendResumeThread/SuspendThread03n/SuspendThread03n.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/SuspendResumeThread/SuspendThread03n/SuspendThread03n.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/SuspendResumeThread/SuspendThread03n/SuspendThread03n.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/SuspendResumeThread/SuspendThread03n/SuspendThread03n.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,295 @@
+/**
+ * @author Petr Ivanov
+ * @version $Revision: 1.1.1.1 $
+ *
+ */
+
+/* *********************************************************************** */
+
+#include "events.h"
+#include "utils.h"
+#include "ncai.h"
+
+#ifdef POSIX
+#include <stdlib.h>
+#include <time.h>
+#else
+#include <windows.h>
+#include <CRTDBG.H>
+#endif
+
+#ifdef POSIX
+#define SLEEP_UNIVERSAL(_x_)  { timespec delay = {(_x_)/1000, 1000000*((_x_)%1000)}; nanosleep(&delay, NULL); }
+#else // #ifdef POSIX
+#define SLEEP_UNIVERSAL(_x_)  Sleep((_x_))
+#endif // #ifdef POSIX
+
+static int g_stop_thread = 0;
+static volatile int g_resume_agent_thread = 0;
+static jthread g_thread_jthread;
+//static jthread g_agent_thread;
+
+//volatile int no_opt = 1; //used to prevent inlining;
+
+//static int counter = 0;
+
+static bool test = false;
+static bool util = false;
+static bool flag = false;
+
+const char test_case_name[] = "SuspendThread03n";
+/*
+void Test1(JNIEnv *env, jobject obj);
+void Test2(JNIEnv *env, jobject obj);
+void Test3(JNIEnv *env, jobject obj);
+void JNICALL test_function(jvmtiEnv*, JNIEnv*, void*);*/
+static bool CheckSuspend(ncaiEnv*, ncaiThread);
+
+extern "C" JNIEXPORT void JNICALL
+Java_ncai_funcs_SuspendThread03n_resumeagent(JNIEnv *env, jclass cls)
+{
+    //warning fix
+    int w_fix = sizeof(cls);
+    w_fix += sizeof(env);
+    //
+
+    g_resume_agent_thread = 1;
+}
+
+extern "C" JNIEXPORT jboolean JNICALL
+Java_ncai_funcs_SuspendThread03n_stopsignal(JNIEnv *env, jclass cls)
+{
+    //warning fix
+    int w_fix = sizeof(cls);
+    w_fix += sizeof(env);
+    //
+
+    return g_stop_thread ? true : false;
+}
+
+extern "C" JNIEXPORT void JNICALL Java_ncai_funcs_SuspendThread03n_TestFunction1
+  (JNIEnv *env, jobject obj)
+{
+    fprintf(stderr, "thread - native TestFunction1\n");
+
+    //warning fix
+    int w_fix = sizeof(obj);
+    w_fix += sizeof(env);
+    //
+
+    g_resume_agent_thread = 1;
+    while(!g_stop_thread)
+    {
+        fprintf(stderr, "thread... \n");
+        SLEEP_UNIVERSAL(100);
+    }
+
+    return;
+}
+
+void JNICALL ThreadStart(jvmtiEnv *jvmti_env,
+            JNIEnv* jni_env,
+            jthread thread)
+{
+    jvmtiPhase phase;
+    jvmtiError result;
+    jvmtiThreadInfo tinfo;
+
+    result = jvmti_env->GetPhase(&phase);
+    if (result != JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE)
+        return;
+
+    result = jvmti_env->GetThreadInfo(thread, &tinfo);
+    if (result != JVMTI_ERROR_NONE)
+        return;
+
+    if (strcmp(tinfo.name, "java_thread") != 0)
+        return;
+
+    printf("ThreadStart: java_thread\n");
+    g_thread_jthread = jni_env->NewGlobalRef(thread);
+/*
+    jclass clazz = jni_env->FindClass("java/lang/Thread");
+    if (!clazz)
+    {
+        fprintf(stderr, "\tnative: JNI: FindClass failed\n");
+        return;
+    }
+
+    jmethodID mid = jni_env->GetMethodID(clazz, "<init>", "()V");
+    if (!mid)
+    {
+        fprintf(stderr, "\tnative: JNI: GetMethodID failed\n");
+        return;
+    }
+
+    g_agent_thread = jni_env->NewObject(clazz, mid, "native_agent_thread");
+    if (!g_agent_thread)
+    {
+        fprintf(stderr, "\tnative: JNI: NewObject failed\n");
+        return;
+    }
+
+    g_agent_thread = jni_env->NewGlobalRef(g_agent_thread);
+    result = jvmti_env->GetThreadInfo(g_agent_thread, &tinfo);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\tnative: JNI: GetThreadInfo failed\n");
+    }
+
+    result = jvmti_env->RunAgentThread(g_agent_thread, test_function, NULL, JVMTI_THREAD_NORM_PRIORITY);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\tnative: jvmti: RunAgentThread failed\n");
+        return;
+    }*/
+}
+
+/* *********************************************************************** */
+
+JNIEXPORT jint JNICALL Agent_OnLoad(prms_AGENT_ONLOAD)
+{
+
+    Callbacks CB;
+    CB.cbThreadStart = &ThreadStart;
+    check_AGENT_ONLOAD;
+    jvmtiEvent events[] = { JVMTI_EVENT_EXCEPTION, JVMTI_EVENT_THREAD_START, JVMTI_EVENT_VM_DEATH };
+    cb_exc;
+    cb_death;
+    return func_for_Agent_OnLoad(vm, options, reserved, &CB,
+        events, sizeof(events)/sizeof(jvmtiEvent), test_case_name, DEBUG_OUT);
+}
+
+/* *********************************************************************** */
+
+void JNICALL callbackException(jvmtiEnv *jvmti_env, JNIEnv* jni_env,
+                               jthread thread, jmethodID method,
+                               jlocation location, jobject exception,
+                               jmethodID catch_method, jlocation catch_location)
+{
+    check_EXCPT;
+    if (flag) return;
+
+    /*
+     * Function separate all other exceptions in all other method
+     */
+    if (!check_phase_and_method_debug(jvmti_env, method, SPP_LIVE_ONLY,
+                "special_method", DEBUG_OUT)) return;
+
+    flag = true;
+    util = true;
+
+    fprintf(stderr, "agent... \n");
+    SLEEP_UNIVERSAL(300);
+    ////////////////////ncai env get
+    jvmtiError err;
+    ncaiError ncai_err;
+
+    jvmtiExtensionFunctionInfo* ext_info = NULL;
+    jint ext_count = 0;
+
+    err = jvmti_env->GetExtensionFunctions(&ext_count, &ext_info);
+
+    if (err != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "test_function: GetExtensionFunctions() returned error: %d, '%s'\n",
+            err, get_jvmti_eror_text(err));
+        test = false;
+        return;
+    }
+
+    fprintf(stderr, "agent... \n");
+    if (ext_count == 0 || ext_info == NULL)
+    {
+        fprintf(stderr, "test_function: GetExtensionFunctions() returned no extensions\n");
+        test = false;
+        return;
+    }
+
+    jvmtiExtensionFunction get_ncai_func = NULL;
+
+    fprintf(stderr, "agent... \n");
+    for (int k = 0; k < ext_count; k++)
+    {
+        if (strcmp(ext_info[k].id, "org.apache.harmony.vm.GetExtensionEnv") == 0)
+        {
+            get_ncai_func = ext_info[k].func;
+            break;
+        }
+    }
+
+    fprintf(stderr, "agent... \n");
+    if (get_ncai_func == NULL)
+    {
+        fprintf(stderr, "test_function: GetNCAIEnvironment() nas not been found among JVMTI extensions\n");
+        test = false;
+        return;
+    }
+
+    ncaiEnv* ncai_env = NULL;
+
+    fprintf(stderr, "agent... \n");
+    err = get_ncai_func(jvmti_env, &ncai_env, NCAI_VERSION_1_0);
+
+    if (err != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "test_function: get_ncai_func() returned error: %d, '%s'\n",
+            err, get_jvmti_eror_text(err));
+        test = false;
+        return;
+    }
+
+    if (ncai_env == NULL)
+    {
+        fprintf(stderr, "test_function: get_ncai_func() returned NULL environment\n");
+        test = false;
+        return;
+    }
+    fprintf(stderr, "agent... \n");
+    ///////////////////////////////////
+    ncaiThread ncai_thread;
+
+    fprintf(stderr, "calling ncai->GetThreadHandle()...\n");
+    ncai_err = ncai_env->GetThreadHandle(g_thread_jthread, &ncai_thread);
+    if (ncai_err != NCAI_ERROR_NONE)
+    {
+        fprintf(stderr, "ncai->GetThreadHandle() returned error: %d", ncai_err);
+        test = false;
+        return;
+    }
+
+    while(!g_resume_agent_thread)
+            SLEEP_UNIVERSAL(200);
+
+    g_resume_agent_thread = 0;
+
+    test = CheckSuspend(ncai_env, ncai_thread);
+
+    g_stop_thread = 1;
+    SLEEP_UNIVERSAL(500);
+}
+
+void JNICALL callbackVMDeath(prms_VMDEATH)
+{
+    check_VMDEATH;
+    func_for_callback_VMDeath(jni_env, jvmti_env, test_case_name, test, util);
+}
+
+/* *********************************************************************** */
+
+bool CheckSuspend(ncaiEnv *ncai_env, ncaiThread ncai_thread)
+{
+    //warning fix
+    int w_fix = 0;
+    w_fix += sizeof(ncai_thread);
+    //
+
+    ncaiError ncai_err = ncai_env->SuspendThread(NULL);
+    if (ncai_err != NCAI_ERROR_INVALID_THREAD)
+    {
+        fprintf(stderr, "ncai->SuspendThread() returned invalid error: %d,\n", ncai_err);
+        return false;
+    }
+
+    return true;
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/SuspendResumeThread/SuspendThread03n/SuspendThread03n.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/SuspendResumeThread/SuspendThread03n/SuspendThread03n.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/SuspendResumeThread/SuspendThread03n/SuspendThread03n.java?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/SuspendResumeThread/SuspendThread03n/SuspendThread03n.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/SuspendResumeThread/SuspendThread03n/SuspendThread03n.java Wed Nov 21 08:29:40 2007
@@ -0,0 +1,66 @@
+package ncai.funcs;
+
+/**
+ * @author Petr Ivanov
+ * @version $Revision: 1.1.1.1 $
+ *
+ */
+public class SuspendThread03n extends Thread{
+    public native void TestFunction();
+    public native void TestFunction1();
+    public static native boolean stopsignal();
+    public static native void resumeagent();
+
+    static boolean NoLibrary = false;
+    static {
+        try{
+            System.loadLibrary("SuspendThread03n");
+        }
+        catch(Throwable e){
+            NoLibrary = true;
+        }
+    }
+
+    SuspendThread03n(String name)
+    {
+        super(name);
+    }
+
+    static public void main(String args[]) {
+        if(NoLibrary) return;
+        new SuspendThread03n("java_thread").start();
+        special_method();
+        return;
+    }
+
+    public void test_java_func1(){
+        System.out.println("thread - java func1\n");
+        TestFunction1();
+    }
+
+    public void test_java_func2(){
+        System.out.println("thread - java func2\n");
+        test_java_func3();
+    }
+
+    public void test_java_func3(){
+        System.out.println("thread - java func3\n");
+    }
+
+    static public void special_method() {
+        /*
+         * Transfer control to native part.
+         */
+        try {
+            throw new InterruptedException();
+        } catch (Throwable tex) { }
+        return;
+    }
+
+    public void run() {
+        System.out.println("thread - java run\n");
+        test_java_func1();
+    }
+}
+
+

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/SuspendResumeThread/SuspendThread03n/SuspendThread03n.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01/TerminateThread01.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01/TerminateThread01.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01/TerminateThread01.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01/TerminateThread01.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,376 @@
+/**
+ * @author Petr Ivanov
+ * @version $Revision: 1.1.1.1 $
+ *
+ */
+
+/* *********************************************************************** */
+
+#include "events.h"
+#include "utils.h"
+#include "ncai.h"
+
+#ifdef POSIX
+#include <stdlib.h>
+#include <time.h>
+#else
+#include <windows.h>
+#include <CRTDBG.H>
+#endif
+
+#ifdef POSIX
+#define SLEEP_UNIVERSAL(_x_)  { timespec delay = {(_x_)/1000, 1000000*((_x_)%1000)}; nanosleep(&delay, NULL); }
+#else // #ifdef POSIX
+#define SLEEP_UNIVERSAL(_x_)  Sleep((_x_))
+#endif // #ifdef POSIX
+
+static int g_stop_thread = 0;
+static volatile int g_resume_agent_thread = 0;
+static jthread g_thread_jthread;
+//static jthread g_agent_thread;
+
+static int counter = 0;
+
+static bool test = false;
+static bool util = false;
+static bool flag = false;
+
+const char test_case_name[] = "TerminateThread01";
+
+extern "C" JNIEXPORT void JNICALL
+Java_ncai_funcs_TerminateThread01_resumeagent(JNIEnv *env, jclass cls)
+{
+    //warning fix
+    int w_fix = sizeof(cls);
+    w_fix += sizeof(env);
+    //
+
+    g_resume_agent_thread++;
+}
+
+extern "C" JNIEXPORT jboolean JNICALL
+Java_ncai_funcs_TerminateThread01_stopsignal(JNIEnv *env, jclass cls)
+{
+    //warning fix
+    int w_fix = sizeof(cls);
+    w_fix += sizeof(env);
+    //
+
+    return g_stop_thread ? true : false;
+}
+
+extern "C" JNIEXPORT void JNICALL Java_ncai_funcs_TerminateThread01_TestFunction
+  (JNIEnv *env, jobject obj)
+{
+    fprintf(stderr, "thread - native TestFunction\n");
+
+    jclass clazz = env->GetObjectClass(obj);
+    if (!clazz)
+    {
+        fprintf(stderr, "\tnative: native TestFunction: GetObjectClass failed\n");
+        return;
+    }
+
+    jmethodID mid = env->GetMethodID(clazz, "test_java_func2", "()V");
+    if (!mid)
+    {
+        fprintf(stderr, "\tnative: native TestFunction: GetStaticMethodID for 'test_java_func2' failed\n");
+        return;
+    }
+    env->CallVoidMethod(obj, mid);
+    return;
+}
+
+extern "C" JNIEXPORT void JNICALL Java_ncai_funcs_TerminateThread01_TestFunction1
+  (JNIEnv *env, jobject obj)
+{
+    fprintf(stderr, "thread - native TestFunction1\n");
+
+    jclass clazz = env->GetObjectClass(obj);
+    if (!clazz)
+    {
+        fprintf(stderr, "\tnative: native TestFunction1: GetObjectClass failed\n");
+        return;
+    }
+
+    jmethodID mid = env->GetStaticMethodID(clazz, "sleep", "(J)V");
+    if (!mid)
+    {
+        fprintf(stderr, "\tnative: native TestFunction1: GetStaticMethodID for 'sleep' failed\n");
+        return;
+    }
+
+    g_resume_agent_thread = 1;
+    while(g_stop_thread)
+    {
+        fprintf(stderr, "thread... \n");
+        SLEEP_UNIVERSAL(100);
+//        env->CallStaticVoidMethod(clazz, mid, 500);
+    }
+
+    counter++;
+    return;
+}
+
+void JNICALL ThreadStart(jvmtiEnv *jvmti_env,
+            JNIEnv* jni_env,
+            jthread thread)
+{
+    jvmtiPhase phase;
+    jvmtiError result;
+    jvmtiThreadInfo tinfo;
+
+    result = jvmti_env->GetPhase(&phase);
+    if (result != JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE)
+        return;
+
+    result = jvmti_env->GetThreadInfo(thread, &tinfo);
+    if (result != JVMTI_ERROR_NONE)
+        return;
+
+    if (strcmp(tinfo.name, "java_thread") != 0)
+        return;
+
+    g_thread_jthread = jni_env->NewGlobalRef(thread);
+/*
+    jclass clazz = jni_env->FindClass("java/lang/Thread");
+    if (!clazz)
+    {
+        fprintf(stderr, "\tnative: JNI: FindClass failed\n");
+        return;
+    }
+
+    jmethodID mid = jni_env->GetMethodID(clazz, "<init>", "()V");
+    if (!mid)
+    {
+        fprintf(stderr, "\tnative: JNI: GetMethodID failed\n");
+        return;
+    }
+
+    g_agent_thread = jni_env->NewObject(clazz, mid, "native_agent_thread");
+    if (!g_agent_thread)
+    {
+        fprintf(stderr, "\tnative: JNI: NewObject failed\n");
+        return;
+    }
+
+    g_agent_thread = jni_env->NewGlobalRef(g_agent_thread);
+    result = jvmti_env->GetThreadInfo(g_agent_thread, &tinfo);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\tnative: JNI: GetThreadInfo failed\n");
+    }
+
+    result = jvmti_env->RunAgentThread(g_agent_thread, test_function, NULL, JVMTI_THREAD_NORM_PRIORITY);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\tnative: jvmti: RunAgentThread failed\n");
+        return;
+    }*/
+}
+
+/* *********************************************************************** */
+
+JNIEXPORT jint JNICALL Agent_OnLoad(prms_AGENT_ONLOAD)
+{
+
+    Callbacks CB;
+    CB.cbThreadStart = &ThreadStart;
+    check_AGENT_ONLOAD;
+    jvmtiEvent events[] = { JVMTI_EVENT_EXCEPTION, JVMTI_EVENT_THREAD_START, JVMTI_EVENT_VM_DEATH };
+    cb_exc;
+    cb_death;
+    return func_for_Agent_OnLoad(vm, options, reserved, &CB,
+        events, sizeof(events)/sizeof(jvmtiEvent), test_case_name, DEBUG_OUT);
+}
+
+/* *********************************************************************** */
+
+void JNICALL callbackException(jvmtiEnv *jvmti_env, JNIEnv* jni_env,
+                               jthread thread, jmethodID method,
+                               jlocation location, jobject exception,
+                               jmethodID catch_method, jlocation catch_location)
+{
+    check_EXCPT;
+    if (flag) return;
+
+    /*
+     * Function separate all other exceptions in all other method
+     */
+    if (!check_phase_and_method_debug(jvmti_env, method, SPP_LIVE_ONLY,
+                "special_method", DEBUG_OUT)) return;
+
+    flag = true;
+    util = true;
+
+    fprintf(stderr, "agent... \n");
+    SLEEP_UNIVERSAL(300);
+    ////////////////////ncai env get
+    jvmtiError err;
+    ncaiError ncai_err;
+
+    jvmtiExtensionFunctionInfo* ext_info = NULL;
+    jint ext_count = 0;
+
+    err = jvmti_env->GetExtensionFunctions(&ext_count, &ext_info);
+
+    if (err != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "test_function: GetExtensionFunctions() returned error: %d, '%s'\n",
+            err, get_jvmti_eror_text(err));
+        test = false;
+        g_stop_thread = 1;
+        return;
+    }
+
+    fprintf(stderr, "agent... \n");
+    if (ext_count == 0 || ext_info == NULL)
+    {
+        fprintf(stderr, "test_function: GetExtensionFunctions() returned no extensions\n");
+        test = false;
+        g_stop_thread = 1;
+        return;
+    }
+
+    jvmtiExtensionFunction get_ncai_func = NULL;
+
+    fprintf(stderr, "agent... \n");
+    for (int k = 0; k < ext_count; k++)
+    {
+        if (strcmp(ext_info[k].id, "org.apache.harmony.vm.GetExtensionEnv") == 0)
+        {
+            get_ncai_func = ext_info[k].func;
+            break;
+        }
+    }
+
+    fprintf(stderr, "agent... \n");
+    if (get_ncai_func == NULL)
+    {
+        fprintf(stderr, "test_function: GetNCAIEnvironment() nas not been found among JVMTI extensions\n");
+        test = false;
+        g_stop_thread = 1;
+        return;
+    }
+
+    ncaiEnv* ncai_env = NULL;
+
+    fprintf(stderr, "agent... \n");
+    err = get_ncai_func(jvmti_env, &ncai_env, NCAI_VERSION_1_0);
+
+    if (err != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "test_function: get_ncai_func() returned error: %d, '%s'\n",
+            err, get_jvmti_eror_text(err));
+        test = false;
+        g_stop_thread = 1;
+        return;
+    }
+
+    if (ncai_env == NULL)
+    {
+        fprintf(stderr, "test_function: get_ncai_func() returned NULL environment\n");
+        test = false;
+        g_stop_thread = 1;
+        return;
+    }
+    fprintf(stderr, "agent... \n");
+    ///////////////////////////////////
+    while(g_resume_agent_thread < 100)
+    {
+        fprintf(stderr, "Agent...");
+        SLEEP_UNIVERSAL(200);
+    }
+
+    g_resume_agent_thread = 0;
+
+    ncaiThread ncai_thread;
+
+    fprintf(stderr, "calling ncai->GetThreadHandle()...\n");
+    ncai_err = ncai_env->GetThreadHandle(g_thread_jthread, &ncai_thread);
+    if (ncai_err != NCAI_ERROR_NONE)
+    {
+        fprintf(stderr, "ncai->GetThreadHandle() returned error: %d", ncai_err);
+        test = false;
+        g_stop_thread = 1;
+        return;
+    }
+
+    ncaiThread* threads;
+    jint threads_returned;
+
+    SLEEP_UNIVERSAL(200);
+
+    test = true;
+
+    ncai_err = ncai_env->GetAllThreads(&threads_returned, &threads);
+    if (ncai_err != NCAI_ERROR_NONE)
+    {
+        fprintf(stderr, "ncai->GetAllThreads() returned error: %d,\n", ncai_err);
+        test = false;
+        g_stop_thread = 1;
+        return;
+    }
+
+    ncaiThreadInfo info;
+
+    for(int h = 0; h < threads_returned; h++)
+    {
+        ncai_err = ncai_env->GetThreadInfo(threads[h], &info);
+        if (ncai_err != NCAI_ERROR_NONE)
+        {
+            fprintf(stderr, "ncai->GetThreadInfo() returned error: %d,\n", ncai_err);
+            test = false;
+            g_stop_thread = 1;
+            return;
+        }
+
+        if (strcmp(info.name, "java_thread") == 0)
+        {
+            fprintf(stderr, "TERMINATE --- thread %d - %s - %d\n", h, info.name, h);
+            ncai_err = ncai_env->TerminateThread(threads[h]);
+            if (ncai_err != NCAI_ERROR_NONE)
+            {
+                fprintf(stderr, "ncai->TerminateThread() returned error: %d,\n", ncai_err);
+                test = false;
+                g_stop_thread = 1;
+                return;
+            }
+        } else
+        {
+            fprintf(stderr, "NOT terminate --- thread %d - %s - %d\n", h, info.name, h);
+        }
+    }
+
+    ncai_err = ncai_env->GetAllThreads(&threads_returned, &threads);
+    if (ncai_err != NCAI_ERROR_NONE)
+    {
+        fprintf(stderr, "ncai->GetAllThreads() returned error: %d,\n", ncai_err);
+        test = false;
+        g_stop_thread = 1;
+        return;
+    }
+
+    for(int l = 0; l < threads_returned; l++)
+    {
+        ncai_env->GetThreadInfo(threads[l], &info);
+        fprintf(stderr, "thread %d - %s - %d\n", l, info.name, l);
+        if (strcmp(info.name, "java_thread") == 0)
+        {
+            fprintf(stderr, "ERROR: not terminated - thread %d - %s - %d\n", l, info.name, l);
+            g_stop_thread = 1;
+            test = false;
+            return;
+        }
+    }
+
+    g_stop_thread = 1;
+    SLEEP_UNIVERSAL(500);
+}
+
+void JNICALL callbackVMDeath(prms_VMDEATH)
+{
+    check_VMDEATH;
+    func_for_callback_VMDeath(jni_env, jvmti_env, test_case_name, test, util);
+}
+

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01/TerminateThread01.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01/TerminateThread01.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01/TerminateThread01.java?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01/TerminateThread01.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01/TerminateThread01.java Wed Nov 21 08:29:40 2007
@@ -0,0 +1,73 @@
+package ncai.funcs;
+
+/**
+ * @author Petr Ivanov
+ * @version $Revision: 1.1.1.1 $
+ *
+ */
+public class TerminateThread01 extends Thread{
+    public native void TestFunction();
+    public native void TestFunction1();
+    public static native boolean stopsignal();
+    public static native void resumeagent();
+
+    static boolean NoLibrary = false;
+    static {
+        try{
+            System.loadLibrary("TerminateThread01");
+        }
+        catch(Throwable e){
+            NoLibrary = true;
+        }
+    }
+
+    TerminateThread01(String name)
+    {
+        super(name);
+    }
+
+    static public void main(String args[]) {
+        if(NoLibrary) return;
+        for(int i = 0; i < 100; i++){
+            new TerminateThread01("java_thread").start();
+        }
+        special_method();
+        return;
+    }
+
+    public void test_java_func1(){
+        System.out.println("thread - java func1\n");
+        TestFunction();
+    }
+
+    public void test_java_func2(){
+        System.out.println("thread - java func2\n");
+        test_java_func3();
+    }
+
+    public void test_java_func3(){
+        resumeagent();
+        while(!stopsignal())
+        {
+            try {
+                sleep(100, 0); // milliseconds
+            } catch (java.lang.InterruptedException ie) {}
+        }
+    }
+
+    static public void special_method() {
+        /*
+         * Transfer control to native part.
+         */
+        try {
+            throw new InterruptedException();
+        } catch (Throwable tex) { }
+        return;
+    }
+
+    public void run() {
+        test_java_func3();
+    }
+}
+
+

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01/TerminateThread01.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01n/TerminateThread01n.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01n/TerminateThread01n.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01n/TerminateThread01n.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01n/TerminateThread01n.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,298 @@
+/**
+ * @author Petr Ivanov
+ * @version $Revision: 1.1.1.1 $
+ *
+ */
+
+/* *********************************************************************** */
+
+#include "events.h"
+#include "utils.h"
+#include "ncai.h"
+
+#ifdef POSIX
+#include <stdlib.h>
+#include <time.h>
+#else
+#include <windows.h>
+#include <CRTDBG.H>
+#endif
+
+#ifdef POSIX
+#define SLEEP_UNIVERSAL(_x_)  { timespec delay = {(_x_)/1000, 1000000*((_x_)%1000)}; nanosleep(&delay, NULL); }
+#else // #ifdef POSIX
+#define SLEEP_UNIVERSAL(_x_)  Sleep((_x_))
+#endif // #ifdef POSIX
+
+static int g_stop_thread = 0;
+static volatile int g_resume_agent_thread = 0;
+static jthread g_thread_jthread;
+//jthread g_agent_thread;
+
+//static int counter = 0;
+
+static bool test = false;
+static bool util = false;
+static bool flag = false;
+
+const char test_case_name[] = "TerminateThread01n";
+/*
+void Test1(JNIEnv *env, jobject obj);
+void Test2(JNIEnv *env, jobject obj);
+void Test3(JNIEnv *env, jobject obj);
+void JNICALL test_function(jvmtiEnv*, JNIEnv*, void*);*/
+static bool CheckTerminate(ncaiEnv*, ncaiThread);
+
+extern "C" JNIEXPORT void JNICALL
+Java_ncai_funcs_TerminateThread01n_resumeagent(JNIEnv *env, jclass cls)
+{
+    //warning fix
+    int w_fix = sizeof(cls);
+    w_fix += sizeof(env);
+    //
+
+    g_resume_agent_thread = 1;
+}
+
+extern "C" JNIEXPORT jboolean JNICALL
+Java_ncai_funcs_TerminateThread01n_stopsignal(JNIEnv *env, jclass cls)
+{
+    //warning fix
+    int w_fix = sizeof(cls);
+    w_fix += sizeof(env);
+    //
+
+    return g_stop_thread ? true : false;
+}
+
+extern "C" JNIEXPORT void JNICALL Java_ncai_funcs_TerminateThread01n_TestFunction1
+  (JNIEnv *env, jobject obj)
+{
+    //warning fix
+    int w_fix = sizeof(obj);
+    w_fix += sizeof(env);
+    //
+
+    fprintf(stderr, "thread - native TestFunction1\n");
+
+    g_resume_agent_thread = 1;
+    while(!g_stop_thread)
+    {
+        fprintf(stderr, "thread... \n");
+        SLEEP_UNIVERSAL(100);
+    }
+
+    //g_resume_agent_thread = 1;
+
+    return;
+}
+
+void JNICALL ThreadStart(jvmtiEnv *jvmti_env,
+            JNIEnv* jni_env,
+            jthread thread)
+{
+    jvmtiPhase phase;
+    jvmtiError result;
+    jvmtiThreadInfo tinfo;
+
+    result = jvmti_env->GetPhase(&phase);
+    if (result != JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE)
+        return;
+
+    result = jvmti_env->GetThreadInfo(thread, &tinfo);
+    if (result != JVMTI_ERROR_NONE)
+        return;
+
+    if (strcmp(tinfo.name, "java_thread") != 0)
+        return;
+
+    printf("ThreadStart: java_thread\n");
+    g_thread_jthread = jni_env->NewGlobalRef(thread);
+/*
+    jclass clazz = jni_env->FindClass("java/lang/Thread");
+    if (!clazz)
+    {
+        fprintf(stderr, "\tnative: JNI: FindClass failed\n");
+        return;
+    }
+
+    jmethodID mid = jni_env->GetMethodID(clazz, "<init>", "()V");
+    if (!mid)
+    {
+        fprintf(stderr, "\tnative: JNI: GetMethodID failed\n");
+        return;
+    }
+
+    g_agent_thread = jni_env->NewObject(clazz, mid, "native_agent_thread");
+    if (!g_agent_thread)
+    {
+        fprintf(stderr, "\tnative: JNI: NewObject failed\n");
+        return;
+    }
+
+    g_agent_thread = jni_env->NewGlobalRef(g_agent_thread);
+    result = jvmti_env->GetThreadInfo(g_agent_thread, &tinfo);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\tnative: JNI: GetThreadInfo failed\n");
+    }
+
+    result = jvmti_env->RunAgentThread(g_agent_thread, test_function, NULL, JVMTI_THREAD_NORM_PRIORITY);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\tnative: jvmti: RunAgentThread failed\n");
+        return;
+    }*/
+}
+
+/* *********************************************************************** */
+
+JNIEXPORT jint JNICALL Agent_OnLoad(prms_AGENT_ONLOAD)
+{
+
+    Callbacks CB;
+    CB.cbThreadStart = &ThreadStart;
+    check_AGENT_ONLOAD;
+    jvmtiEvent events[] = { JVMTI_EVENT_EXCEPTION, JVMTI_EVENT_THREAD_START, JVMTI_EVENT_VM_DEATH };
+    cb_exc;
+    cb_death;
+    return func_for_Agent_OnLoad(vm, options, reserved, &CB,
+        events, sizeof(events)/sizeof(jvmtiEvent), test_case_name, DEBUG_OUT);
+}
+
+/* *********************************************************************** */
+
+void JNICALL callbackException(jvmtiEnv *jvmti_env, JNIEnv* jni_env,
+                               jthread thread, jmethodID method,
+                               jlocation location, jobject exception,
+                               jmethodID catch_method, jlocation catch_location)
+{
+    check_EXCPT;
+    if (flag) return;
+
+    /*
+     * Function separate all other exceptions in all other method
+     */
+    if (!check_phase_and_method_debug(jvmti_env, method, SPP_LIVE_ONLY,
+                "special_method", DEBUG_OUT)) return;
+
+    flag = true;
+    util = true;
+
+    fprintf(stderr, "agent... \n");
+    SLEEP_UNIVERSAL(300);
+    ////////////////////ncai env get
+    jvmtiError err;
+    ncaiError ncai_err;
+
+    jvmtiExtensionFunctionInfo* ext_info = NULL;
+    jint ext_count = 0;
+
+    err = jvmti_env->GetExtensionFunctions(&ext_count, &ext_info);
+
+    if (err != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "test_function: GetExtensionFunctions() returned error: %d, '%s'\n",
+            err, get_jvmti_eror_text(err));
+        test = false;
+        return;
+    }
+
+    fprintf(stderr, "agent... \n");
+    if (ext_count == 0 || ext_info == NULL)
+    {
+        fprintf(stderr, "test_function: GetExtensionFunctions() returned no extensions\n");
+        test = false;
+        return;
+    }
+
+    jvmtiExtensionFunction get_ncai_func = NULL;
+
+    fprintf(stderr, "agent... \n");
+    for (int k = 0; k < ext_count; k++)
+    {
+        if (strcmp(ext_info[k].id, "org.apache.harmony.vm.GetExtensionEnv") == 0)
+        {
+            get_ncai_func = ext_info[k].func;
+            break;
+        }
+    }
+
+    fprintf(stderr, "agent... \n");
+    if (get_ncai_func == NULL)
+    {
+        fprintf(stderr, "test_function: GetNCAIEnvironment() nas not been found among JVMTI extensions\n");
+        test = false;
+        return;
+    }
+
+    ncaiEnv* ncai_env = NULL;
+
+    fprintf(stderr, "agent... \n");
+    err = get_ncai_func(jvmti_env, &ncai_env, NCAI_VERSION_1_0);
+
+    if (err != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "test_function: get_ncai_func() returned error: %d, '%s'\n",
+            err, get_jvmti_eror_text(err));
+        test = false;
+        return;
+    }
+
+    if (ncai_env == NULL)
+    {
+        fprintf(stderr, "test_function: get_ncai_func() returned NULL environment\n");
+        test = false;
+        return;
+    }
+    fprintf(stderr, "agent... \n");
+    ///////////////////////////////////
+    ncaiThread ncai_thread;
+
+    fprintf(stderr, "calling ncai->GetThreadHandle()...\n");
+    ncai_err = ncai_env->GetThreadHandle(g_thread_jthread, &ncai_thread);
+    if (ncai_err != NCAI_ERROR_NONE)
+    {
+        fprintf(stderr, "ncai->GetThreadHandle() returned error: %d", ncai_err);
+        test = false;
+        return;
+    }
+
+    while(!g_resume_agent_thread)
+            SLEEP_UNIVERSAL(200);
+
+    g_resume_agent_thread = 0;
+
+    test = CheckTerminate(ncai_env, ncai_thread);
+
+    g_stop_thread = 1;
+    SLEEP_UNIVERSAL(500);
+}
+
+void JNICALL callbackVMDeath(prms_VMDEATH)
+{
+    check_VMDEATH;
+    func_for_callback_VMDeath(jni_env, jvmti_env, test_case_name, test, util);
+}
+
+/* *********************************************************************** */
+
+bool CheckTerminate(ncaiEnv *ncai_env, ncaiThread ncai_thread)
+{
+    ncaiError ncai_err = ncai_env->TerminateThread(ncai_thread);
+    if (ncai_err != NCAI_ERROR_NONE)
+    {
+        fprintf(stderr, "First call of ncai->TerminateThread() returned invalid error: %d,\n", ncai_err);
+        return false;
+    }
+
+    ncai_err = ncai_env->TerminateThread(ncai_thread);
+    if (ncai_err != NCAI_ERROR_THREAD_NOT_ALIVE &&
+        ncai_err != NCAI_ERROR_INVALID_THREAD)
+    {
+        fprintf(stderr, "Second call of ncai->TerminateThread() returned invalid error: %d,\n", ncai_err);
+        return false;
+    }
+
+    return true;
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01n/TerminateThread01n.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01n/TerminateThread01n.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01n/TerminateThread01n.java?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01n/TerminateThread01n.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01n/TerminateThread01n.java Wed Nov 21 08:29:40 2007
@@ -0,0 +1,66 @@
+package ncai.funcs;
+
+/**
+ * @author Petr Ivanov
+ * @version $Revision: 1.1.1.1 $
+ *
+ */
+public class TerminateThread01n extends Thread{
+    public native void TestFunction();
+    public native void TestFunction1();
+    public static native boolean stopsignal();
+    public static native void resumeagent();
+
+    static boolean NoLibrary = false;
+    static {
+        try{
+            System.loadLibrary("TerminateThread01n");
+        }
+        catch(Throwable e){
+            NoLibrary = true;
+        }
+    }
+
+    TerminateThread01n(String name)
+    {
+        super(name);
+    }
+
+    static public void main(String args[]) {
+        if(NoLibrary) return;
+        new TerminateThread01n("java_thread").start();
+        special_method();
+        return;
+    }
+
+    public void test_java_func1(){
+        System.out.println("thread - java func1\n");
+        TestFunction1();
+    }
+
+    public void test_java_func2(){
+        System.out.println("thread - java func2\n");
+        test_java_func3();
+    }
+
+    public void test_java_func3(){
+        System.out.println("thread - java func3\n");
+    }
+
+    static public void special_method() {
+        /*
+         * Transfer control to native part.
+         */
+        try {
+            throw new InterruptedException();
+        } catch (Throwable tex) { }
+        return;
+    }
+
+    public void run() {
+        System.out.println("thread - java run\n");
+        test_java_func1();
+    }
+}
+
+

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread01n/TerminateThread01n.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02/TerminateThread02.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02/TerminateThread02.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02/TerminateThread02.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02/TerminateThread02.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,387 @@
+/**
+ * @author Petr Ivanov
+ * @version $Revision: 1.1.1.1 $
+ *
+ */
+
+/* *********************************************************************** */
+
+#include "events.h"
+#include "utils.h"
+#include "ncai.h"
+
+#ifdef POSIX
+#include <stdlib.h>
+#include <time.h>
+#else
+#include <windows.h>
+#include <CRTDBG.H>
+#endif
+
+#ifdef POSIX
+#define SLEEP_UNIVERSAL(_x_)  { timespec delay = {(_x_)/1000, 1000000*((_x_)%1000)}; nanosleep(&delay, NULL); }
+#else // #ifdef POSIX
+#define SLEEP_UNIVERSAL(_x_)  Sleep((_x_))
+#endif // #ifdef POSIX
+
+static int g_stop_thread = 0;
+static volatile int g_resume_agent_thread = 0;
+static jthread g_thread_jthread;
+//jthread g_agent_thread;
+
+static int counter = 0;
+
+static bool test = false;
+static bool util = false;
+static bool flag = false;
+
+const char test_case_name[] = "TerminateThread02";
+
+extern "C" JNIEXPORT void JNICALL
+Java_ncai_funcs_TerminateThread02_resumeagent(JNIEnv *env, jclass cls)
+{
+    //warning fix
+    int w_fix = sizeof(cls);
+    w_fix += sizeof(env);
+    //
+
+    g_resume_agent_thread++;
+}
+
+extern "C" JNIEXPORT jboolean JNICALL
+Java_ncai_funcs_TerminateThread02_stopsignal(JNIEnv *env, jclass cls)
+{
+    //warning fix
+    int w_fix = sizeof(cls);
+    w_fix += sizeof(env);
+    //
+
+    return g_stop_thread ? true : false;
+}
+
+extern "C" JNIEXPORT void JNICALL Java_ncai_funcs_TerminateThread02_TestFunction
+  (JNIEnv *env, jobject obj)
+{
+    fprintf(stderr, "thread - native TestFunction\n");
+
+    jclass clazz = env->GetObjectClass(obj);
+    if (!clazz)
+    {
+        fprintf(stderr, "\tnative: native TestFunction: GetObjectClass failed\n");
+        return;
+    }
+
+    jmethodID mid = env->GetMethodID(clazz, "test_java_func2", "()V");
+    if (!mid)
+    {
+        fprintf(stderr, "\tnative: native TestFunction: GetStaticMethodID for 'test_java_func2' failed\n");
+        return;
+    }
+    env->CallVoidMethod(obj, mid);
+    return;
+}
+
+extern "C" JNIEXPORT void JNICALL Java_ncai_funcs_TerminateThread02_TestFunction1
+  (JNIEnv *env, jobject obj)
+{
+    fprintf(stderr, "thread - native TestFunction1\n");
+
+    jclass clazz = env->GetObjectClass(obj);
+    if (!clazz)
+    {
+        fprintf(stderr, "\tnative: native TestFunction1: GetObjectClass failed\n");
+        return;
+    }
+
+    jmethodID mid = env->GetStaticMethodID(clazz, "sleep", "(J)V");
+    if (!mid)
+    {
+        fprintf(stderr, "\tnative: native TestFunction1: GetStaticMethodID for 'sleep' failed\n");
+        return;
+    }
+
+    g_resume_agent_thread = 1;
+    while(g_stop_thread)
+    {
+        fprintf(stderr, "thread... \n");
+        SLEEP_UNIVERSAL(100);
+//        env->CallStaticVoidMethod(clazz, mid, 500);
+    }
+
+    counter++;
+    return;
+}
+
+void JNICALL ThreadStart(jvmtiEnv *jvmti_env,
+            JNIEnv* jni_env,
+            jthread thread)
+{
+    jvmtiPhase phase;
+    jvmtiError result;
+    jvmtiThreadInfo tinfo;
+
+    result = jvmti_env->GetPhase(&phase);
+    if (result != JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE)
+        return;
+
+    result = jvmti_env->GetThreadInfo(thread, &tinfo);
+    if (result != JVMTI_ERROR_NONE)
+        return;
+
+    if (strcmp(tinfo.name, "java_thread") != 0)
+        return;
+
+    g_thread_jthread = jni_env->NewGlobalRef(thread);
+/*
+    jclass clazz = jni_env->FindClass("java/lang/Thread");
+    if (!clazz)
+    {
+        fprintf(stderr, "\tnative: JNI: FindClass failed\n");
+        return;
+    }
+
+    jmethodID mid = jni_env->GetMethodID(clazz, "<init>", "()V");
+    if (!mid)
+    {
+        fprintf(stderr, "\tnative: JNI: GetMethodID failed\n");
+        return;
+    }
+
+    g_agent_thread = jni_env->NewObject(clazz, mid, "native_agent_thread");
+    if (!g_agent_thread)
+    {
+        fprintf(stderr, "\tnative: JNI: NewObject failed\n");
+        return;
+    }
+
+    g_agent_thread = jni_env->NewGlobalRef(g_agent_thread);
+    result = jvmti_env->GetThreadInfo(g_agent_thread, &tinfo);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\tnative: JNI: GetThreadInfo failed\n");
+    }
+
+    result = jvmti_env->RunAgentThread(g_agent_thread, test_function, NULL, JVMTI_THREAD_NORM_PRIORITY);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\tnative: jvmti: RunAgentThread failed\n");
+        return;
+    }*/
+}
+
+/* *********************************************************************** */
+
+JNIEXPORT jint JNICALL Agent_OnLoad(prms_AGENT_ONLOAD)
+{
+
+    Callbacks CB;
+    CB.cbThreadStart = &ThreadStart;
+    check_AGENT_ONLOAD;
+    jvmtiEvent events[] = { JVMTI_EVENT_EXCEPTION, JVMTI_EVENT_THREAD_START, JVMTI_EVENT_VM_DEATH };
+    cb_exc;
+    cb_death;
+    return func_for_Agent_OnLoad(vm, options, reserved, &CB,
+        events, sizeof(events)/sizeof(jvmtiEvent), test_case_name, DEBUG_OUT);
+}
+
+/* *********************************************************************** */
+
+void JNICALL callbackException(jvmtiEnv *jvmti_env, JNIEnv* jni_env,
+                               jthread thread, jmethodID method,
+                               jlocation location, jobject exception,
+                               jmethodID catch_method, jlocation catch_location)
+{
+    check_EXCPT;
+    if (flag) return;
+
+    /*
+     * Function separate all other exceptions in all other method
+     */
+    if (!check_phase_and_method_debug(jvmti_env, method, SPP_LIVE_ONLY,
+                "special_method", DEBUG_OUT)) return;
+
+    flag = true;
+    util = true;
+
+    fprintf(stderr, "agent... \n");
+    SLEEP_UNIVERSAL(300);
+    ////////////////////ncai env get
+    jvmtiError err;
+    ncaiError ncai_err;
+
+    jvmtiExtensionFunctionInfo* ext_info = NULL;
+    jint ext_count = 0;
+
+    err = jvmti_env->GetExtensionFunctions(&ext_count, &ext_info);
+
+    if (err != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "test_function: GetExtensionFunctions() returned error: %d, '%s'\n",
+            err, get_jvmti_eror_text(err));
+        test = false;
+        return;
+    }
+
+    fprintf(stderr, "agent... \n");
+    if (ext_count == 0 || ext_info == NULL)
+    {
+        fprintf(stderr, "test_function: GetExtensionFunctions() returned no extensions\n");
+        test = false;
+        return;
+    }
+
+    jvmtiExtensionFunction get_ncai_func = NULL;
+
+    fprintf(stderr, "agent... \n");
+    for (int k = 0; k < ext_count; k++)
+    {
+        if (strcmp(ext_info[k].id, "org.apache.harmony.vm.GetExtensionEnv") == 0)
+        {
+            get_ncai_func = ext_info[k].func;
+            break;
+        }
+    }
+
+    fprintf(stderr, "agent... \n");
+    if (get_ncai_func == NULL)
+    {
+        fprintf(stderr, "test_function: GetNCAIEnvironment() nas not been found among JVMTI extensions\n");
+        test = false;
+        return;
+    }
+
+    ncaiEnv* ncai_env = NULL;
+
+    fprintf(stderr, "agent... \n");
+    err = get_ncai_func(jvmti_env, &ncai_env, NCAI_VERSION_1_0);
+
+    if (err != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "test_function: get_ncai_func() returned error: %d, '%s'\n",
+            err, get_jvmti_eror_text(err));
+        test = false;
+        return;
+    }
+
+    if (ncai_env == NULL)
+    {
+        fprintf(stderr, "test_function: get_ncai_func() returned NULL environment\n");
+        test = false;
+        return;
+    }
+    fprintf(stderr, "agent... \n");
+    ///////////////////////////////////
+    while(g_resume_agent_thread < 50)
+    {
+        fprintf(stderr, "Agent...");
+        SLEEP_UNIVERSAL(500);
+    }
+
+    g_resume_agent_thread = 0;
+
+    test = true;
+    ncaiThread ncai_thread;
+
+    fprintf(stderr, "calling ncai->GetThreadHandle()...\n");
+    ncai_err = ncai_env->GetThreadHandle(g_thread_jthread, &ncai_thread);
+    if (ncai_err != NCAI_ERROR_NONE)
+    {
+        fprintf(stderr, "ncai->GetThreadHandle() returned error: %d", ncai_err);
+        test = false;
+        g_stop_thread = 1;
+        return;
+    }
+
+    ncaiThread* threads;
+    jint threads_returned;
+
+    SLEEP_UNIVERSAL(200);
+
+    test = true;
+
+    ncai_err = ncai_env->GetAllThreads(&threads_returned, &threads);
+    if (ncai_err != NCAI_ERROR_NONE)
+    {
+        fprintf(stderr, "ncai->GetAllThreads() returned error: %d,\n", ncai_err);
+        test = false;
+        g_stop_thread = 1;
+        return;
+    }
+
+    for(int h = 0; h < threads_returned; h++)
+    {
+        ncaiThreadInfo info;
+        ncai_err = ncai_env->GetThreadInfo(threads[h], &info);
+        if (ncai_err != NCAI_ERROR_NONE)
+        {
+            fprintf(stderr, "ncai->GetThreadInfo() returned error: %d,\n", ncai_err);
+            test = false;
+            g_stop_thread = 1;
+            return;
+        }
+
+        if (strcmp(info.name, "java_thread") != 0)
+        {
+            fprintf(stderr, "NOT terminate --- thread %d - %s - %d\n", h, info.name, h);
+            continue;
+        }
+
+        fprintf(stderr, "SUSPEND --- thread %d - %s - %d\n", h, info.name, h);
+        ncai_err = ncai_env->SuspendThread(threads[h]);
+        if (ncai_err != NCAI_ERROR_NONE)
+        {
+            fprintf(stderr, "ncai->SuspendThread() returned error: %d,\n", ncai_err);
+            test = false;
+            g_stop_thread = 1;
+            return;
+        }
+
+        fprintf(stderr, "TERMINATE --- thread %d - %s - %d\n", h, info.name, h);
+        ncai_err = ncai_env->TerminateThread(threads[h]);
+        if (ncai_err == NCAI_ERROR_NONE)
+            continue;
+
+        fprintf(stderr, "ncai->TerminateThread() returned error: %d,\n", ncai_err);
+        test = false;
+        g_stop_thread = 1;
+
+        ncai_err = ncai_env->ResumeThread(threads[h]);
+        if (ncai_err != NCAI_ERROR_NONE)
+            fprintf(stderr, "ncai->ResumeThread() returned error: %d,\n", ncai_err);
+
+        return;
+    }
+
+    ncai_err = ncai_env->GetAllThreads(&threads_returned, &threads);
+    if (ncai_err != NCAI_ERROR_NONE)
+    {
+        fprintf(stderr, "ncai->GetAllThreads() returned error: %d,\n", ncai_err);
+        test = false;
+        g_stop_thread = 1;
+        return;
+    }
+
+    for(int g = 0; g < threads_returned; g++)
+    {
+        ncaiThreadInfo info;
+        ncai_env->GetThreadInfo(threads[g], &info);
+        if (strcmp(info.name, "java_thread") == 0)
+        {
+            test = false;
+            fprintf(stderr, "ERROR: not terminated - thread %d - %s - %d\n", g, info.name, g);
+            g_stop_thread = 1;
+            return;
+        }
+    }
+
+    g_stop_thread = 1;
+    SLEEP_UNIVERSAL(500);
+}
+
+void JNICALL callbackVMDeath(prms_VMDEATH)
+{
+    check_VMDEATH;
+    func_for_callback_VMDeath(jni_env, jvmti_env, test_case_name, test, util);
+}
+
+/* *********************************************************************** */

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02/TerminateThread02.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02/TerminateThread02.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02/TerminateThread02.java?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02/TerminateThread02.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02/TerminateThread02.java Wed Nov 21 08:29:40 2007
@@ -0,0 +1,73 @@
+package ncai.funcs;
+
+/**
+ * @author Petr Ivanov
+ * @version $Revision: 1.1.1.1 $
+ *
+ */
+public class TerminateThread02 extends Thread{
+    public native void TestFunction();
+    public native void TestFunction1();
+    public static native boolean stopsignal();
+    public static native void resumeagent();
+
+    static boolean NoLibrary = false;
+    static {
+        try{
+            System.loadLibrary("TerminateThread02");
+        }
+        catch(Throwable e){
+            NoLibrary = true;
+        }
+    }
+
+    TerminateThread02(String name)
+    {
+        super(name);
+    }
+
+    static public void main(String args[]) {
+        if(NoLibrary) return;
+        for(int i = 0; i < 50; i++){
+            new TerminateThread02("java_thread").start();
+        }
+        special_method();
+        return;
+    }
+
+    public void test_java_func1(){
+        System.out.println("thread - java func1\n");
+        TestFunction();
+    }
+
+    public void test_java_func2(){
+        System.out.println("thread - java func2\n");
+        test_java_func3();
+    }
+
+    public void test_java_func3(){
+        resumeagent();
+        while(!stopsignal())
+        {
+            try {
+                sleep(100, 0); // milliseconds
+            } catch (java.lang.InterruptedException ie) {}
+        }
+    }
+
+    static public void special_method() {
+        /*
+         * Transfer control to native part.
+         */
+        try {
+            throw new InterruptedException();
+        } catch (Throwable tex) { }
+        return;
+    }
+
+    public void run() {
+        test_java_func3();
+    }
+}
+
+

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02/TerminateThread02.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02n/TerminateThread02n.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02n/TerminateThread02n.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02n/TerminateThread02n.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02n/TerminateThread02n.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,288 @@
+/**
+ * @author Petr Ivanov
+ * @version $Revision: 1.1.1.1 $
+ *
+ */
+
+/* *********************************************************************** */
+
+#include "events.h"
+#include "utils.h"
+#include "ncai.h"
+
+#ifdef POSIX
+#include <stdlib.h>
+#include <time.h>
+#else
+#include <windows.h>
+#include <CRTDBG.H>
+#endif
+
+#ifdef POSIX
+#define SLEEP_UNIVERSAL(_x_)  { timespec delay = {(_x_)/1000, 1000000*((_x_)%1000)}; nanosleep(&delay, NULL); }
+#else // #ifdef POSIX
+#define SLEEP_UNIVERSAL(_x_)  Sleep((_x_))
+#endif // #ifdef POSIX
+
+static int g_stop_thread = 0;
+static volatile int g_resume_agent_thread = 0;
+static jthread g_thread_jthread;
+//jthread g_agent_thread;
+
+//static int counter = 0;
+
+static bool test = false;
+static bool util = false;
+static bool flag = false;
+
+const char test_case_name[] = "TerminateThread02n";
+
+/*void Test1(JNIEnv *env, jobject obj);
+void Test2(JNIEnv *env, jobject obj);
+void Test3(JNIEnv *env, jobject obj);
+void JNICALL test_function(jvmtiEnv*, JNIEnv*, void*);*/
+static bool CheckTerminate(ncaiEnv*, ncaiThread);
+
+extern "C" JNIEXPORT void JNICALL
+Java_ncai_funcs_TerminateThread02n_resumeagent(JNIEnv *env, jclass cls)
+{
+    //warning fix
+    int w_fix = sizeof(cls);
+    w_fix += sizeof(env);
+    //
+
+    g_resume_agent_thread = 1;
+}
+
+extern "C" JNIEXPORT jboolean JNICALL
+Java_ncai_funcs_TerminateThread02n_stopsignal(JNIEnv *env, jclass cls)
+{
+    //warning fix
+    int w_fix = sizeof(cls);
+    w_fix += sizeof(env);
+    //
+
+    return g_stop_thread ? true : false;
+}
+
+extern "C" JNIEXPORT void JNICALL Java_ncai_funcs_TerminateThread02n_TestFunction1
+  (JNIEnv *env, jobject obj)
+{
+    //warning fix
+    int w_fix = sizeof(obj);
+    w_fix += sizeof(env);
+    //
+
+    fprintf(stderr, "thread - native TestFunction1\n");
+
+    g_resume_agent_thread = 1;
+    while(!g_stop_thread)
+    {
+        fprintf(stderr, "thread... \n");
+        SLEEP_UNIVERSAL(100);
+    }
+
+    return;
+}
+
+void JNICALL ThreadStart(jvmtiEnv *jvmti_env,
+            JNIEnv* jni_env,
+            jthread thread)
+{
+    jvmtiPhase phase;
+    jvmtiError result;
+    jvmtiThreadInfo tinfo;
+
+    result = jvmti_env->GetPhase(&phase);
+    if (result != JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE)
+        return;
+
+    result = jvmti_env->GetThreadInfo(thread, &tinfo);
+    if (result != JVMTI_ERROR_NONE)
+        return;
+
+    if (strcmp(tinfo.name, "java_thread") != 0)
+        return;
+
+    printf("ThreadStart: java_thread\n");
+    g_thread_jthread = jni_env->NewGlobalRef(thread);
+/*
+    jclass clazz = jni_env->FindClass("java/lang/Thread");
+    if (!clazz)
+    {
+        fprintf(stderr, "\tnative: JNI: FindClass failed\n");
+        return;
+    }
+
+    jmethodID mid = jni_env->GetMethodID(clazz, "<init>", "()V");
+    if (!mid)
+    {
+        fprintf(stderr, "\tnative: JNI: GetMethodID failed\n");
+        return;
+    }
+
+    g_agent_thread = jni_env->NewObject(clazz, mid, "native_agent_thread");
+    if (!g_agent_thread)
+    {
+        fprintf(stderr, "\tnative: JNI: NewObject failed\n");
+        return;
+    }
+
+    g_agent_thread = jni_env->NewGlobalRef(g_agent_thread);
+    result = jvmti_env->GetThreadInfo(g_agent_thread, &tinfo);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\tnative: JNI: GetThreadInfo failed\n");
+    }
+
+    result = jvmti_env->RunAgentThread(g_agent_thread, test_function, NULL, JVMTI_THREAD_NORM_PRIORITY);
+    if (result != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "\tnative: jvmti: RunAgentThread failed\n");
+        return;
+    }*/
+}
+
+/* *********************************************************************** */
+
+JNIEXPORT jint JNICALL Agent_OnLoad(prms_AGENT_ONLOAD)
+{
+
+    Callbacks CB;
+    CB.cbThreadStart = &ThreadStart;
+    check_AGENT_ONLOAD;
+    jvmtiEvent events[] = { JVMTI_EVENT_EXCEPTION, JVMTI_EVENT_THREAD_START, JVMTI_EVENT_VM_DEATH };
+    cb_exc;
+    cb_death;
+    return func_for_Agent_OnLoad(vm, options, reserved, &CB,
+        events, sizeof(events)/sizeof(jvmtiEvent), test_case_name, DEBUG_OUT);
+}
+
+/* *********************************************************************** */
+
+void JNICALL callbackException(jvmtiEnv *jvmti_env, JNIEnv* jni_env,
+                               jthread thread, jmethodID method,
+                               jlocation location, jobject exception,
+                               jmethodID catch_method, jlocation catch_location)
+{
+    check_EXCPT;
+    if (flag) return;
+
+    /*
+     * Function separate all other exceptions in all other method
+     */
+    if (!check_phase_and_method_debug(jvmti_env, method, SPP_LIVE_ONLY,
+                "special_method", DEBUG_OUT)) return;
+
+    flag = true;
+    util = true;
+
+    fprintf(stderr, "agent... \n");
+    SLEEP_UNIVERSAL(300);
+    ////////////////////ncai env get
+    jvmtiError err;
+    ncaiError ncai_err;
+
+    jvmtiExtensionFunctionInfo* ext_info = NULL;
+    jint ext_count = 0;
+
+    err = jvmti_env->GetExtensionFunctions(&ext_count, &ext_info);
+
+    if (err != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "test_function: GetExtensionFunctions() returned error: %d, '%s'\n",
+            err, get_jvmti_eror_text(err));
+        test = false;
+        return;
+    }
+
+    fprintf(stderr, "agent... \n");
+    if (ext_count == 0 || ext_info == NULL)
+    {
+        fprintf(stderr, "test_function: GetExtensionFunctions() returned no extensions\n");
+        test = false;
+        return;
+    }
+
+    jvmtiExtensionFunction get_ncai_func = NULL;
+
+    fprintf(stderr, "agent... \n");
+    for (int k = 0; k < ext_count; k++)
+    {
+        if (strcmp(ext_info[k].id, "org.apache.harmony.vm.GetExtensionEnv") == 0)
+        {
+            get_ncai_func = ext_info[k].func;
+            break;
+        }
+    }
+
+    fprintf(stderr, "agent... \n");
+    if (get_ncai_func == NULL)
+    {
+        fprintf(stderr, "test_function: GetNCAIEnvironment() nas not been found among JVMTI extensions\n");
+        test = false;
+        return;
+    }
+
+    ncaiEnv* ncai_env = NULL;
+
+    fprintf(stderr, "agent... \n");
+    err = get_ncai_func(jvmti_env, &ncai_env, NCAI_VERSION_1_0);
+
+    if (err != JVMTI_ERROR_NONE)
+    {
+        fprintf(stderr, "test_function: get_ncai_func() returned error: %d, '%s'\n",
+            err, get_jvmti_eror_text(err));
+        test = false;
+        return;
+    }
+
+    if (ncai_env == NULL)
+    {
+        fprintf(stderr, "test_function: get_ncai_func() returned NULL environment\n");
+        test = false;
+        return;
+    }
+    fprintf(stderr, "agent... \n");
+    ///////////////////////////////////
+    ncaiThread ncai_thread;
+
+    fprintf(stderr, "calling ncai->GetThreadHandle()...\n");
+    ncai_err = ncai_env->GetThreadHandle(g_thread_jthread, &ncai_thread);
+    if (ncai_err != NCAI_ERROR_NONE)
+    {
+        fprintf(stderr, "ncai->GetThreadHandle() returned error: %d", ncai_err);
+        test = false;
+        return;
+    }
+
+    while(!g_resume_agent_thread)
+            SLEEP_UNIVERSAL(200);
+
+    g_resume_agent_thread = 0;
+
+    test = CheckTerminate(ncai_env, ncai_thread);
+
+    g_stop_thread = 1;
+    SLEEP_UNIVERSAL(500);
+}
+
+void JNICALL callbackVMDeath(prms_VMDEATH)
+{
+    check_VMDEATH;
+    func_for_callback_VMDeath(jni_env, jvmti_env, test_case_name, test, util);
+}
+
+/* *********************************************************************** */
+
+bool CheckTerminate(ncaiEnv *ncai_env, ncaiThread ncai_thread)
+{
+    ncaiError ncai_err = ncai_env->TerminateThread(NULL);
+    if (ncai_err != NCAI_ERROR_INVALID_THREAD)
+    {
+        fprintf(stderr, "ncai->TerminateThread() returned invalid error: %d,\n", ncai_err);
+        return false;
+    }
+
+    return true;
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02n/TerminateThread02n.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02n/TerminateThread02n.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02n/TerminateThread02n.java?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02n/TerminateThread02n.java (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02n/TerminateThread02n.java Wed Nov 21 08:29:40 2007
@@ -0,0 +1,66 @@
+package ncai.funcs;
+
+/**
+ * @author Petr Ivanov
+ * @version $Revision: 1.1.1.1 $
+ *
+ */
+public class TerminateThread02n extends Thread{
+    public native void TestFunction();
+    public native void TestFunction1();
+    public static native boolean stopsignal();
+    public static native void resumeagent();
+
+    static boolean NoLibrary = false;
+    static {
+        try{
+            System.loadLibrary("TerminateThread02n");
+        }
+        catch(Throwable e){
+            NoLibrary = true;
+        }
+    }
+
+    TerminateThread02n(String name)
+    {
+        super(name);
+    }
+
+    static public void main(String args[]) {
+        if(NoLibrary) return;
+        new TerminateThread02n("java_thread").start();
+        special_method();
+        return;
+    }
+
+    public void test_java_func1(){
+        System.out.println("thread - java func1\n");
+        TestFunction1();
+    }
+
+    public void test_java_func2(){
+        System.out.println("thread - java func2\n");
+        test_java_func3();
+    }
+
+    public void test_java_func3(){
+        System.out.println("thread - java func3\n");
+    }
+
+    static public void special_method() {
+        /*
+         * Transfer control to native part.
+         */
+        try {
+            throw new InterruptedException();
+        } catch (Throwable tex) { }
+        return;
+    }
+
+    public void run() {
+        System.out.println("thread - java run\n");
+        test_java_func1();
+    }
+}
+
+

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/funcs/TerminateThread/TerminateThread02n/TerminateThread02n.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/ms_envs.sh
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/ms_envs.sh?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/ms_envs.sh (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/ms_envs.sh Wed Nov 21 08:29:40 2007
@@ -0,0 +1,81 @@
+#!/bin/bash
+#
+# @author: Valentin Al. Sitnick, Petr Ivanov
+# @version: $Revision$
+#
+
+#
+# Sets the Microsoft Visual Studio .NET 2003 environment.
+#
+# According to ${MVS_DIR}\Common7\Tools\vsvars32.bat the
+# following list of variables must be set:
+#
+#     DevEnvDir
+#     FrameworkDir
+#     FrameworkSDKDir
+#     FrameworkVersion
+#     MSVCDir
+#     VSINSTALLDIR
+#     VCINSTALLDIR
+#
+#     INCLUDE
+#     LIB
+#     PATH
+#
+
+MVS_DIR_WIN="C:\Program Files\Microsoft Visual Studio .NET 2003"
+MVS_DIR_UNIX="/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003"
+
+export DevEnvDir="${MVS_DIR_WIN}\Common7\IDE"
+export FrameworkDir="C:\WINNT\Microsoft.NET\Framework"
+export FrameworkSDKDir="${MVS_DIR_WIN}\SDK\v1.1"
+export FrameworkVersion="v1.1.4322"
+export MSVCDir="${MVS_DIR_WIN}\VC7"
+export VCINSTALLDIR="${MVS_DIR_WIN}"
+export VSINSTALLDIR="${MVS_DIR_WIN}\Common7\IDE"
+
+# the vsvars32.bat does not set this variable
+#export VS71COMNTOOLS="${MVS_DIR_WIN}\Common7\Tools"
+
+#
+# Sets INCLUDE variable
+#
+if [ ! -n "${INCLUDE}" ] ; then
+    INCLUDE="${MVS_DIR_WIN}\VC7\ATLMFC\INCLUDE"
+else
+    INCLUDE="${INCLUDE};${MVS_DIR_WIN}\VC7\ATLMFC\INCLUDE"
+fi
+echo -n "Start... "
+INCLUDE="${INCLUDE};${MVS_DIR_WIN}\VC7\INCLUDE"
+INCLUDE="${INCLUDE};${MVS_DIR_WIN}\VC7\PlatformSDK\include\prerelease"
+INCLUDE="${INCLUDE};${MVS_DIR_WIN}\VC7\PlatformSDK\include"
+INCLUDE="${INCLUDE};${MVS_DIR_WIN}\SDK\v1.1\include"
+export INCLUDE
+
+#
+# Sets LIB variable
+#
+if [ ! -n "${LIB}" ] ; then
+    LIB="${MVS_DIR_WIN}\VC7\ATLMFC\LIB"
+else
+    LIB="${LIB};${MVS_DIR_WIN}\VC7\ATLMFC\LIB"
+fi
+LIB="${LIB};${MVS_DIR_WIN}\VC7\ATLMFC\LIB"
+LIB="${LIB};${MVS_DIR_WIN}\VC7\LIB"
+LIB="${LIB};${MVS_DIR_WIN}\VC7\PlatformSDK\lib\prerelease"
+LIB="${LIB};${MVS_DIR_WIN}\VC7\PlatformSDK\lib"
+LIB="${LIB};${MVS_DIR_WIN}\SDK\v1.1\lib"
+export LIB
+
+#
+# Sets PATH variable
+#
+PATH="${PATH}:${MVS_DIR_UNIX}/Common7/IDE"
+PATH="${PATH}:${MVS_DIR_UNIX}/VC7/BIN"
+PATH="${PATH}:${MVS_DIR_UNIX}/Common7/Tools"
+PATH="${PATH}:${MVS_DIR_UNIX}/Common7/Tools/bin/prerelease"
+PATH="${PATH}:${MVS_DIR_UNIX}/Common7/Tools/bin"
+PATH="${PATH}:${MVS_DIR_UNIX}/SDK/v1.1/bin"
+
+echo "done..."
+

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/ms_envs.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/parse_args.sh
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/parse_args.sh?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/parse_args.sh (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/parse_args.sh Wed Nov 21 08:29:40 2007
@@ -0,0 +1,84 @@
+#! /bin/bash
+#
+# @author: Valentin Al. Sitnick, Petr Ivanov
+# @version: $Revision$
+#
+
+# STEP 1: set the deafult values before argument parsing
+workmode="run_only"
+testmode="all"
+testname=""
+
+function die(){
+    echo $1
+    exit 1
+}
+
+# STEP 2: parse the argument
+if [ "$1" = "" ]; then
+    #start only for all JVMTI tests
+    echo "start only for all JVMTI tests"
+else
+    if [ "$1" = "-o" ]; then
+        shift;
+        case $1 in
+            "b"  ) workmode="build_only";;
+            "r"  ) workmode="run_only";;
+            "br" ) workmode="build_and_run";;
+            *    ) die "Incorrect options mode. Use <-help> for details" ;;
+        esac
+    shift;
+    fi
+
+    case $1 in
+        "-sin" ) testmode="single";
+            shift;
+            while [ "$1" != "" ];
+            do
+                testname=$testname"$1"" ";
+                shift;
+            done;;
+        "-grp" ) testmode="group";  testname="$2";;
+        "-all" ) testmode="all";    testname="$2";;
+        ""     ) testmode="all";    testname="$2";;
+        *      ) die "Incorrect start mode. Use <-help> for details" ;;
+    esac
+fi
+
+echo
+echo "What we will do?  -----------------  $workmode"
+echo "What test mode do you select ?  ---  $testmode"
+echo "What test do you select -----------  $testname"
+echo "Default compiler is ---------------  $C_COMPILER"
+echo
+
+# STEP 3: forming of test list according to testmode
+case $testmode in
+    "single" ) ;;
+    "group"  ) source ./test_list.sh;
+        for index in $(seq 1 21) ; do
+            if [ "${testname}" = "${group_name[${index}]}" ] ; then
+                testname="${group[${index}]}";
+            fi
+        done;;
+    "all"    ) source ./test_list.sh;
+        for index in $(seq 1 21) ; do
+            testname=$testname" ${group[${index}]}";
+        done ;;
+esac
+
+# STEP 4: Continue of work according to testmode
+# Next step is 5 (but if you do not want to build test(s) (run only)
+# next step is 7 )
+if [ $workmode = "run_only" ]; then
+    source ./test_run.sh
+else
+    source ./test_build.sh
+
+    if [ $workmode = "build_and_run" ]; then
+        source ./test_run.sh
+    fi
+fi
+
+# vim:ff=unix
+

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/parse_args.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/events.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/events.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/events.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/events.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,174 @@
+/**
+ * @author Valentin Al. Sitnick, Petr Ivanov
+ * @version $Revision: 1.1.1.1 $
+ *
+ */
+
+#include "utils.h"
+#include "events.h"
+
+/* *********************************************************************** */
+
+#if 1
+
+void SingleStep
+(jvmtiEnv*, JNIEnv*, jthread, jmethodID, jlocation)
+{ return; }
+
+void Breakpoint
+(jvmtiEnv*, JNIEnv*, jthread, jmethodID, jlocation)
+{ return; }
+
+void FieldAccess
+(jvmtiEnv*, JNIEnv*, jthread, jmethodID, jlocation, jclass, jobject, jfieldID)
+{ return; }
+void FieldModification
+(jvmtiEnv*, JNIEnv*, jthread, jmethodID, jlocation, jclass, jobject, jfieldID, char, jvalue)
+{ return; }
+
+void FramePop
+(jvmtiEnv*, JNIEnv*, jthread, jmethodID, jboolean)
+{ return; }
+
+void MethodEntry
+(jvmtiEnv*, JNIEnv*, jthread, jmethodID)
+{ return; }
+
+void MethodExit
+(jvmtiEnv*, JNIEnv*, jthread, jmethodID, jboolean, jvalue)
+{ return; }
+
+void NativeMethodBind
+(jvmtiEnv*, JNIEnv*, jthread, jmethodID, void*, void**)
+{ return; }
+
+void Exception
+(jvmtiEnv*, JNIEnv*, jthread, jmethodID, jlocation, jobject, jmethodID, jlocation)
+{ return; }
+
+void ExceptionCatch
+(jvmtiEnv*, JNIEnv*, jthread, jmethodID, jlocation, jobject)
+{ return; }
+/*
+void  ThreadStart
+(jvmtiEnv*, JNIEnv*, jthread)
+{ return; }
+*/
+void ThreadEnd
+(jvmtiEnv*, JNIEnv*, jthread)
+{ return; }
+
+void ClassLoad
+(jvmtiEnv*, JNIEnv*, jthread, jclass)
+{ return; }
+
+void ClassPrepare
+(jvmtiEnv*, JNIEnv*, jthread, jclass)
+{ return; }
+
+void ClassFileLoadHook
+(jvmtiEnv*, JNIEnv*, jclass, jobject, const char*, jobject, jint,
+ const unsigned char*, jint*, unsigned char**)
+{ return; }
+
+void VMStart
+(jvmtiEnv*, JNIEnv*)
+{ return; }
+
+void VMInit
+(jvmtiEnv*, JNIEnv*, jthread)
+{ return; }
+
+void VMDeath
+(jvmtiEnv*, JNIEnv*)
+{ return; }
+
+void CompiledMethodLoad
+(jvmtiEnv*, jmethodID, jint, const void*, jint,
+ const jvmtiAddrLocationMap*, const void*)
+{ return; }
+
+void CompiledMethodUnload
+(jvmtiEnv *, jmethodID, const void*)
+{ return; }
+
+void DynamicCodeGenerated
+(jvmtiEnv*, const char*, const void*, jint)
+{ return; }
+
+void DataDumpRequest
+(jvmtiEnv*)
+{ return; }
+
+void MonitorContendedEnter
+(jvmtiEnv*, JNIEnv*, jthread, jobject)
+{ return; }
+
+void MonitorContendedEntered
+(jvmtiEnv*, JNIEnv*, jthread, jobject)
+{ return; }
+
+void MonitorWait
+(jvmtiEnv*, JNIEnv*, jthread, jobject, jlong)
+{ return; }
+
+void MonitorWaited
+(jvmtiEnv*, JNIEnv*, jthread, jobject, jboolean)
+{ return; }
+
+void VMObjectAlloc
+(jvmtiEnv*, JNIEnv*, jthread, jobject, jclass, jlong)
+{ return; }
+
+void ObjectFree
+(jvmtiEnv*, jlong)
+{ return; }
+
+void GarbageCollectionStart
+(jvmtiEnv*)
+{ return; }
+
+void GarbageCollectionFinish
+(jvmtiEnv*)
+{ return; }
+
+#endif
+
+/* *********************************************************************** */
+
+Callbacks::Callbacks()
+{
+    cbSingleStep = NULL;
+    cbBreakpoint = NULL;
+    cbFieldAccess = NULL;
+    cbFieldModification = NULL;
+    cbFramePop = NULL;
+    cbMethodEntry = NULL;
+    cbMethodExit = NULL;
+    cbNativeMethodBind = NULL;
+    cbException = NULL;
+    cbExceptionCatch = NULL;
+    cbThreadStart = NULL;
+    cbThreadEnd = NULL;
+    cbClassLoad = NULL;
+    cbClassPrepare = NULL;
+    cbClassFileLoadHook = NULL;
+    cbVMStart = NULL;
+    cbVMInit = NULL;
+    cbVMDeath = NULL;
+    cbCompiledMethodLoad = NULL;
+    cbCompiledMethodUnload = NULL;
+    cbDynamicCodeGenerated = NULL;
+    cbDataDumpRequest = NULL;
+    cbMonitorContendedEnter = NULL;
+    cbMonitorContendedEntered = NULL;
+    cbMonitorWait = NULL;
+    cbMonitorWaited = NULL;
+    cbVMObjectAlloc = NULL;
+    cbObjectFree = NULL;
+    cbGarbageCollectionStart = NULL;
+    cbGarbageCollectionFinish = NULL;
+}
+
+/* *********************************************************************** */
+

Propchange: harmony/enhanced/drlvm/trunk/vm/tests/ncai/share/events.cpp
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message