8352652: [BACKOUT] nsk/jvmti/ tests should fail when nsk_jvmti_setFailStatus() is called

Reviewed-by: lmesnik
This commit is contained in:
David Holmes 2025-03-24 00:18:13 +00:00
parent df9210e657
commit ee1577b790
5 changed files with 24 additions and 51 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -97,16 +97,6 @@ CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size,
const void* compile_info) {
char *name;
char *sig;
jvmtiPhase phase;
if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
return;
}
if (phase == JVMTI_PHASE_DEAD) {
NSK_DISPLAY0("CompiledMethodLoad event recieved in dead phase");
return;
}
NSK_DISPLAY0("CompiledMethodLoad event received for:\n");
if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, nullptr))) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -116,18 +116,6 @@ cbDynamicCodeGenerated2(jvmtiEnv *jvmti_env, const char *name,
NSK_DISPLAY3("NOT FOUND: 0x%p %7d %s\n", address, length, name);
jvmti->RawMonitorExit(syncLock);
}
void JNICALL
cbVMDeath(jvmtiEnv* jvmti, JNIEnv* jni_env) {
if (!NSK_VERIFY(nsk_list_destroy(plist))) {
nsk_jvmti_setFailStatus();
}
if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) {
nsk_jvmti_setFailStatus();
}
}
/* ============================================================================= */
@ -147,7 +135,6 @@ int setCallBacks(int stage) {
jvmtiEventCallbacks eventCallbacks;
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.VMDeath = cbVMDeath;
eventCallbacks.DynamicCodeGenerated = (stage == 1) ?
cbDynamicCodeGenerated1 : cbDynamicCodeGenerated2;
@ -255,4 +242,23 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_OK;
}
/* ============================================================================= */
JNIEXPORT void JNICALL
#ifdef STATIC_BUILD
Agent_OnUnload_em04t001(JavaVM *jvm)
#else
Agent_OnUnload(JavaVM *jvm)
#endif
{
if (!NSK_VERIFY(nsk_list_destroy(plist))) {
nsk_jvmti_setFailStatus();
}
if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) {
nsk_jvmti_setFailStatus();
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -51,18 +51,9 @@ CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method,
const jvmtiAddrLocationMap* map, const void* compile_info) {
char *name = nullptr;
char *signature = nullptr;
jvmtiPhase phase;
CompiledMethodLoadEventsCount++;
if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
return;
}
if (phase == JVMTI_PHASE_DEAD) {
NSK_DISPLAY0("CompiledMethodLoad event recieved in dead phase");
return;
}
if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) {
nsk_jvmti_setFailStatus();
return;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -21,7 +21,6 @@
* questions.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -63,9 +62,6 @@ static volatile int currentAgentStatus = NSK_STATUS_PASSED;
void nsk_jvmti_setFailStatus() {
currentAgentStatus = NSK_STATUS_FAILED;
printf("Test failed by setFailStatus(). See log.");
fflush(stdout);
exit(97);
}
int nsk_jvmti_isFailStatus() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -141,19 +141,9 @@ CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method,
const jvmtiAddrLocationMap* map, const void* compile_info) {
char *name = nullptr;
char *signature = nullptr;
jvmtiPhase phase;
CompiledMethodLoadEventsCount++;
// GetMethodName works in live phase only so just exit if the event is generated too late
if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
nsk_jvmti_setFailStatus();
return;
}
if (phase == JVMTI_PHASE_DEAD) {
NSK_DISPLAY0("CompiledMethodLoad event recieved in dead phase");
return;
}
if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) {
nsk_jvmti_setFailStatus();
return;