Skip to content

Commit ee1577b

Browse files
author
David Holmes
committed
8352652: [BACKOUT] nsk/jvmti/ tests should fail when nsk_jvmti_setFailStatus() is called
Reviewed-by: lmesnik
1 parent df9210e commit ee1577b

File tree

5 files changed

+24
-51
lines changed

5 files changed

+24
-51
lines changed

test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* 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,
9797
const void* compile_info) {
9898
char *name;
9999
char *sig;
100-
jvmtiPhase phase;
101-
102-
if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
103-
nsk_jvmti_setFailStatus();
104-
return;
105-
}
106-
if (phase == JVMTI_PHASE_DEAD) {
107-
NSK_DISPLAY0("CompiledMethodLoad event recieved in dead phase");
108-
return;
109-
}
110100

111101
NSK_DISPLAY0("CompiledMethodLoad event received for:\n");
112102
if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, nullptr))) {

test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -116,18 +116,6 @@ cbDynamicCodeGenerated2(jvmtiEnv *jvmti_env, const char *name,
116116
NSK_DISPLAY3("NOT FOUND: 0x%p %7d %s\n", address, length, name);
117117
jvmti->RawMonitorExit(syncLock);
118118

119-
}
120-
121-
void JNICALL
122-
cbVMDeath(jvmtiEnv* jvmti, JNIEnv* jni_env) {
123-
if (!NSK_VERIFY(nsk_list_destroy(plist))) {
124-
nsk_jvmti_setFailStatus();
125-
}
126-
127-
if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) {
128-
nsk_jvmti_setFailStatus();
129-
}
130-
131119
}
132120

133121
/* ============================================================================= */
@@ -147,7 +135,6 @@ int setCallBacks(int stage) {
147135
jvmtiEventCallbacks eventCallbacks;
148136
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
149137

150-
eventCallbacks.VMDeath = cbVMDeath;
151138
eventCallbacks.DynamicCodeGenerated = (stage == 1) ?
152139
cbDynamicCodeGenerated1 : cbDynamicCodeGenerated2;
153140

@@ -255,4 +242,23 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
255242
return JNI_OK;
256243
}
257244

245+
/* ============================================================================= */
246+
247+
JNIEXPORT void JNICALL
248+
#ifdef STATIC_BUILD
249+
Agent_OnUnload_em04t001(JavaVM *jvm)
250+
#else
251+
Agent_OnUnload(JavaVM *jvm)
252+
#endif
253+
{
254+
255+
if (!NSK_VERIFY(nsk_list_destroy(plist))) {
256+
nsk_jvmti_setFailStatus();
257+
}
258+
259+
if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) {
260+
nsk_jvmti_setFailStatus();
261+
}
262+
}
263+
258264
}

test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -51,18 +51,9 @@ CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method,
5151
const jvmtiAddrLocationMap* map, const void* compile_info) {
5252
char *name = nullptr;
5353
char *signature = nullptr;
54-
jvmtiPhase phase;
5554

5655
CompiledMethodLoadEventsCount++;
5756

58-
if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
59-
nsk_jvmti_setFailStatus();
60-
return;
61-
}
62-
if (phase == JVMTI_PHASE_DEAD) {
63-
NSK_DISPLAY0("CompiledMethodLoad event recieved in dead phase");
64-
return;
65-
}
6657
if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) {
6758
nsk_jvmti_setFailStatus();
6859
return;

test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,6 @@
2121
* questions.
2222
*/
2323

24-
#include <stdio.h>
2524
#include <stdlib.h>
2625
#include <string.h>
2726

@@ -63,9 +62,6 @@ static volatile int currentAgentStatus = NSK_STATUS_PASSED;
6362

6463
void nsk_jvmti_setFailStatus() {
6564
currentAgentStatus = NSK_STATUS_FAILED;
66-
printf("Test failed by setFailStatus(). See log.");
67-
fflush(stdout);
68-
exit(97);
6965
}
7066

7167
int nsk_jvmti_isFailStatus() {

test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -141,19 +141,9 @@ CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method,
141141
const jvmtiAddrLocationMap* map, const void* compile_info) {
142142
char *name = nullptr;
143143
char *signature = nullptr;
144-
jvmtiPhase phase;
145144

146145
CompiledMethodLoadEventsCount++;
147146

148-
// GetMethodName works in live phase only so just exit if the event is generated too late
149-
if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
150-
nsk_jvmti_setFailStatus();
151-
return;
152-
}
153-
if (phase == JVMTI_PHASE_DEAD) {
154-
NSK_DISPLAY0("CompiledMethodLoad event recieved in dead phase");
155-
return;
156-
}
157147
if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) {
158148
nsk_jvmti_setFailStatus();
159149
return;

0 commit comments

Comments
 (0)