8352084: Add more test code in TestSetupAOT.java

Reviewed-by: erikj, kvn, lmesnik
This commit is contained in:
Ioi Lam
2025-03-18 00:49:36 +00:00
parent 19154f7af3
commit 38499b3fbf
5 changed files with 184 additions and 26 deletions

View File

@@ -732,14 +732,16 @@ endef
#
SetupAOT = $(NamedParamsMacroTemplate)
define SetupAOTBody
$1_AOT_JDK_CONF := $$($1_TEST_SUPPORT_DIR)/aot/jdk.aotconf
$1_AOT_JDK_CACHE := $$($1_TEST_SUPPORT_DIR)/aot/jdk.aotcache
$1_AOT_JDK_LOG := $$($1_TEST_SUPPORT_DIR)/aot/TestSetupAOT.log
$1_AOT_JDK_OUTPUT_DIR := $$($1_TEST_SUPPORT_DIR)/aot
$1_AOT_JDK_CONF := $$($1_AOT_JDK_OUTPUT_DIR)/jdk.aotconf
$1_AOT_JDK_CACHE := $$($1_AOT_JDK_OUTPUT_DIR)/jdk.aotcache
$1_AOT_JDK_LOG := $$($1_AOT_JDK_OUTPUT_DIR)/TestSetupAOT.log
# We execute the training run with $(TEST_IMAGE_DIR)/setup_aot/TestSetupAOT.class
# We execute the training run with the TestSetupAOT class from $(TEST_IMAGE_DIR)/setup_aot/TestSetupAOT.jar
# to touch a fair number of classes inside the JDK. Note that we can't specify a classpath,
# or else the AOT cache cannot be used with jtreg test cases that use a different value
# for their classpaths. Instead, we run in the $(TEST_IMAGE_DIR)/setup_aot/ directory.
# for their classpaths. Instead, we cd in the $$($1_AOT_JDK_OUTPUT_DIR) directory,
# extract the TestSetupAOT.jar there, and run in that directory without specifying a classpath.
# The "java" launcher will have an implicit classpath of ".", so it can pick up the TestSetupAOT
# class from the JVM's current directory.
#
@@ -748,19 +750,20 @@ define SetupAOTBody
# only classes from the JDK.
$$($1_AOT_JDK_CACHE): $$(JDK_IMAGE_DIR)/release
$$(call MakeDir, $$($1_TEST_SUPPORT_DIR)/aot)
$$(call MakeDir, $$($1_AOT_JDK_OUTPUT_DIR))
$$(call LogWarn, AOT: Create cache configuration) \
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/aot, ( \
$(CD) $(TEST_IMAGE_DIR)/setup_aot; \
$$(call ExecuteWithLog, $$($1_AOT_JDK_OUTPUT_DIR), ( \
cd $$($1_AOT_JDK_OUTPUT_DIR); \
$(JAR) --extract --file $(TEST_IMAGE_DIR)/setup_aot/TestSetupAOT.jar; \
$$(FIXPATH) $(JDK_UNDER_TEST)/bin/java $$($1_VM_OPTIONS) \
-Xlog:cds,cds+class=debug:file=$$($1_AOT_JDK_CONF).log -Xlog:cds*=error \
-Xlog:class+load,cds,cds+class=debug:file=$$($1_AOT_JDK_CONF).log -Xlog:cds*=error \
-XX:AOTMode=record -XX:AOTConfiguration=$$($1_AOT_JDK_CONF) \
TestSetupAOT > $$($1_AOT_JDK_LOG) \
TestSetupAOT $$($1_AOT_JDK_OUTPUT_DIR) > $$($1_AOT_JDK_LOG) \
))
$$(call LogWarn, AOT: Generate AOT cache $$($1_AOT_JDK_CACHE) with flags: $$($1_VM_OPTIONS))
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/aot, ( \
$$(call ExecuteWithLog, $$($1_AOT_JDK_OUTPUT_DIR), ( \
$$(FIXPATH) $(JDK_UNDER_TEST)/bin/java \
$$($1_VM_OPTIONS) -Xlog:cds,cds+class=debug:file=$$($1_AOT_JDK_CACHE).log -Xlog:cds*=error \
-XX:ExtraSharedClassListFile=$(JDK_UNDER_TEST)/lib/classlist \