Skip to content

Commit 52a0b11

Browse files
committed
8357826: Avoid running some jtreg tests when asan is configured
Reviewed-by: rschmelter Backport-of: d7aa34982053bad37b3b726539f1245d054258f4
1 parent 6f6974f commit 52a0b11

File tree

12 files changed

+62
-2
lines changed

12 files changed

+62
-2
lines changed

src/hotspot/share/prims/whitebox.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,22 @@ bool WhiteBox::validate_cgroup(const char* proc_cgroups,
10491049
}
10501050
#endif
10511051

1052+
bool WhiteBox::is_asan_enabled() {
1053+
#ifdef ADDRESS_SANITIZER
1054+
return true;
1055+
#else
1056+
return false;
1057+
#endif
1058+
}
1059+
1060+
bool WhiteBox::is_ubsan_enabled() {
1061+
#ifdef UNDEFINED_BEHAVIOR_SANITIZER
1062+
return true;
1063+
#else
1064+
return false;
1065+
#endif
1066+
}
1067+
10521068
bool WhiteBox::compile_method(Method* method, int comp_level, int bci, JavaThread* THREAD) {
10531069
// Screen for unavailable/bad comp level or null method
10541070
AbstractCompiler* comp = CompileBroker::compiler(comp_level);
@@ -1832,6 +1848,14 @@ WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
18321848
return (jboolean) obj_oop->mark().has_monitor();
18331849
WB_END
18341850

1851+
WB_ENTRY(jboolean, WB_IsAsanEnabled(JNIEnv* env))
1852+
return (jboolean) WhiteBox::is_asan_enabled();
1853+
WB_END
1854+
1855+
WB_ENTRY(jboolean, WB_IsUbsanEnabled(JNIEnv* env))
1856+
return (jboolean) WhiteBox::is_ubsan_enabled();
1857+
WB_END
1858+
18351859
WB_ENTRY(jboolean, WB_DeflateIdleMonitors(JNIEnv* env, jobject wb))
18361860
log_info(monitorinflation)("WhiteBox initiated DeflateIdleMonitors");
18371861
return ObjectSynchronizer::request_deflate_idle_monitors_from_wb();
@@ -2758,6 +2782,8 @@ static JNINativeMethod methods[] = {
27582782
(void*)&WB_AddModuleExportsToAll },
27592783
{CC"deflateIdleMonitors", CC"()Z", (void*)&WB_DeflateIdleMonitors },
27602784
{CC"isMonitorInflated0", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated },
2785+
{CC"isAsanEnabled", CC"()Z", (void*)&WB_IsAsanEnabled },
2786+
{CC"isUbsanEnabled", CC"()Z", (void*)&WB_IsUbsanEnabled },
27612787
{CC"forceSafepoint", CC"()V", (void*)&WB_ForceSafepoint },
27622788
{CC"forceClassLoaderStatsSafepoint", CC"()V", (void*)&WB_ForceClassLoaderStatsSafepoint },
27632789
{CC"getConstantPool0", CC"(Ljava/lang/Class;)J", (void*)&WB_GetConstantPool },

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, 2020, 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
@@ -71,6 +71,9 @@ class WhiteBox : public AllStatic {
7171
#ifdef LINUX
7272
static bool validate_cgroup(const char* proc_cgroups, const char* proc_self_cgroup, const char* proc_self_mountinfo, u1* cg_flags);
7373
#endif
74+
// provide info about enabling of Address Sanitizer / Undefined Behavior Sanitizer
75+
static bool is_asan_enabled();
76+
static bool is_ubsan_enabled();
7477
};
7578

7679
#endif // SHARE_PRIMS_WHITEBOX_HPP

test/hotspot/jtreg/TEST.ROOT

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ requires.properties= \
8383
vm.compiler1.enabled \
8484
vm.compiler2.enabled \
8585
vm.musl \
86+
vm.asan \
87+
vm.ubsan \
8688
vm.flagless \
8789
docker.support \
8890
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
@@ -36,6 +36,8 @@
3636
* @bug 8292695
3737
* @summary Check that Ctrl-\ causes HotSpot VM to print a full thread dump when signal chaining is used.
3838
* @requires os.family != "windows" & os.family != "aix"
39+
* @comment loading of the jsig lib does currently not work well with ASAN lib
40+
* @requires !vm.asan
3941
* @library /vmTestbase
4042
* /test/lib
4143
* @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
* @run driver XCheckJSig
3335
*/
3436

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")
39+
* @comment ASAN changes the memory map dump slightly, but the test has rather strict requirements
40+
* @requires !vm.asan
3941
* @modules java.base/jdk.internal.misc
4042
* java.compiler
4143
* java.management

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

Lines changed: 2 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 (os.family=="linux")
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

test/jdk/TEST.ROOT

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ requires.properties= \
9393
vm.cds.write.archived.java.heap \
9494
vm.continuations \
9595
vm.musl \
96+
vm.asan \
97+
vm.ubsan \
9698
vm.debug \
9799
vm.hasSA \
98100
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, 2022, 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)