8289098: clean up ported serviceability/jvmti tests

Reviewed-by: kevinw, sspitsyn
This commit is contained in:
Leonid Mesnik 2022-06-24 18:13:23 +00:00
parent 9918b6d384
commit 4cdb97893c
75 changed files with 184 additions and 654 deletions

View File

@ -57,14 +57,7 @@ import java.io.*;
*/ */
public class breakpoint01 { public class breakpoint01 {
static { static {
try {
System.loadLibrary("breakpoint01"); System.loadLibrary("breakpoint01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load \"breakpoint01\" library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native int check(); native int check();

View File

@ -55,7 +55,7 @@ static volatile jint result = PASSED;
static jvmtiEnv *jvmti = NULL; static jvmtiEnv *jvmti = NULL;
static jvmtiEventCallbacks callbacks; static jvmtiEventCallbacks callbacks;
static volatile int callbacksEnabled = NSK_TRUE; static volatile int callbacksEnabled = JNI_TRUE;
static jrawMonitorID agent_lock; static jrawMonitorID agent_lock;
static void initCounters() { static void initCounters() {
@ -196,13 +196,13 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca
void JNICALL void JNICALL
VMStart(jvmtiEnv *jvmti, JNIEnv *jni) { VMStart(jvmtiEnv *jvmti, JNIEnv *jni) {
RawMonitorLocker rml(jvmti, jni, agent_lock); RawMonitorLocker rml(jvmti, jni, agent_lock);
callbacksEnabled = NSK_TRUE; callbacksEnabled = JNI_TRUE;
} }
void JNICALL void JNICALL
VMDeath(jvmtiEnv *jvmti, JNIEnv *jni) { VMDeath(jvmtiEnv *jvmti, JNIEnv *jni) {
RawMonitorLocker rml(jvmti, jni, agent_lock); RawMonitorLocker rml(jvmti, jni, agent_lock);
callbacksEnabled = NSK_FALSE; callbacksEnabled = JNI_FALSE;
} }
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL

View File

@ -61,14 +61,7 @@ import java.io.*;
*/ */
public class classload01 { public class classload01 {
static { static {
try {
System.loadLibrary("classload01"); System.loadLibrary("classload01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load \"classload01\" library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native int check(); native int check();

View File

@ -21,9 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -49,14 +46,7 @@ import java.io.PrintStream;
public class classprep01 { public class classprep01 {
static { static {
try {
System.loadLibrary("classprep01"); System.loadLibrary("classprep01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load classprep01 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native static void getReady(); native static void getReady();

View File

@ -21,8 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -51,14 +49,7 @@ import java.io.PrintStream;
public class exception01 { public class exception01 {
static { static {
try {
System.loadLibrary("exception01"); System.loadLibrary("exception01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load exception01 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -49,14 +49,7 @@
public class excatch01 { public class excatch01 {
static { static {
try {
System.loadLibrary("excatch01"); System.loadLibrary("excatch01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load excatch01 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -46,17 +46,8 @@
public class fieldacc01 { public class fieldacc01 {
final static int JCK_STATUS_BASE = 95;
static { static {
try {
System.loadLibrary("fieldacc01"); System.loadLibrary("fieldacc01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load fieldacc01 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -21,8 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -47,17 +45,8 @@ import java.io.PrintStream;
public class fieldacc02 { public class fieldacc02 {
final static int JCK_STATUS_BASE = 95;
static { static {
try {
System.loadLibrary("fieldacc02"); System.loadLibrary("fieldacc02");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load fieldacc02 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -21,8 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -48,17 +46,8 @@ import java.io.PrintStream;
public class fieldacc03 { public class fieldacc03 {
final static int JCK_STATUS_BASE = 95;
static { static {
try {
System.loadLibrary("fieldacc03"); System.loadLibrary("fieldacc03");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load fieldacc03 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -20,7 +20,6 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
@ -46,17 +45,8 @@ import java.io.PrintStream;
public class fieldacc04 { public class fieldacc04 {
final static int JCK_STATUS_BASE = 95;
static { static {
try {
System.loadLibrary("fieldacc04"); System.loadLibrary("fieldacc04");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load fieldacc04 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -21,8 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -47,17 +45,8 @@ import java.io.PrintStream;
public class fieldmod01 { public class fieldmod01 {
final static int JCK_STATUS_BASE = 95;
static { static {
try {
System.loadLibrary("fieldmod01"); System.loadLibrary("fieldmod01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load fieldmod01 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -21,9 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -48,14 +45,7 @@ import java.io.PrintStream;
public class fieldmod02 { public class fieldmod02 {
static { static {
try {
System.loadLibrary("fieldmod02"); System.loadLibrary("fieldmod02");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load fieldmod02 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -47,14 +47,7 @@
public class framepop01 { public class framepop01 {
static { static {
try {
System.loadLibrary("framepop01"); System.loadLibrary("framepop01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load framepop01 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -57,7 +57,7 @@ static int thr_count = 0;
static int max_depth = 0; static int max_depth = 0;
static thr threads[MAX_THREADS]; static thr threads[MAX_THREADS];
static volatile int callbacksEnabled = NSK_FALSE; static volatile int callbacksEnabled = JNI_FALSE;
static jrawMonitorID agent_lock; static jrawMonitorID agent_lock;
void print_current_time() { void print_current_time() {
@ -200,13 +200,13 @@ void JNICALL MethodEntry(jvmtiEnv *jvmti, JNIEnv *jni,
void JNICALL VMStart(jvmtiEnv *jvmti, JNIEnv* jni) { void JNICALL VMStart(jvmtiEnv *jvmti, JNIEnv* jni) {
RawMonitorLocker rml(jvmti, jni, agent_lock); RawMonitorLocker rml(jvmti, jni, agent_lock);
callbacksEnabled = NSK_TRUE; callbacksEnabled = JNI_TRUE;
} }
void JNICALL VMDeath(jvmtiEnv *jvmti, JNIEnv* jni) { void JNICALL VMDeath(jvmtiEnv *jvmti, JNIEnv* jni) {
RawMonitorLocker rml(jvmti, jni, agent_lock); RawMonitorLocker rml(jvmti, jni, agent_lock);
callbacksEnabled = NSK_FALSE; callbacksEnabled = JNI_FALSE;
} }
void JNICALL FramePop(jvmtiEnv *jvmti, JNIEnv *jni, void JNICALL FramePop(jvmtiEnv *jvmti, JNIEnv *jni,

View File

@ -21,8 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -52,14 +50,7 @@ import java.io.PrintStream;
public class mentry01 { public class mentry01 {
static { static {
try {
System.loadLibrary("mentry01"); System.loadLibrary("mentry01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load mentry01 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -21,8 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -48,18 +46,10 @@ import java.io.PrintStream;
public class mentry02 { public class mentry02 {
final static int JCK_STATUS_BASE = 95;
final static int MAX_LOOP = 100; final static int MAX_LOOP = 100;
static { static {
try {
System.loadLibrary("mentry02"); System.loadLibrary("mentry02");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load mentry02 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -21,9 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -51,17 +48,8 @@ import java.io.PrintStream;
public class mexit01 { public class mexit01 {
final static int JCK_STATUS_BASE = 95;
static { static {
try {
System.loadLibrary("mexit01"); System.loadLibrary("mexit01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load mexit01 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -21,7 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -55,14 +54,7 @@ import java.io.PrintStream;
public class mexit02 { public class mexit02 {
static { static {
try {
System.loadLibrary("mexit02"); System.loadLibrary("mexit02");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load mexit02 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -76,7 +76,7 @@ static int prepare() {
if (err != JVMTI_ERROR_NONE) { if (err != JVMTI_ERROR_NONE) {
jni->FatalError("Error enabling JVMTI_EVENT_MONITOR_CONTENDED_ENTER."); jni->FatalError("Error enabling JVMTI_EVENT_MONITOR_CONTENDED_ENTER.");
} }
return NSK_TRUE; return JNI_TRUE;
} }
static int clean() { static int clean() {
@ -86,7 +86,7 @@ static int clean() {
if (err != JVMTI_ERROR_NONE) { if (err != JVMTI_ERROR_NONE) {
set_agent_fail_status(); set_agent_fail_status();
} }
return NSK_TRUE; return JNI_TRUE;
} }
/* agent algorithm /* agent algorithm
@ -109,7 +109,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *agentJNI, void *arg) {
eventsCount = 0; eventsCount = 0;
/* resume debugee to catch MonitorContendedEnter event */ /* resume debugee to catch MonitorContendedEnter event */
if (!((agent_resume_sync() == NSK_TRUE) && (agent_wait_for_sync(timeout) == NSK_TRUE))) { if (!((agent_resume_sync() == JNI_TRUE) && (agent_wait_for_sync(timeout) == JNI_TRUE))) {
return; return;
} }
LOG("Number of MonitorContendedEnter events: %d\n", eventsCount); LOG("Number of MonitorContendedEnter events: %d\n", eventsCount);

View File

@ -100,17 +100,17 @@ static int prepare() {
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL); err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL);
if (err != JVMTI_ERROR_NONE) { if (err != JVMTI_ERROR_NONE) {
LOG("Prepare: 11\n"); LOG("Prepare: 11\n");
return NSK_FALSE; return JNI_FALSE;
} }
/* enable MonitorContendedEnter event */ /* enable MonitorContendedEnter event */
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL); err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL);
if (err != JVMTI_ERROR_NONE) { if (err != JVMTI_ERROR_NONE) {
LOG("Prepare: 11\n"); LOG("Prepare: 11\n");
return NSK_FALSE; return JNI_FALSE;
} }
return NSK_TRUE; return JNI_TRUE;
} }
static int clean() { static int clean() {
@ -120,7 +120,7 @@ static int clean() {
if (err != JVMTI_ERROR_NONE) { if (err != JVMTI_ERROR_NONE) {
set_agent_fail_status(); set_agent_fail_status();
} }
return NSK_TRUE; return JNI_TRUE;
} }
/* agent algorithm /* agent algorithm
@ -142,7 +142,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *agentJNI, void *arg) {
eventsCount = 0; eventsCount = 0;
/* resume debugee to catch MonitorContendedEntered event */ /* resume debugee to catch MonitorContendedEntered event */
if (!((agent_resume_sync() == NSK_TRUE) && (agent_wait_for_sync(timeout) == NSK_TRUE))) { if (!((agent_resume_sync() == JNI_TRUE) && (agent_wait_for_sync(timeout) == JNI_TRUE))) {
return; return;
} }

View File

@ -23,8 +23,6 @@
import jdk.test.lib.jvmti.DebugeeClass; import jdk.test.lib.jvmti.DebugeeClass;
import java.io.PrintStream;
/* /*
* @test * @test
* *

View File

@ -73,9 +73,9 @@ static int prepare() {
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL); jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL);
if (err != JVMTI_ERROR_NONE) { if (err != JVMTI_ERROR_NONE) {
LOG("Prepare: 11\n"); LOG("Prepare: 11\n");
return NSK_FALSE; return JNI_FALSE;
} }
return NSK_TRUE; return JNI_TRUE;
} }
static int clean() { static int clean() {
@ -84,7 +84,7 @@ static int clean() {
if (err != JVMTI_ERROR_NONE) { if (err != JVMTI_ERROR_NONE) {
set_agent_fail_status(); set_agent_fail_status();
} }
return NSK_TRUE; return JNI_TRUE;
} }
static void JNICALL static void JNICALL
@ -104,7 +104,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *agentJNI, void *arg) {
eventsCount = 0; eventsCount = 0;
/* resume debugee to catch MonitorWait event */ /* resume debugee to catch MonitorWait event */
if (!((agent_resume_sync() == NSK_TRUE) && (agent_wait_for_sync(timeout) == NSK_TRUE))) { if (!((agent_resume_sync() == JNI_TRUE) && (agent_wait_for_sync(timeout) == JNI_TRUE))) {
return; return;
} }

View File

@ -21,8 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
import jdk.test.lib.jvmti.DebugeeClass; import jdk.test.lib.jvmti.DebugeeClass;
/* /*

View File

@ -74,9 +74,9 @@ static int prepare() {
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL); jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL);
if (err != JVMTI_ERROR_NONE) { if (err != JVMTI_ERROR_NONE) {
LOG("Prepare: 11\n"); LOG("Prepare: 11\n");
return NSK_FALSE; return JNI_FALSE;
} }
return NSK_TRUE; return JNI_TRUE;
} }
static int clean() { static int clean() {
@ -85,7 +85,7 @@ static int clean() {
if (err != JVMTI_ERROR_NONE) { if (err != JVMTI_ERROR_NONE) {
set_agent_fail_status(); set_agent_fail_status();
} }
return NSK_TRUE; return JNI_TRUE;
} }
static void JNICALL static void JNICALL
@ -105,7 +105,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *agentJNI, void *arg) {
eventsCount = 0; eventsCount = 0;
/* resume debugee to catch MonitorWaited event */ /* resume debugee to catch MonitorWaited event */
if (!((agent_resume_sync() == NSK_TRUE) && (agent_wait_for_sync(timeout) == NSK_TRUE))) { if (!((agent_resume_sync() == JNI_TRUE) && (agent_wait_for_sync(timeout) == JNI_TRUE))) {
return; return;
} }

View File

@ -23,9 +23,6 @@
import jdk.test.lib.jvmti.DebugeeClass; import jdk.test.lib.jvmti.DebugeeClass;
import java.io.PrintStream;
/* /*
* @test * @test
* *

View File

@ -52,13 +52,7 @@ import java.io.*;
public class nativemethbind01 { public class nativemethbind01 {
static { static {
try {
System.loadLibrary("nativemethbind01"); System.loadLibrary("nativemethbind01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load \"nativemethbind01\" library");
System.err.println("java.library.path:" + System.getProperty("java.library.path"));
throw ule;
}
} }
native void nativeMethod(boolean registerNative); native void nativeMethod(boolean registerNative);

View File

@ -48,14 +48,7 @@ import java.io.*;
public class nativemethbind02 { public class nativemethbind02 {
static { static {
try {
System.loadLibrary("nativemethbind02"); System.loadLibrary("nativemethbind02");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load \"nativemethbind02\" library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native int nativeMethod(); native int nativeMethod();

View File

@ -53,14 +53,7 @@ import java.io.*;
public class nativemethbind03 { public class nativemethbind03 {
static { static {
try {
System.loadLibrary("nativemethbind03"); System.loadLibrary("nativemethbind03");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load \"nativemethbind03\" library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native void registerNative(); native void registerNative();

View File

@ -52,14 +52,7 @@ import java.io.*;
public class nativemethbind04 { public class nativemethbind04 {
static { static {
try {
System.loadLibrary("nativemethbind04"); System.loadLibrary("nativemethbind04");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load \"nativemethbind04\" library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native void nativeMethod(); native void nativeMethod();

View File

@ -54,7 +54,7 @@ static jvmtiEnv *jvmti = NULL;
static volatile jboolean isVirtualExpected = JNI_FALSE; static volatile jboolean isVirtualExpected = JNI_FALSE;
static volatile int callbacksEnabled = NSK_FALSE; static volatile int callbacksEnabled = JNI_FALSE;
static jrawMonitorID agent_lock; static jrawMonitorID agent_lock;
static void setBP(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass) { static void setBP(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass) {
@ -215,13 +215,13 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca
void JNICALL void JNICALL
VMStart(jvmtiEnv *jvmti, JNIEnv *jni) { VMStart(jvmtiEnv *jvmti, JNIEnv *jni) {
RawMonitorLocker rml(jvmti, jni, agent_lock); RawMonitorLocker rml(jvmti, jni, agent_lock);
callbacksEnabled = NSK_TRUE; callbacksEnabled = JNI_TRUE;
} }
void JNICALL void JNICALL
VMDeath(jvmtiEnv *jvmti, JNIEnv *jni) { VMDeath(jvmtiEnv *jvmti, JNIEnv *jni) {
RawMonitorLocker rml(jvmti, jni, agent_lock); RawMonitorLocker rml(jvmti, jni, agent_lock);
callbacksEnabled = NSK_FALSE; callbacksEnabled = JNI_FALSE;
} }
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL

View File

@ -52,14 +52,7 @@ import java.io.*;
public class singlestep01 { public class singlestep01 {
static { static {
try {
System.loadLibrary("singlestep01"); System.loadLibrary("singlestep01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load \"singlestep01\" library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -46,14 +46,7 @@ import java.io.*;
public class singlestep02 { public class singlestep02 {
static { static {
try {
System.loadLibrary("singlestep02"); System.loadLibrary("singlestep02");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load \"singlestep02\" library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
public static void main(String[] args) { public static void main(String[] args) {

View File

@ -56,7 +56,7 @@ static volatile jint result = PASSED;
static jvmtiEnv *jvmti = NULL; static jvmtiEnv *jvmti = NULL;
static jvmtiEventCallbacks callbacks; static jvmtiEventCallbacks callbacks;
static volatile int callbacksEnabled = NSK_FALSE; static volatile int callbacksEnabled = JNI_FALSE;
static jrawMonitorID agent_lock; static jrawMonitorID agent_lock;
static void setBP(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass) { static void setBP(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass) {
@ -101,13 +101,13 @@ ClassLoad(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jclass klass) {
void JNICALL void JNICALL
VMStart(jvmtiEnv *jvmti, JNIEnv *jni) { VMStart(jvmtiEnv *jvmti, JNIEnv *jni) {
RawMonitorLocker rml(jvmti, jni, agent_lock); RawMonitorLocker rml(jvmti, jni, agent_lock);
callbacksEnabled = NSK_TRUE; callbacksEnabled = JNI_TRUE;
} }
void JNICALL void JNICALL
VMDeath(jvmtiEnv *jvmti, JNIEnv *jni) { VMDeath(jvmtiEnv *jvmti, JNIEnv *jni) {
RawMonitorLocker rml(jvmti, jni, agent_lock); RawMonitorLocker rml(jvmti, jni, agent_lock);
callbacksEnabled = NSK_FALSE; callbacksEnabled = JNI_FALSE;
} }
void JNICALL void JNICALL

View File

@ -52,14 +52,7 @@ import java.io.*;
public class singlestep03 { public class singlestep03 {
static { static {
try {
System.loadLibrary("singlestep03"); System.loadLibrary("singlestep03");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load \"singlestep03\" library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile int result; static volatile int result;

View File

@ -21,8 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -47,14 +45,7 @@ public class threadend01 {
final static String NAME_PREFIX = "threadend01-"; final static String NAME_PREFIX = "threadend01-";
static { static {
try {
System.loadLibrary("threadend01"); System.loadLibrary("threadend01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load threadend01 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native static void getReady(int i, String name); native static void getReady(int i, String name);
@ -63,13 +54,6 @@ public class threadend01 {
static volatile int thrCount = THREADS_LIMIT; static volatile int thrCount = THREADS_LIMIT;
public static void main(String args[]) { public static void main(String args[]) {
int result = run(args, System.out);
if (result != 0) {
throw new RuntimeException("Unexpected status: " + result);
}
}
public static int run(String args[], PrintStream out) {
Thread t = new TestThread(NAME_PREFIX + thrCount); Thread t = new TestThread(NAME_PREFIX + thrCount);
getReady(THREADS_LIMIT, NAME_PREFIX); getReady(THREADS_LIMIT, NAME_PREFIX);
t.start(); t.start();
@ -78,7 +62,10 @@ public class threadend01 {
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new Error("Unexpected: " + e); throw new Error("Unexpected: " + e);
} }
return check(); int result = check();
if (result != 0) {
throw new RuntimeException("Unexpected status: " + result);
}
} }
static class TestThread extends Thread { static class TestThread extends Thread {

View File

@ -55,23 +55,23 @@ enableEvent(jvmtiEventMode enable, jvmtiEvent event) {
err = jvmti->SetEventNotificationMode(enable, event, NULL); err = jvmti->SetEventNotificationMode(enable, event, NULL);
if (err != JVMTI_ERROR_NONE) { if (err != JVMTI_ERROR_NONE) {
set_agent_fail_status(); set_agent_fail_status();
return NSK_FALSE; return JNI_FALSE;
} }
return NSK_TRUE; return JNI_TRUE;
} }
/* ============================================================================= */ /* ============================================================================= */
int checkEvents() { int checkEvents() {
int result = NSK_TRUE; int result = JNI_TRUE;
if (eventCount == 0) { if (eventCount == 0) {
set_agent_fail_status(); set_agent_fail_status();
COMPLAIN("Number of THREAD_END events must be greater than 0\n"); COMPLAIN("Number of THREAD_END events must be greater than 0\n");
set_agent_fail_status(); set_agent_fail_status();
result = NSK_FALSE; result = JNI_FALSE;
} }
return result; return result;
@ -89,10 +89,10 @@ setCallBacks() {
err = jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)); err = jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks));
if (err != JVMTI_ERROR_NONE) { if (err != JVMTI_ERROR_NONE) {
return NSK_FALSE; return JNI_FALSE;
} }
return NSK_TRUE; return JNI_TRUE;
} }
/* ============================================================================= */ /* ============================================================================= */

View File

@ -22,7 +22,6 @@
*/ */
import jdk.test.lib.jvmti.DebugeeClass; import jdk.test.lib.jvmti.DebugeeClass;
import java.io.PrintStream;
/* /*
* @test * @test
@ -44,18 +43,14 @@ public class threadend02 extends DebugeeClass {
// run test from command line // run test from command line
public static void main(String argv[]) { public static void main(String argv[]) {
int result = run(argv, System.out); int result = new threadend02().runIt();
if (result != 0) { if (result != 0) {
throw new RuntimeException("Unexpected status: " + result); throw new RuntimeException("Unexpected status: " + result);
} }
} }
public static int run(String argv[], PrintStream out) {
return new threadend02().runIt(argv, out);
}
// run debuggee // run debuggee
public int runIt(String argv[], PrintStream out) { public int runIt() {
int status = threadend02.checkStatus(DebugeeClass.TEST_PASSED); int status = threadend02.checkStatus(DebugeeClass.TEST_PASSED);

View File

@ -21,8 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -47,14 +45,7 @@ public class threadstart01 {
final static String NAME_PREFIX = "threadstart01-"; final static String NAME_PREFIX = "threadstart01-";
static { static {
try {
System.loadLibrary("threadstart01"); System.loadLibrary("threadstart01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load threadstart01 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native static void getReady(int i, String name); native static void getReady(int i, String name);
@ -63,13 +54,6 @@ public class threadstart01 {
static volatile int thrCount = 0; static volatile int thrCount = 0;
public static void main(String args[]) { public static void main(String args[]) {
int result = run(args, System.out);
if (result != 0) {
throw new RuntimeException("Unexpected status: " + result);
}
}
public static int run(String args[], PrintStream out) {
TestThread t = new TestThread(NAME_PREFIX + thrCount); TestThread t = new TestThread(NAME_PREFIX + thrCount);
getReady(THREADS_LIMIT, NAME_PREFIX); getReady(THREADS_LIMIT, NAME_PREFIX);
t.start(); t.start();
@ -78,7 +62,10 @@ public class threadstart01 {
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new Error("Unexpected: " + e); throw new Error("Unexpected: " + e);
} }
return check(); int result = check();
if (result != 0) {
throw new RuntimeException("Unexpected status: " + result);
}
} }
static class TestThread extends Thread { static class TestThread extends Thread {

View File

@ -21,8 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -60,44 +58,20 @@ import java.io.PrintStream;
* Fixed according to 6221885 test bug. * Fixed according to 6221885 test bug.
* *
* @library /test/lib * @library /test/lib
* @run main/othervm/native -agentlib:threadstart02 threadstart02 5 * @run main/othervm/native -agentlib:threadstart02 threadstart02
*/ */
public class threadstart02 { public class threadstart02 {
static { static {
try {
System.loadLibrary("threadstart02"); System.loadLibrary("threadstart02");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load threadstart02 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native static int check(); native static int check();
public static int waitTime = 2; public static int waitTime = 5;
public static void main(String args[]) { public static void main(String args[]) {
int result = run(args, System.out);
if (result != 0) {
throw new RuntimeException("Unexpected status: " + result);
}
}
public static int run(String args[], PrintStream out) {
if (args.length > 0) {
try {
int i = Integer.parseInt(args[0]);
waitTime = i;
} catch (NumberFormatException ex) {
out.println("# Wrong argument \"" + args[0] + "\", the default value is used");
}
}
out.println("# Waiting time = " + waitTime + " mins");
TestThread t = new TestThread("TestThread_1"); TestThread t = new TestThread("TestThread_1");
t.start(); t.start();
@ -107,7 +81,10 @@ public class threadstart02 {
throw new Error("Unexpected: " + e); throw new Error("Unexpected: " + e);
} }
return check(); int result = check();
if (result != 0) {
throw new RuntimeException("Unexpected status: " + result);
}
} }
static class TestThread extends Thread { static class TestThread extends Thread {

View File

@ -21,8 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
/* /*
* @test * @test
* *
@ -46,30 +44,19 @@ import java.io.PrintStream;
public class threadstart03 { public class threadstart03 {
final static int JCK_STATUS_BASE = 95;
final static String ThreadName = "testedThread"; final static String ThreadName = "testedThread";
static { static {
try {
System.loadLibrary("threadstart03"); System.loadLibrary("threadstart03");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load threadstart03 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native static int check(Thread thr, String name); native static int check(Thread thr, String name);
public static void main(String args[]) { public static void main(String args[]) {
int result = run(args, System.out); int result = check(new Thread(ThreadName), ThreadName);
if (result != 0) { if (result != 0) {
throw new RuntimeException("Unexpected status: " + result); throw new RuntimeException("Unexpected status: " + result);
} }
} }
public static int run(String args[], PrintStream out) {
return check(new Thread(ThreadName), ThreadName);
}
} }

View File

@ -45,7 +45,7 @@ static int checkVMObjectAllocEvents() {
LOG("# (VM might not allocate such objects at all)\n"); LOG("# (VM might not allocate such objects at all)\n");
} }
return NSK_TRUE; return JNI_TRUE;
} }
/* ========================================================================== */ /* ========================================================================== */

View File

@ -21,8 +21,6 @@
* questions. * questions.
*/ */
import java.io.PrintStream;
import jdk.test.lib.jvmti.DebugeeClass; import jdk.test.lib.jvmti.DebugeeClass;
/* /*

View File

@ -42,14 +42,7 @@
public class GetAllThreadsNullTest { public class GetAllThreadsNullTest {
static { static {
try {
System.loadLibrary("GetAllThreadsNullTest"); System.loadLibrary("GetAllThreadsNullTest");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load GetAllThreadsNullTest library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native static boolean check(); native static boolean check();

View File

@ -42,41 +42,27 @@
* @run main/othervm/native -agentlib:framecnt02 framecnt02 * @run main/othervm/native -agentlib:framecnt02 framecnt02
*/ */
import java.io.PrintStream;
public class framecnt02 { public class framecnt02 {
native static void checkFrames(Thread thr, int thr_num); native static void checkFrames(Thread thr, int thr_num);
native static int getRes(); native static int getRes();
static { static {
try {
System.loadLibrary("framecnt02"); System.loadLibrary("framecnt02");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load framecnt02 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
} }
}
final static int JCK_STATUS_BASE = 95;
static int flag = 0; static int flag = 0;
public static void main(String args[]) { public static void main(String args[]) {
// produce JCK-like exit status.
System.exit(run(args, System.out) + JCK_STATUS_BASE);
}
public static int run(String argv[], PrintStream ref) {
Thread currThread = Thread.currentThread(); Thread currThread = Thread.currentThread();
framecnt02a tested_thread_thr1 = new framecnt02a(); framecnt02a tested_thread_thr1 = new framecnt02a();
checkFrames(tested_thread_thr1, 1); checkFrames(tested_thread_thr1, 1);
checkFrames(currThread, 0); checkFrames(currThread, 0);
return getRes(); int result = getRes();
if (result != 0) {
throw new RuntimeException("check failed with result " + result);
}
} }
} }

View File

@ -38,33 +38,18 @@
* @run main/othervm/native -agentlib:framecnt03 framecnt03 * @run main/othervm/native -agentlib:framecnt03 framecnt03
*/ */
import java.io.PrintStream;
public class framecnt03 { public class framecnt03 {
final static int JCK_STATUS_BASE = 95;
static { static {
try {
System.loadLibrary("framecnt03"); System.loadLibrary("framecnt03");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load framecnt03 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native static int check(); native static int check();
public static void main(String args[]) { public static void main(String args[]) {
int result = check();
if (result != 0) {
// produce JCK-like exit status. throw new RuntimeException("check failed with result " + result);
System.exit(run(args, System.out) + JCK_STATUS_BASE);
} }
public static int run(String args[], PrintStream out) {
return check();
} }
} }

View File

@ -41,36 +41,18 @@
* @run main/othervm/native -agentlib:frameloc03 frameloc03 * @run main/othervm/native -agentlib:frameloc03 frameloc03
*/ */
import java.io.PrintStream;
public class frameloc03 { public class frameloc03 {
final static int JCK_STATUS_BASE = 95;
static { static {
try {
System.loadLibrary("frameloc03"); System.loadLibrary("frameloc03");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load frameloc03 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
}
native static int check(Thread thread);
public static void main(String args[]) {
// produce JCK-like exit status.
System.exit(run(args, System.out) + JCK_STATUS_BASE);
} }
public static Object lockStart = new Object(); public static Object lockStart = new Object();
public static Object lockFinish = new Object(); public static Object lockFinish = new Object();
public static int run(String args[], PrintStream out) { native static int check(Thread thread);
public static void main(String args[]) {
TestThread t = new TestThread(); TestThread t = new TestThread();
synchronized (lockStart) { synchronized (lockStart) {
@ -83,7 +65,7 @@ public class frameloc03 {
} }
int res = check(t); int result = check(t);
synchronized (lockFinish) { synchronized (lockFinish) {
lockFinish.notify(); lockFinish.notify();
@ -94,7 +76,9 @@ public class frameloc03 {
throw new Error("Unexpected: " + e); throw new Error("Unexpected: " + e);
} }
return res; if (result != 0) {
throw new RuntimeException("check failed with result " + result);
}
} }
static class TestThread extends Thread { static class TestThread extends Thread {

View File

@ -41,33 +41,19 @@
* @library /test/lib * @library /test/lib
* @run main/othervm/native -agentlib:getstacktr02 getstacktr02 * @run main/othervm/native -agentlib:getstacktr02 getstacktr02
*/ */
import java.io.PrintStream;
public class getstacktr02 { public class getstacktr02 {
final static int JCK_STATUS_BASE = 95;
static { static {
try {
System.loadLibrary("getstacktr02"); System.loadLibrary("getstacktr02");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load getstacktr02 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native static int check(Thread thread); native static int check(Thread thread);
public static void main(String args[]) { public static void main(String args[]) {
int result = check(Thread.currentThread());
if (result != 0) {
// produce JCK-like exit status. throw new RuntimeException("check failed with result " + result);
System.exit(run(args, System.out) + JCK_STATUS_BASE);
} }
public static int run(String args[], PrintStream out) {
return check(Thread.currentThread());
} }
} }

View File

@ -40,35 +40,17 @@
* @run main/othervm/native -agentlib:getstacktr09 getstacktr09 * @run main/othervm/native -agentlib:getstacktr09 getstacktr09
*/ */
import java.io.PrintStream;
public class getstacktr09 { public class getstacktr09 {
final static int JCK_STATUS_BASE = 95;
final static int FAILED = 2; final static int FAILED = 2;
static { static {
try {
System.loadLibrary("getstacktr09"); System.loadLibrary("getstacktr09");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load getstacktr09 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native static int check(Thread thread1, Thread thread2); native static int check(Thread thread1, Thread thread2);
public static void main(String args[]) { public static void main(String args[]) {
// produce JCK-like exit status.
System.exit(run(args, System.out) + JCK_STATUS_BASE);
}
public static int run(String args[], PrintStream out) {
TestThread tested_thread_thr1 = new TestThread(); TestThread tested_thread_thr1 = new TestThread();
TestThread thr2 = new TestThread(); TestThread thr2 = new TestThread();
@ -76,11 +58,13 @@ public class getstacktr09 {
try { try {
thr2.join(); thr2.join();
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
out.println("# Unexpected " + ex); throw new RuntimeException(ex);
return FAILED;
} }
return check(tested_thread_thr1, thr2); int result = check(tested_thread_thr1, thr2);
if (result != 0) {
throw new RuntimeException("check failed with result " + result);
}
} }
static class TestThread extends Thread { static class TestThread extends Thread {

View File

@ -39,32 +39,19 @@
* @run main/othervm/native -agentlib:thrinfo02 thrinfo02 * @run main/othervm/native -agentlib:thrinfo02 thrinfo02
*/ */
import java.io.PrintStream;
public class thrinfo02 { public class thrinfo02 {
final static int JCK_STATUS_BASE = 95;
static { static {
try {
System.loadLibrary("thrinfo02"); System.loadLibrary("thrinfo02");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load thrinfo02 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native static int check(Thread thr, ThreadGroup group); native static int check(Thread thr, ThreadGroup group);
public static void main(String args[]) { public static void main(String args[]) {
Thread.currentThread().setName("main"); Thread.currentThread().setName("main");
// produce JCK-like exit status. int result = check(Thread.currentThread(), Thread.currentThread().getThreadGroup());
System.exit(run(args, System.out) + JCK_STATUS_BASE); if (result != 0) {
throw new RuntimeException("check failed with result " + result);
} }
public static int run(String args[], PrintStream out) {
return check(Thread.currentThread(), Thread.currentThread().getThreadGroup());
} }
} }

View File

@ -42,23 +42,14 @@
* @run main/othervm/native -agentlib:thrstat04 thrstat04 * @run main/othervm/native -agentlib:thrstat04 thrstat04
*/ */
import java.io.PrintStream;
public class thrstat04 { public class thrstat04 {
final static int JCK_STATUS_BASE = 95;
native static int check(Thread thr); native static int check(Thread thr);
public static void main(String args[]) { public static void main(String args[]) {
int result = check(Thread.currentThread());
if (result != 0) {
// produce JCK-like exit status. throw new RuntimeException("check failed with result " + result);
System.exit(run(args, System.out) + JCK_STATUS_BASE);
} }
public static int run(String args[], PrintStream out) {
return check(Thread.currentThread());
} }
} }

View File

@ -132,7 +132,7 @@ extern JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *res
return JNI_ERR; return JNI_ERR;
} }
if (set_agent_proc(agentProc, NULL) != NSK_TRUE) { if (set_agent_proc(agentProc, NULL) != JNI_TRUE) {
return JNI_ERR; return JNI_ERR;
} }

View File

@ -256,7 +256,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR; return JNI_ERR;
} }
if (set_agent_proc(agentProc, NULL) != NSK_TRUE) { if (set_agent_proc(agentProc, NULL) != JNI_TRUE) {
return JNI_ERR; return JNI_ERR;
} }

View File

@ -262,7 +262,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR; return JNI_ERR;
} }
if (set_agent_proc(agentProc, NULL) != NSK_TRUE) { if (set_agent_proc(agentProc, NULL) != JNI_TRUE) {
return JNI_ERR; return JNI_ERR;
} }
return JNI_OK; return JNI_OK;

View File

@ -47,14 +47,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class allthr01 { public class allthr01 {
static { static {
try {
System.loadLibrary("allthr01"); System.loadLibrary("allthr01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load allthr001 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
// Sync with native code // Sync with native code

View File

@ -52,14 +52,7 @@ public class framecnt01 {
} }
static { static {
try {
System.loadLibrary("framecnt01"); System.loadLibrary("framecnt01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load framecnt01 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
static volatile boolean vThread1Started = false; static volatile boolean vThread1Started = false;
static volatile boolean pThread1Started = false; static volatile boolean pThread1Started = false;

View File

@ -47,21 +47,10 @@
* @run main/othervm/native -agentlib:frameloc01 frameloc01 * @run main/othervm/native -agentlib:frameloc01 frameloc01
*/ */
import java.io.PrintStream;
public class frameloc01 { public class frameloc01 {
final static int JCK_STATUS_BASE = 95;
static { static {
try {
System.loadLibrary("frameloc01"); System.loadLibrary("frameloc01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load frameloc01 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native static void getReady(Class cls); native static void getReady(Class cls);
@ -73,13 +62,6 @@ public class frameloc01 {
static Object lock2 = new Object(); static Object lock2 = new Object();
public static void main(String args[]) { public static void main(String args[]) {
// produce JCK-like exit status.
System.exit(run(args, System.out) + JCK_STATUS_BASE);
}
public static int run(String argv[], PrintStream ref) {
frameloc01a thr = new frameloc01a(); frameloc01a thr = new frameloc01a();
getReady(frameloc01a.class); getReady(frameloc01a.class);
@ -98,7 +80,10 @@ public class frameloc01 {
checkFrame01(thr, frameloc01a.class, true); checkFrame01(thr, frameloc01a.class, true);
} }
return getRes(); int result = getRes();
if (result != 0) {
throw new RuntimeException("check failed with result " + result);
}
} }
private static void waitForChildThread(frameloc01a thr) { private static void waitForChildThread(frameloc01a thr) {

View File

@ -40,31 +40,18 @@
* @run main/othervm/native -agentlib:frameloc02 frameloc02 * @run main/othervm/native -agentlib:frameloc02 frameloc02
*/ */
import java.io.PrintStream;
public class frameloc02 { public class frameloc02 {
final static int JCK_STATUS_BASE = 95;
static { static {
try {
System.loadLibrary("frameloc02"); System.loadLibrary("frameloc02");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load frameloc02 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native static int check(Thread thr); native static int check(Thread thr);
public static void main(String args[]) { public static void main(String args[]) {
// produce JCK-like exit status. int result = check(Thread.currentThread());
System.exit(run(args, System.out) + JCK_STATUS_BASE); if (result != 0) {
throw new RuntimeException("check failed with result " + result);
} }
public static int run(String args[], PrintStream out) {
return check(Thread.currentThread());
} }
} }

View File

@ -43,8 +43,6 @@
* @run main/othervm/native --enable-preview -agentlib:getstacktr06 getstacktr06 * @run main/othervm/native --enable-preview -agentlib:getstacktr06 getstacktr06
*/ */
import java.io.PrintStream;
public class getstacktr06 { public class getstacktr06 {
static { static {

View File

@ -51,14 +51,7 @@
public class thrinfo01 { public class thrinfo01 {
static { static {
try {
System.loadLibrary("thrinfo01"); System.loadLibrary("thrinfo01");
} catch (UnsatisfiedLinkError ule) {
System.err.println("Could not load thrinfo01 library");
System.err.println("java.library.path:"
+ System.getProperty("java.library.path"));
throw ule;
}
} }
native static boolean checkInfo0(Thread thread, ThreadGroup threadGroup, int ind); native static boolean checkInfo0(Thread thread, ThreadGroup threadGroup, int ind);

View File

@ -59,7 +59,6 @@
* @run main/othervm/native -agentlib:thrstat02 thrstat02 5 * @run main/othervm/native -agentlib:thrstat02 thrstat02 5
*/ */
import java.io.PrintStream;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
public class thrstat02 { public class thrstat02 {

View File

@ -43,8 +43,6 @@
* @run main/othervm/native --enable-preview -agentlib:thrstat03 thrstat03 5 * @run main/othervm/native --enable-preview -agentlib:thrstat03 thrstat03 5
*/ */
import java.io.PrintStream;
public class thrstat03 { public class thrstat03 {
static final int NOT_STARTED = 0; static final int NOT_STARTED = 0;

View File

@ -39,8 +39,6 @@
import jdk.test.lib.jvmti.DebugeeClass; import jdk.test.lib.jvmti.DebugeeClass;
import java.io.PrintStream;
public class resumethrd02 extends DebugeeClass { public class resumethrd02 extends DebugeeClass {
// load native library if required // load native library if required

View File

@ -176,7 +176,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
"# expected: %d\n", "# expected: %d\n",
name, found, foundCount); name, found, foundCount);
set_agent_fail_status(); set_agent_fail_status();
return NSK_FALSE; return JNI_FALSE;
} }
LOG("Make global references for threads: %d threads\n", foundCount); LOG("Make global references for threads: %d threads\n", foundCount);
@ -184,12 +184,12 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]); foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]);
if ( foundThreads[i] == NULL) { if ( foundThreads[i] == NULL) {
set_agent_fail_status(); set_agent_fail_status();
return NSK_FALSE; return JNI_FALSE;
} }
LOG(" ... thread #%d: %p\n", i, foundThreads[i]); LOG(" ... thread #%d: %p\n", i, foundThreads[i]);
} }
return NSK_TRUE; return JNI_TRUE;
} }
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL

View File

@ -41,8 +41,6 @@
import jdk.test.lib.jvmti.DebugeeClass; import jdk.test.lib.jvmti.DebugeeClass;
import java.io.PrintStream;
public class resumethrdlst01 extends DebugeeClass { public class resumethrdlst01 extends DebugeeClass {
// load native library if required // load native library if required
@ -52,12 +50,10 @@ public class resumethrdlst01 extends DebugeeClass {
// run test from command line // run test from command line
public static void main(String argv[]) { public static void main(String argv[]) {
System.exit(run(argv, System.out) + 95); int result = new resumethrdlst01().runIt();
if (result != 0) {
throw new RuntimeException("check failed with result " + result);
} }
// run test from JCK-compatible environment
public static int run(String argv[], PrintStream out) {
return new resumethrdlst01().runIt(argv, out);
} }
/* =================================================================== */ /* =================================================================== */
@ -72,7 +68,7 @@ public class resumethrdlst01 extends DebugeeClass {
resumethrdlst01Thread threads[] = null; resumethrdlst01Thread threads[] = null;
// run debuggee // run debuggee
public int runIt(String argv[], PrintStream out) { public int runIt() {
timeout = 60 * 1000; timeout = 60 * 1000;
// create tested threads // create tested threads

View File

@ -197,7 +197,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
"# expected: %d\n", "# expected: %d\n",
name, found, foundCount); name, found, foundCount);
set_agent_fail_status(); set_agent_fail_status();
return NSK_FALSE; return JNI_FALSE;
} }
LOG("Make global references for threads: %d threads\n", foundCount); LOG("Make global references for threads: %d threads\n", foundCount);
@ -205,12 +205,12 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]); foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]);
if ( foundThreads[i] == NULL) { if ( foundThreads[i] == NULL) {
set_agent_fail_status(); set_agent_fail_status();
return NSK_FALSE; return JNI_FALSE;
} }
LOG(" ... thread #%d: %p\n", i, foundThreads[i]); LOG(" ... thread #%d: %p\n", i, foundThreads[i]);
} }
return NSK_TRUE; return JNI_TRUE;
} }
/** THREAD_END callback. */ /** THREAD_END callback. */

View File

@ -39,8 +39,6 @@
import jdk.test.lib.jvmti.DebugeeClass; import jdk.test.lib.jvmti.DebugeeClass;
import java.io.PrintStream;
public class resumethrdlst02 extends DebugeeClass { public class resumethrdlst02 extends DebugeeClass {
// load native library if required // load native library if required
@ -48,14 +46,11 @@ public class resumethrdlst02 extends DebugeeClass {
System.loadLibrary("resumethrdlst02"); System.loadLibrary("resumethrdlst02");
} }
// run test from command line
public static void main(String argv[]) { public static void main(String argv[]) {
System.exit(run(argv, System.out) + 95); int result = new resumethrdlst02().runIt();
if (result != 0) {
throw new RuntimeException("check failed with result " + result);
} }
// run test from JCK-compatible environment
public static int run(String argv[], PrintStream out) {
return new resumethrdlst02().runIt(argv, out);
} }
/* =================================================================== */ /* =================================================================== */
@ -71,7 +66,7 @@ public class resumethrdlst02 extends DebugeeClass {
int threads_count = 0; int threads_count = 0;
// run debuggee // run debuggee
public int runIt(String argv[], PrintStream out) { public int runIt() {
timeout = 60 * 1000; // milliseconds timeout = 60 * 1000; // milliseconds
// create tested threads // create tested threads

View File

@ -41,8 +41,6 @@
import jdk.test.lib.jvmti.DebugeeClass; import jdk.test.lib.jvmti.DebugeeClass;
import java.io.PrintStream;
public class suspendthrd01 extends DebugeeClass { public class suspendthrd01 extends DebugeeClass {
// load native library if required // load native library if required

View File

@ -39,8 +39,6 @@
import jdk.test.lib.jvmti.DebugeeClass; import jdk.test.lib.jvmti.DebugeeClass;
import java.io.PrintStream;
public class suspendthrd02 extends DebugeeClass { public class suspendthrd02 extends DebugeeClass {
// load native library if required // load native library if required
@ -48,15 +46,11 @@ public class suspendthrd02 extends DebugeeClass {
System.loadLibrary("suspendthrd02"); System.loadLibrary("suspendthrd02");
} }
// run test from command line
public static void main(String argv[]) { public static void main(String argv[]) {
// JCK-compatible exit int result = new suspendthrd02().runIt();
System.exit(run(argv, System.out) + 95); if (result != 0) {
throw new RuntimeException("check failed with result " + result);
} }
// run test from JCK-compatible environment
public static int run(String argv[], PrintStream out) {
return new suspendthrd02().runIt(argv, out);
} }
/* =================================================================== */ /* =================================================================== */
@ -68,7 +62,7 @@ public class suspendthrd02 extends DebugeeClass {
suspendthrd02Thread thread = null; suspendthrd02Thread thread = null;
// run debuggee // run debuggee
public int runIt(String argv[], PrintStream out) { public int runIt() {
timeout = 60 * 1000; // milliseconds timeout = 60 * 1000; // milliseconds
// create tested thread // create tested thread

View File

@ -176,8 +176,6 @@
import jdk.test.lib.jvmti.DebugeeClass; import jdk.test.lib.jvmti.DebugeeClass;
import java.io.PrintStream;
public class suspendthrd03 extends DebugeeClass { public class suspendthrd03 extends DebugeeClass {
final static int N_THREADS = 10; final static int N_THREADS = 10;
@ -187,14 +185,11 @@ public class suspendthrd03 extends DebugeeClass {
System.loadLibrary("suspendthrd03"); System.loadLibrary("suspendthrd03");
} }
// run test from command line
public static void main(String argv[]) { public static void main(String argv[]) {
System.exit(run(argv, System.out) + 95); int result = new suspendthrd03().runIt();
if (result != 0) {
throw new RuntimeException("check failed with result " + result);
} }
// run test from JCK-compatible environment
public static int run(String argv[], PrintStream out) {
return new suspendthrd03().runIt(argv, out);
} }
/* =================================================================== */ /* =================================================================== */
@ -205,7 +200,7 @@ public class suspendthrd03 extends DebugeeClass {
suspendthrd03Thread thread = null; suspendthrd03Thread thread = null;
// run debuggee // run debuggee
public int runIt(String argv[], PrintStream out) { public int runIt() {
timeout = 60 * 1000; // milliseconds timeout = 60 * 1000; // milliseconds
for (int i = 0; i < N_THREADS; i++) { for (int i = 0; i < N_THREADS; i++) {

View File

@ -176,7 +176,7 @@ static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name,
"# expected: %d", "# expected: %d",
name, found, found_count); name, found, found_count);
set_agent_fail_status(); set_agent_fail_status();
return NSK_FALSE; return JNI_FALSE;
} }
LOG("Make global references for threads: %d threads\n", found_count); LOG("Make global references for threads: %d threads\n", found_count);
@ -184,12 +184,12 @@ static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name,
found_threads[i] = (jthread) jni->NewGlobalRef(found_threads[i]); found_threads[i] = (jthread) jni->NewGlobalRef(found_threads[i]);
if (found_threads[i] == NULL) { if (found_threads[i] == NULL) {
set_agent_fail_status(); set_agent_fail_status();
return NSK_FALSE; return JNI_FALSE;
} }
LOG(" ... thread #%d: %p\n", i, found_threads[i]); LOG(" ... thread #%d: %p\n", i, found_threads[i]);
} }
return NSK_TRUE; return JNI_TRUE;
} }
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL

View File

@ -40,7 +40,7 @@
*/ */
import jdk.test.lib.jvmti.DebugeeClass; import jdk.test.lib.jvmti.DebugeeClass;
import java.io.PrintStream;
public class suspendthrdlst01 extends DebugeeClass { public class suspendthrdlst01 extends DebugeeClass {
@ -49,15 +49,11 @@ public class suspendthrdlst01 extends DebugeeClass {
System.loadLibrary("suspendthrdlst01"); System.loadLibrary("suspendthrdlst01");
} }
// run test from command line
public static void main(String argv[]) { public static void main(String argv[]) {
// JCK-compatible exit int result = new suspendthrdlst01().runIt();
System.exit(run(argv, System.out) + 95); if (result != 0) {
throw new RuntimeException("check failed with result " + result);
} }
// run test from JCK-compatible environment
public static int run(String argv[], PrintStream out) {
return new suspendthrdlst01().runIt(argv, out);
} }
/* =================================================================== */ /* =================================================================== */
@ -71,7 +67,7 @@ public class suspendthrdlst01 extends DebugeeClass {
suspendthrdlst01Thread threads[] = null; suspendthrdlst01Thread threads[] = null;
// run debuggee // run debuggee
public int runIt(String argv[], PrintStream out) { public int runIt() {
timeout = 60 * 1000; // milliseconds timeout = 60 * 1000; // milliseconds
// create tested threads // create tested threads

View File

@ -192,7 +192,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
"# expected: %d\n", "# expected: %d\n",
name, found, foundCount); name, found, foundCount);
set_agent_fail_status(); set_agent_fail_status();
return NSK_FALSE; return JNI_FALSE;
} }
LOG("Make global references for threads: %d threads\n", foundCount); LOG("Make global references for threads: %d threads\n", foundCount);
@ -200,12 +200,12 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]); foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]);
if (foundThreads[i] == NULL) { if (foundThreads[i] == NULL) {
set_agent_fail_status(); set_agent_fail_status();
return NSK_FALSE; return JNI_FALSE;
} }
LOG(" ... thread #%d: %p\n", i, foundThreads[i]); LOG(" ... thread #%d: %p\n", i, foundThreads[i]);
} }
return NSK_TRUE; return JNI_TRUE;
} }
/** THREAD_END callback. */ /** THREAD_END callback. */

View File

@ -39,11 +39,6 @@
import jdk.test.lib.jvmti.DebugeeClass; import jdk.test.lib.jvmti.DebugeeClass;
import java.io.PrintStream;
public class suspendthrdlst02 extends DebugeeClass { public class suspendthrdlst02 extends DebugeeClass {
// load native library if required // load native library if required
@ -51,15 +46,11 @@ public class suspendthrdlst02 extends DebugeeClass {
System.loadLibrary("suspendthrdlst02"); System.loadLibrary("suspendthrdlst02");
} }
// run test from command line
public static void main(String argv[]) { public static void main(String argv[]) {
// JCK-compatible exit int result = new suspendthrdlst02().runIt();
System.exit(run(argv, System.out) + 95); if (result != 0) {
throw new RuntimeException("check failed with result " + result);
} }
// run test from JCK-compatible environment
public static int run(String argv[], PrintStream out) {
return new suspendthrdlst02().runIt(argv, out);
} }
/* =================================================================== */ /* =================================================================== */
@ -74,7 +65,7 @@ public class suspendthrdlst02 extends DebugeeClass {
suspendthrdlst02Thread threads[] = null; suspendthrdlst02Thread threads[] = null;
// run debuggee // run debuggee
public int runIt(String argv[], PrintStream out) { public int runIt() {
timeout = 60 * 1000; // milliseconds timeout = 60 * 1000; // milliseconds
// create tested threads // create tested threads

View File

@ -36,9 +36,6 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#define NSK_TRUE 1
#define NSK_FALSE 0
#define LOG(...) \ #define LOG(...) \
{ \ { \
printf(__VA_ARGS__); \ printf(__VA_ARGS__); \
@ -834,7 +831,7 @@ enable_events_notifications(jvmtiEnv* jvmti, JNIEnv* jni, jvmtiEventMode enable,
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
check_jvmti_status(jni, jvmti->SetEventNotificationMode(enable, list[i], thread), ""); check_jvmti_status(jni, jvmti->SetEventNotificationMode(enable, list[i], thread), "");
} }
return NSK_TRUE; return JNI_TRUE;
} }
void void

View File

@ -83,7 +83,7 @@ typedef struct agent_data_t {
int set_agent_proc(jvmtiStartFunction proc, void* arg) { int set_agent_proc(jvmtiStartFunction proc, void* arg) {
agent_thread_proc = proc; agent_thread_proc = proc;
agent_thread_arg = arg; agent_thread_arg = arg;
return NSK_TRUE; return JNI_TRUE;
} }
static agent_data_t agent_data; static agent_data_t agent_data;
@ -107,7 +107,7 @@ int agent_wait_for_sync(jlong timeout) {
static const int inc_timeout = 1000; static const int inc_timeout = 1000;
jlong t = 0; jlong t = 0;
int result = NSK_TRUE; int result = JNI_TRUE;
RawMonitorLocker monitor_locker(agent_jvmti_env, agent_jni_env, agent_data.monitor); RawMonitorLocker monitor_locker(agent_jvmti_env, agent_jni_env, agent_data.monitor);
@ -132,7 +132,7 @@ int agent_wait_for_sync(jlong timeout) {
if (agent_data.thread_state == WAITING) { if (agent_data.thread_state == WAITING) {
COMPLAIN("No status sync occured for timeout: %" LL "d ms\n", timeout); COMPLAIN("No status sync occured for timeout: %" LL "d ms\n", timeout);
set_agent_fail_status(); set_agent_fail_status();
result = NSK_FALSE; result = JNI_FALSE;
} }
return result; return result;
@ -144,7 +144,7 @@ int agent_resume_sync() {
RawMonitorLocker monitor_locker(agent_jvmti_env, agent_jni_env, agent_data.monitor); RawMonitorLocker monitor_locker(agent_jvmti_env, agent_jni_env, agent_data.monitor);
if (agent_data.thread_state == SUSPENDED) { if (agent_data.thread_state == SUSPENDED) {
result = NSK_TRUE; result = JNI_TRUE;
agent_data.thread_state = RUNNABLE; agent_data.thread_state = RUNNABLE;
/* SP5.2-n - notify suspend done */ /* SP5.2-n - notify suspend done */
/* SP7.2-n - notify agent end */ /* SP7.2-n - notify agent end */
@ -153,10 +153,10 @@ int agent_resume_sync() {
else { else {
COMPLAIN("Debuggee was not suspended on status sync\n"); COMPLAIN("Debuggee was not suspended on status sync\n");
set_agent_fail_status(); set_agent_fail_status();
result = NSK_FALSE; result = JNI_FALSE;
} }
return NSK_TRUE; return JNI_TRUE;
} }
/* ============================================================================= */ /* ============================================================================= */