Skip to content
Permalink
Browse files

8242891: vmTestbase/nsk/jvmti/ test should be fixed to fail early if …

…JVMTI function return error

Reviewed-by: sspitsyn, cjplummer
  • Loading branch information
lmesnik committed Jul 14, 2020
1 parent f8f35d3 commit 590de670a91b86d49016c183c5c7ef7d38bc2df7
Showing with 164 additions and 38 deletions.
  1. +3 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp
  2. +5 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassPrepare/classprep001/classprep001.cpp
  3. +3 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp
  4. +8 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/Exception/exception001/exception001.cpp
  5. +5 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/ExceptionCatch/excatch001/excatch001.cpp
  6. +6 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc001/fieldacc001.cpp
  7. +6 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc002/fieldacc002.cpp
  8. +6 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc003/fieldacc003.cpp
  9. +6 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc004/fieldacc004.cpp
  10. +6 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldModification/fieldmod001/fieldmod001.cpp
  11. +6 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldModification/fieldmod002/fieldmod002.cpp
  12. +4 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/FramePop/framepop001/framepop001.cpp
  13. +4 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/FramePop/framepop002/framepop002.cpp
  14. +5 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAllThreads/allthr001/allthr001.cpp
  15. +6 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp
  16. +3 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr002/getclsldr002.cpp
  17. +3 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr003/getclsldr003.cpp
  18. +2 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss001/clsldrclss001.cpp
  19. +2 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFrameCount/framecnt001/framecnt001.cpp
  20. +5 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFrameLocation/frameloc002/frameloc002.cpp
  21. +4 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal001/getlocal001.cpp
  22. +2 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp001/topthrgrp001.cpp
  23. +2 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp
  24. +2 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp
  25. +5 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodEntry/mentry001/mentry001.cpp
  26. +5 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodExit/mexit001/mexit001.cpp
  27. +6 −2 test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodExit/mexit002/mexit002.cpp
  28. +4 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp
  29. +3 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp
  30. +4 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp
  31. +7 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp
  32. +4 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp
  33. +6 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp
  34. +6 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp
  35. +2 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp
  36. +2 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp
  37. +6 −1 test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -118,6 +118,8 @@ ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) {
if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic))) {
result = STATUS_FAILED;
NSK_COMPLAIN0("TEST FAILURE: unable to obtain a class signature\n");
unlock(jvmti_env, env);
return;
}

i = findSig(sig, 1);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -102,6 +102,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti_env, JNIEnv *env,
printf("(GetClassSignature#%" PRIuPTR ") unexpected error: %s (%d)\n",
eventsCount, TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetClassStatus(cls, &inf.status);
if (err != JVMTI_ERROR_NONE) {
@@ -114,19 +115,22 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti_env, JNIEnv *env,
printf("(GetClassMethods#%" PRIuPTR ") unexpected error: %s (%d)\n",
eventsCount, TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetClassFields(cls, &inf.fcount, &fields);
if (err != JVMTI_ERROR_NONE) {
printf("(GetClassMethods#%" PRIuPTR ") unexpected error: %s (%d)\n",
eventsCount, TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetImplementedInterfaces(cls,
&inf.icount, &interfaces);
if (err != JVMTI_ERROR_NONE) {
printf("(GetImplementedInterfaces#%" PRIuPTR ") unexpected error: %s (%d)\n",
eventsCount, TranslateError(err), err);
result = STATUS_FAILED;
return;
}

if (printdump == JNI_TRUE) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -57,9 +57,11 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) {
printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n",
i, TranslateError(err), err);
result = STATUS_FAILED;
return;
} else if (monitors[i] == NULL) {
printf("(CreateRawMonitor#%d) jrawMonitorID is null\n", i);
result = STATUS_FAILED;
return;
}
}

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -95,45 +95,52 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr,
printf("(GetClassSignature) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetMethodDeclaringClass(method, &cls);
if (err != JVMTI_ERROR_NONE) {
printf("(GetMethodDeclaringClass#t) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetClassSignature(cls, &ex.t_cls, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetClassSignature#t) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetMethodName(method,
&ex.t_name, &ex.t_sig, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetMethodName#t) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
ex.t_loc = location;
err = jvmti_env->GetMethodDeclaringClass(catch_method, &cls);
if (err != JVMTI_ERROR_NONE) {
printf("(GetMethodDeclaringClass#c) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetClassSignature(cls, &ex.c_cls, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetClassSignature#c) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetMethodName(catch_method,
&ex.c_name, &ex.c_sig, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetMethodName#c) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
ex.c_loc = catch_location;
if (printdump == JNI_TRUE) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -83,25 +83,29 @@ ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr,
printf("(GetClassSignature#e) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetMethodDeclaringClass(method, &cls);
if (err != JVMTI_ERROR_NONE) {
printf("(GetMethodDeclaringClass) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetClassSignature(cls, &ex.c_cls, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetClassSignature#c) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetMethodName(method,
&ex.c_name, &ex.c_sig, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetMethodName) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
ex.c_loc = location;
if (printdump == JNI_TRUE) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -130,34 +130,39 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *env,
printf("(GetMethodDeclaringClass) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetClassSignature(cls,
&watch.m_cls, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetClassSignature) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetMethodName(method,
&watch.m_name, &watch.m_sig, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetMethodName) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetClassSignature(field_klass,
&watch.f_cls, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetClassSignature) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetFieldName(field_klass, field,
&watch.f_name, &watch.f_sig, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetFieldName) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
if (printdump == JNI_TRUE) {
printf(">>> class: \"%s\"\n", watch.m_cls);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -130,34 +130,39 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *env,
printf("(GetMethodDeclaringClass) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetClassSignature(cls,
&watch.m_cls, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetClassSignature) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetMethodName(method,
&watch.m_name, &watch.m_sig, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetMethodName) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetClassSignature(field_klass,
&watch.f_cls, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetClassSignature) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetFieldName(field_klass, field,
&watch.f_name, &watch.f_sig, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetFieldName) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
if (printdump == JNI_TRUE) {
printf(">>> class: \"%s\"\n", watch.m_cls);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -109,34 +109,39 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *env,
printf("(GetMethodDeclaringClass) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetClassSignature(cls,
&watch.m_cls, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetClassSignature) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetMethodName(method,
&watch.m_name, &watch.m_sig, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetMethodName) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetClassSignature(field_klass,
&watch.f_cls, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetClassSignature) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetFieldName(field_klass, field,
&watch.f_name, &watch.f_sig, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetFieldName) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
if (printdump == JNI_TRUE) {
printf(">>> class: \"%s\"\n", watch.m_cls);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -95,34 +95,39 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *env,
printf("(GetMethodDeclaringClass) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetClassSignature(cls,
&watch.m_cls, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetClassSignature) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetMethodName(method,
&watch.m_name, &watch.m_sig, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetMethodName) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetClassSignature(field_klass,
&watch.f_cls, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetClassSignature) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
err = jvmti_env->GetFieldName(field_klass, field,
&watch.f_name, &watch.f_sig, &generic);
if (err != JVMTI_ERROR_NONE) {
printf("(GetFieldName) unexpected error: %s (%d)\n",
TranslateError(err), err);
result = STATUS_FAILED;
return;
}
if (printdump == JNI_TRUE) {
printf(">>> class: \"%s\"\n", watch.m_cls);

0 comments on commit 590de67

Please sign in to comment.