8173936: [TESTBUG] test/serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook/MAAClassFileLoadHook.java needs to be re-examined
authorsspitsyn
Tue, 17 Oct 2017 14:37:01 -0700
changeset 47641 5fbb4e3b5c92
parent 47619 74f5b6c267e3
child 47642 aeb80739a5ca
child 47651 148b73047771
8173936: [TESTBUG] test/serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook/MAAClassFileLoadHook.java needs to be re-examined Summary: Expect CFLH events only if can_generate_early_vmstart capability is enabled Reviewed-by: dholmes, gtriantafill
test/hotspot/jtreg/serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook/libMAAClassFileLoadHook.c
--- a/test/hotspot/jtreg/serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook/libMAAClassFileLoadHook.c	Wed Oct 11 23:29:24 2017 +0900
+++ b/test/hotspot/jtreg/serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook/libMAAClassFileLoadHook.c	Tue Oct 17 14:37:01 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, 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
@@ -137,6 +137,7 @@
     jvmtiEventCallbacks callbacks;
     jvmtiError err;
 
+    printf("agent options: %s\n", options);
     if (options != NULL) {
         if (strstr(options, "with_early_vmstart") != NULL) {
             with_early_vm_start_capability = JNI_TRUE;
@@ -205,9 +206,9 @@
     }
 
     /*
-     * Expecting that we always get ClassFileLoadHook events in the VM Start phase.
+     * Expecting ClassFileLoadHook events in the VM Start phase if early_vm_start is enabled.
      */
-    if (cflh_events_vm_start_count == 0) {
+    if (with_early_vm_start_capability == JNI_TRUE && cflh_events_vm_start_count == 0) {
         throw_exc(env, "Didn't get ClassFileLoadHook events in start phase!\n");
         return FAILED;
     }