Skip to content

Commit d7aa349

Browse files
committed
8357826: Avoid running some jtreg tests when asan is configured
Reviewed-by: sspitsyn, amitkumar, lmesnik, syan, lucy, cjplummer
1 parent 3b32f6a commit d7aa349

File tree

12 files changed

+64
-2
lines changed

12 files changed

+64
-2
lines changed

src/hotspot/share/prims/whitebox.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,22 @@ bool WhiteBox::validate_cgroup(bool cgroups_v2_enabled,
10751075
}
10761076
#endif
10771077

1078+
bool WhiteBox::is_asan_enabled() {
1079+
#ifdef ADDRESS_SANITIZER
1080+
return true;
1081+
#else
1082+
return false;
1083+
#endif
1084+
}
1085+
1086+
bool WhiteBox::is_ubsan_enabled() {
1087+
#ifdef UNDEFINED_BEHAVIOR_SANITIZER
1088+
return true;
1089+
#else
1090+
return false;
1091+
#endif
1092+
}
1093+
10781094
bool WhiteBox::compile_method(Method* method, int comp_level, int bci, JavaThread* THREAD) {
10791095
// Screen for unavailable/bad comp level or null method
10801096
AbstractCompiler* comp = CompileBroker::compiler(comp_level);
@@ -1886,6 +1902,14 @@ WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
18861902
return (jboolean) obj_oop->mark().has_monitor();
18871903
WB_END
18881904

1905+
WB_ENTRY(jboolean, WB_IsAsanEnabled(JNIEnv* env))
1906+
return (jboolean) WhiteBox::is_asan_enabled();
1907+
WB_END
1908+
1909+
WB_ENTRY(jboolean, WB_IsUbsanEnabled(JNIEnv* env))
1910+
return (jboolean) WhiteBox::is_ubsan_enabled();
1911+
WB_END
1912+
18891913
WB_ENTRY(jlong, WB_getInUseMonitorCount(JNIEnv* env, jobject wb))
18901914
return (jlong) WhiteBox::get_in_use_monitor_count();
18911915
WB_END
@@ -2882,6 +2906,8 @@ static JNINativeMethod methods[] = {
28822906
(void*)&WB_AddModuleExportsToAll },
28832907
{CC"deflateIdleMonitors", CC"()Z", (void*)&WB_DeflateIdleMonitors },
28842908
{CC"isMonitorInflated0", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated },
2909+
{CC"isAsanEnabled", CC"()Z", (void*)&WB_IsAsanEnabled },
2910+
{CC"isUbsanEnabled", CC"()Z", (void*)&WB_IsUbsanEnabled },
28852911
{CC"getInUseMonitorCount", CC"()J", (void*)&WB_getInUseMonitorCount },
28862912
{CC"getLockStackCapacity", CC"()I", (void*)&WB_getLockStackCapacity },
28872913
{CC"supportsRecursiveLightweightLocking", CC"()Z", (void*)&WB_supportsRecursiveLightweightLocking },

src/hotspot/share/prims/whitebox.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 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
@@ -72,6 +72,9 @@ class WhiteBox : public AllStatic {
7272
#ifdef LINUX
7373
static bool validate_cgroup(bool cgroups_v2_enabled, const char* controllers_file, const char* proc_self_cgroup, const char* proc_self_mountinfo, u1* cg_flags);
7474
#endif
75+
// provide info about enabling of Address Sanitizer / Undefined Behavior Sanitizer
76+
static bool is_asan_enabled();
77+
static bool is_ubsan_enabled();
7578
};
7679

7780
#endif // SHARE_PRIMS_WHITEBOX_HPP

test/hotspot/jtreg/TEST.ROOT

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ requires.properties= \
9191
vm.compiler1.enabled \
9292
vm.compiler2.enabled \
9393
vm.musl \
94+
vm.asan \
95+
vm.ubsan \
9496
vm.flagless \
9597
container.support \
9698
systemd.support \

test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
* @library /test/lib
3232
* @library /
3333
* @requires vm.bits == "64"
34+
* @comment ulimit clashes with the memory requirements of ASAN
35+
* @requires !vm.asan
3436
* @requires os.family == "linux"
3537
* @requires vm.gc != "Z"
3638
* @requires vm.opt.UseCompressedOops == null

test/hotspot/jtreg/runtime/Thread/TestBreakSignalThreadDump.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
* @requires os.family != "windows" & os.family != "aix"
3939
* @comment TODO: Decide libjsig support on static JDK with 8351367
4040
* @requires !jdk.static
41+
* @comment loading of the jsig lib does currently not work well with ASAN lib
42+
* @requires !vm.asan
4143
* @library /vmTestbase
4244
* /test/lib
4345
* @run driver TestBreakSignalThreadDump load_libjsig

test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
* @modules java.base/jdk.internal.misc
3030
* java.management
3131
* @requires os.family == "linux" | os.family == "mac"
32+
* @comment loading of the jsig lib does currently not work well with ASAN lib
33+
* @requires !vm.asan
3234
* @comment TODO: Decide libjsig support on static JDK with 8351367
3335
* @requires !jdk.static
3436
* @run driver XCheckJSig

test/hotspot/jtreg/serviceability/dcmd/vm/SystemDumpMapTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
* @summary Test of diagnostic command System.map
3737
* @library /test/lib
3838
* @requires (os.family == "linux" | os.family == "windows" | os.family == "mac")
39+
* @comment ASAN changes the memory map dump slightly, but the test has rather strict requirements
40+
* @requires !vm.asan
3941
* @requires os.arch != "riscv64" | !(vm.cpu.features ~= ".*qemu.*")
4042
* @modules java.base/jdk.internal.misc
4143
* java.compiler

test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
* @summary Test of diagnostic command System.map
3333
* @library /test/lib
3434
* @requires (vm.gc != "Z") & (os.family == "linux" | os.family == "windows" | os.family == "mac")
35+
* @comment ASAN changes the memory map dump slightly, but the test has rather strict requirements
36+
* @requires !vm.asan
3537
* @modules java.base/jdk.internal.misc
3638
* java.compiler
3739
* java.management
@@ -47,6 +49,8 @@
4749
* @summary Test of diagnostic command System.map using ZGC
4850
* @library /test/lib
4951
* @requires vm.gc.Z & (os.family == "linux" | os.family == "windows" | os.family == "mac")
52+
* @comment ASAN changes the memory map dump slightly, but the test has rather strict requirements
53+
* @requires !vm.asan
5054
* @modules java.base/jdk.internal.misc
5155
* java.compiler
5256
* java.management

test/jdk/TEST.ROOT

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ requires.properties= \
102102
vm.cds.write.archived.java.heap \
103103
vm.continuations \
104104
vm.musl \
105+
vm.asan \
106+
vm.ubsan \
105107
vm.debug \
106108
vm.hasSA \
107109
vm.hasJFR \

test/jdk/build/AbsPathsInImage.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 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
@@ -40,6 +40,8 @@
4040
* @bug 8226346
4141
* @summary Check all output files for absolute path fragments
4242
* @requires !vm.debug
43+
* @comment ASAN keeps the 'unwanted' paths in the binaries because of its build options
44+
* @requires !vm.asan
4345
* @run main/othervm -Xmx900m AbsPathsInImage
4446
*/
4547
public class AbsPathsInImage {

0 commit comments

Comments
 (0)