< prev index next >
test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp
Print this page
rev 52185 : [mq]: refactor
*** 41,91 ****
/* ========================================================================== */
/* Check SetVerboseFlag function
*/
static int checkSetVerboseFlag(jvmtiEnv *jvmti) {
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_OTHER, JNI_TRUE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_OTHER, JNI_FALSE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_GC, JNI_TRUE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_GC, JNI_FALSE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_CLASS, JNI_TRUE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_CLASS, JNI_FALSE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_JNI, JNI_TRUE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_JNI, JNI_FALSE)))
return NSK_FALSE;
return NSK_TRUE;
}
/* ========================================================================== */
void JNICALL
VMInit(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) {
! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
/* testcase #3: check SetVerboseFlag in VMInit */
--- 41,83 ----
/* ========================================================================== */
/* Check SetVerboseFlag function
*/
static int checkSetVerboseFlag(jvmtiEnv *jvmti) {
! if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_OTHER, JNI_TRUE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_OTHER, JNI_FALSE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_GC, JNI_TRUE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_GC, JNI_FALSE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_CLASS, JNI_TRUE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_CLASS, JNI_FALSE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_JNI, JNI_TRUE)))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_JNI, JNI_FALSE)))
return NSK_FALSE;
return NSK_TRUE;
}
/* ========================================================================== */
void JNICALL
VMInit(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) {
! if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
/* testcase #3: check SetVerboseFlag in VMInit */
*** 103,116 ****
const unsigned char* class_data,
jint* new_class_data_len,
unsigned char** new_class_data) {
jvmtiPhase curr_phase;
! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
nsk_jvmti_setFailStatus();
! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &curr_phase)))
nsk_jvmti_setFailStatus();
if (phase != curr_phase) {
phase = curr_phase;
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
--- 95,108 ----
const unsigned char* class_data,
jint* new_class_data_len,
unsigned char** new_class_data) {
jvmtiPhase curr_phase;
! if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
nsk_jvmti_setFailStatus();
! if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&curr_phase)))
nsk_jvmti_setFailStatus();
if (phase != curr_phase) {
phase = curr_phase;
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
*** 119,129 ****
NSK_DISPLAY0("Testcase #2: check SetVerboseFlag in ClassFileLoadHook\n");
if (!checkSetVerboseFlag(jvmti))
nsk_jvmti_setFailStatus();
}
! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
nsk_jvmti_setFailStatus();
}
/* ========================================================================== */
--- 111,121 ----
NSK_DISPLAY0("Testcase #2: check SetVerboseFlag in ClassFileLoadHook\n");
if (!checkSetVerboseFlag(jvmti))
nsk_jvmti_setFailStatus();
}
! if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
nsk_jvmti_setFailStatus();
}
/* ========================================================================== */
*** 133,143 ****
/* wait for debuggee start */
if (!nsk_jvmti_waitForSync(timeout))
return;
! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
/* testcase #4: check SetVerboseFlag in agentProc */
--- 125,135 ----
/* wait for debuggee start */
if (!nsk_jvmti_waitForSync(timeout))
return;
! if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
/* testcase #4: check SetVerboseFlag in agentProc */
*** 179,194 ****
if (!NSK_VERIFY((jvmti =
nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
/* Create data access lock */
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(CreateRawMonitor, jvmti,
! "_access_lock", &access_lock)))
return JNI_ERR;
! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
return JNI_ERR;
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
/* testcase #1: check SetVerboseFlag in Agent_OnLoad */
--- 171,184 ----
if (!NSK_VERIFY((jvmti =
nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
/* Create data access lock */
! if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_access_lock", &access_lock)))
return JNI_ERR;
! if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
return JNI_ERR;
NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
/* testcase #1: check SetVerboseFlag in Agent_OnLoad */
*** 197,221 ****
nsk_jvmti_setFailStatus();
memset(&callbacks, 0, sizeof(callbacks));
callbacks.VMInit = &VMInit;
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(SetEventCallbacks, jvmti,
! &callbacks, sizeof(callbacks))))
return JNI_ERR;
/* enable VMInit event */
if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
! JVMTI_EVENT_VM_INIT, NULL)))
return JNI_ERR;
/* enable ClassFileLoadHook event */
if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
! JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
/* register agent proc and arg */
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
return JNI_ERR;
--- 187,207 ----
nsk_jvmti_setFailStatus();
memset(&callbacks, 0, sizeof(callbacks));
callbacks.VMInit = &VMInit;
callbacks.ClassFileLoadHook = &ClassFileLoadHook;
! if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
/* enable VMInit event */
if (!NSK_JVMTI_VERIFY(
! jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
return JNI_ERR;
/* enable ClassFileLoadHook event */
if (!NSK_JVMTI_VERIFY(
! jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
/* register agent proc and arg */
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
return JNI_ERR;
< prev index next >