Skip to content

Commit 1eb0db3

Browse files
committedFeb 20, 2025
8350151: Support requires property to filter tests incompatible with --enable-preview
Reviewed-by: alanb, rriggs
1 parent 1687373 commit 1eb0db3

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed
 

‎test/hotspot/jtreg/TEST.ROOT

+5-2
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,16 @@ requires.extraPropDefns.bootlibs = ../../lib/jdk/test/whitebox
4646
requires.extraPropDefns.libs = \
4747
../../lib/jdk/test/lib/Platform.java \
4848
../../lib/jdk/test/lib/Container.java
49-
requires.extraPropDefns.javacOpts = --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
49+
requires.extraPropDefns.javacOpts = \
50+
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
51+
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
5052
requires.extraPropDefns.vmOpts = \
5153
-XX:+UnlockDiagnosticVMOptions \
5254
-XX:+LogVMOutput -XX:-DisplayVMOutput -XX:LogFile=vmprops.flags.final.vm.log \
5355
-XX:+PrintFlagsFinal \
5456
-XX:+WhiteBoxAPI \
55-
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
57+
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
58+
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
5659
requires.properties= \
5760
sun.arch.data.model \
5861
vm.simpleArch \

‎test/jdk/TEST.ROOT

+6-2
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,20 @@ requires.extraPropDefns.bootlibs = ../lib/jdk/test/whitebox
7474
requires.extraPropDefns.libs = \
7575
../lib/jdk/test/lib/Platform.java \
7676
../lib/jdk/test/lib/Container.java
77-
requires.extraPropDefns.javacOpts = --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
77+
requires.extraPropDefns.javacOpts = \
78+
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
79+
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
7880
requires.extraPropDefns.vmOpts = \
7981
-XX:+UnlockDiagnosticVMOptions \
8082
-XX:+LogVMOutput -XX:-DisplayVMOutput -XX:LogFile=vmprops.flags.final.vm.log \
8183
-XX:+PrintFlagsFinal \
8284
-XX:+WhiteBoxAPI \
83-
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
85+
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
86+
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
8487
requires.properties= \
8588
sun.arch.data.model \
8689
java.runtime.name \
90+
java.enablePreview \
8791
vm.flagless \
8892
vm.gc.G1 \
8993
vm.gc.Serial \

‎test/jdk/java/lang/invoke/defineHiddenClass/PreviewHiddenClass.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2025, 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
@@ -26,6 +26,7 @@
2626
* @bug 8245432
2727
* @modules jdk.compiler
2828
* @library /test/lib
29+
* @requires !java.enablePreview
2930
* @build jdk.test.lib.Utils
3031
* jdk.test.lib.compiler.CompilerUtils
3132
* @run testng PreviewHiddenClass

‎test/jtreg-ext/requires/VMProps.java

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import java.util.stream.Stream;
5151

5252
import jdk.internal.foreign.CABI;
53+
import jdk.internal.misc.PreviewFeatures;
5354
import jdk.test.whitebox.code.Compiler;
5455
import jdk.test.whitebox.cpuinfo.CPUInfo;
5556
import jdk.test.whitebox.gc.GC;
@@ -129,6 +130,7 @@ public Map<String, String> call() {
129130
map.put("vm.graal.enabled", this::isGraalEnabled);
130131
// jdk.hasLibgraal is true if the libgraal shared library file is present
131132
map.put("jdk.hasLibgraal", this::hasLibgraal);
133+
map.put("java.enablePreview", this::isPreviewEnabled);
132134
map.put("vm.libgraal.jit", this::isLibgraalJIT);
133135
map.put("vm.compiler1.enabled", this::isCompiler1Enabled);
134136
map.put("vm.compiler2.enabled", this::isCompiler2Enabled);
@@ -586,6 +588,9 @@ protected String isCompiler2Enabled() {
586588
return "" + Compiler.isC2Enabled();
587589
}
588590

591+
protected String isPreviewEnabled() {
592+
return "" + PreviewFeatures.isEnabled();
593+
}
589594
/**
590595
* A simple check for container support
591596
*

‎test/langtools/TEST.ROOT

+9-3
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,16 @@ requires.extraPropDefns.bootlibs = ../lib/jdk/test/whitebox
3737
requires.extraPropDefns.libs = \
3838
../lib/jdk/test/lib/Platform.java \
3939
../lib/jdk/test/lib/Container.java
40-
requires.extraPropDefns.javacOpts = --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
40+
requires.extraPropDefns.javacOpts = \
41+
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
42+
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
4143
requires.extraPropDefns.vmOpts = \
42-
-XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI \
43-
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
44+
-XX:+UnlockDiagnosticVMOptions \
45+
-XX:+LogVMOutput -XX:-DisplayVMOutput -XX:LogFile=vmprops.flags.final.vm.log \
46+
-XX:+PrintFlagsFinal \
47+
-XX:+WhiteBoxAPI \
48+
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
49+
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
4450
requires.properties= \
4551
vm.continuations \
4652
vm.debug

0 commit comments

Comments
 (0)
Please sign in to comment.