8350151: Support requires property to filter tests incompatible with --enable-preview

Reviewed-by: alanb, rriggs
This commit is contained in:
Leonid Mesnik 2025-02-20 18:00:33 +00:00
parent 16873732a7
commit 1eb0db3760
5 changed files with 27 additions and 8 deletions

View File

@ -46,13 +46,16 @@ requires.extraPropDefns.bootlibs = ../../lib/jdk/test/whitebox
requires.extraPropDefns.libs = \
../../lib/jdk/test/lib/Platform.java \
../../lib/jdk/test/lib/Container.java
requires.extraPropDefns.javacOpts = --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
requires.extraPropDefns.javacOpts = \
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
requires.extraPropDefns.vmOpts = \
-XX:+UnlockDiagnosticVMOptions \
-XX:+LogVMOutput -XX:-DisplayVMOutput -XX:LogFile=vmprops.flags.final.vm.log \
-XX:+PrintFlagsFinal \
-XX:+WhiteBoxAPI \
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
requires.properties= \
sun.arch.data.model \
vm.simpleArch \

View File

@ -74,16 +74,20 @@ requires.extraPropDefns.bootlibs = ../lib/jdk/test/whitebox
requires.extraPropDefns.libs = \
../lib/jdk/test/lib/Platform.java \
../lib/jdk/test/lib/Container.java
requires.extraPropDefns.javacOpts = --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
requires.extraPropDefns.javacOpts = \
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
requires.extraPropDefns.vmOpts = \
-XX:+UnlockDiagnosticVMOptions \
-XX:+LogVMOutput -XX:-DisplayVMOutput -XX:LogFile=vmprops.flags.final.vm.log \
-XX:+PrintFlagsFinal \
-XX:+WhiteBoxAPI \
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
requires.properties= \
sun.arch.data.model \
java.runtime.name \
java.enablePreview \
vm.flagless \
vm.gc.G1 \
vm.gc.Serial \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2025, 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
@ -26,6 +26,7 @@
* @bug 8245432
* @modules jdk.compiler
* @library /test/lib
* @requires !java.enablePreview
* @build jdk.test.lib.Utils
* jdk.test.lib.compiler.CompilerUtils
* @run testng PreviewHiddenClass

View File

@ -50,6 +50,7 @@ import java.util.regex.Pattern;
import java.util.stream.Stream;
import jdk.internal.foreign.CABI;
import jdk.internal.misc.PreviewFeatures;
import jdk.test.whitebox.code.Compiler;
import jdk.test.whitebox.cpuinfo.CPUInfo;
import jdk.test.whitebox.gc.GC;
@ -129,6 +130,7 @@ public class VMProps implements Callable<Map<String, String>> {
map.put("vm.graal.enabled", this::isGraalEnabled);
// jdk.hasLibgraal is true if the libgraal shared library file is present
map.put("jdk.hasLibgraal", this::hasLibgraal);
map.put("java.enablePreview", this::isPreviewEnabled);
map.put("vm.libgraal.jit", this::isLibgraalJIT);
map.put("vm.compiler1.enabled", this::isCompiler1Enabled);
map.put("vm.compiler2.enabled", this::isCompiler2Enabled);
@ -586,6 +588,9 @@ public class VMProps implements Callable<Map<String, String>> {
return "" + Compiler.isC2Enabled();
}
protected String isPreviewEnabled() {
return "" + PreviewFeatures.isEnabled();
}
/**
* A simple check for container support
*

View File

@ -37,10 +37,16 @@ requires.extraPropDefns.bootlibs = ../lib/jdk/test/whitebox
requires.extraPropDefns.libs = \
../lib/jdk/test/lib/Platform.java \
../lib/jdk/test/lib/Container.java
requires.extraPropDefns.javacOpts = --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
requires.extraPropDefns.javacOpts = \
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
requires.extraPropDefns.vmOpts = \
-XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI \
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
-XX:+UnlockDiagnosticVMOptions \
-XX:+LogVMOutput -XX:-DisplayVMOutput -XX:LogFile=vmprops.flags.final.vm.log \
-XX:+PrintFlagsFinal \
-XX:+WhiteBoxAPI \
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
requires.properties= \
vm.continuations \
vm.debug