8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach

Reviewed-by: jgeorge, cjplummer
This commit is contained in:
Goetz Lindenmaier 2018-06-25 23:04:21 +02:00
parent 434c9e90bf
commit 991f2f8c0b
60 changed files with 195 additions and 264 deletions

View File

@ -40,6 +40,7 @@ requires.extraPropDefns.vmOpts = -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
requires.properties= \
sun.arch.data.model \
vm.simpleArch \
vm.bits \
vm.flightRecorder \
vm.gc.G1 \
vm.gc.Serial \
@ -51,6 +52,8 @@ requires.properties= \
vm.emulatedClient \
vm.cpu.features \
vm.debug \
vm.hasSA \
vm.hasSAandCanAttach \
vm.rtm.cpu \
vm.rtm.os \
vm.aot \

View File

@ -40,11 +40,6 @@ public class SABase extends CiReplayBase {
private static final String REPLAY_FILE_COPY = "replay_vm.txt";
public static void main(String args[]) throws Exception {
if (!Platform.shouldSAAttach()) {
System.out.println("SA attach not expected to work - test skipped.");
return;
}
checkSetLimits();
new SABase(args).runTest(/* needCoreDump = */ true, args);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, 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,7 +26,7 @@
* @bug 8011675
* @library / /test/lib
* @summary testing of ciReplay with using generated by SA replay.txt
* @requires vm.flightRecorder != true & vm.compMode != "Xint" & vm.debug == true & vm.flavor == "client"
* @requires vm.hasSAandCanAttach & vm.flightRecorder != true & vm.compMode != "Xint" & vm.debug == true & vm.flavor == "client"
* @modules java.base/jdk.internal.misc
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, 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,7 +26,7 @@
* @bug 8011675
* @library / /test/lib
* @summary testing of ciReplay with using generated by SA replay.txt
* @requires vm.flightRecorder != true & vm.compMode != "Xint" & vm.debug == true & vm.flavor == "server"
* @requires vm.hasSAandCanAttach & vm.flightRecorder != true & vm.compMode != "Xint" & vm.debug == true & vm.flavor == "server"
* @modules java.base/jdk.internal.misc
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2018, 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
@ -21,11 +21,11 @@
* questions.
*/
/*
/**
* @test CompressedClassSpaceSizeInJmapHeap
* @bug 8004924
* @summary Checks that jmap -heap contains the flag CompressedClassSpaceSize
* @requires vm.opt.final.UseCompressedOops
* @requires vm.hasSAandCanAttach & vm.opt.final.UseCompressedOops
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
@ -48,10 +48,6 @@ public class CompressedClassSpaceSizeInJmapHeap {
// Compressed Class Space is only available on 64-bit JVMs
return;
}
if (!Platform.shouldSAAttach()) {
System.out.println("SA attach not expected to work - test skipped.");
return;
}
String pid = Long.toString(ProcessTools.getProcessId());

View File

@ -24,7 +24,7 @@
/**
* @test SASymbolTableTest
* @summary Walk symbol table using SA, with and without CDS.
* @requires vm.cds
* @requires vm.cds & vm.hasSAandCanAttach
* @library /test/lib
* @modules java.base/jdk.internal.misc
* jdk.hotspot.agent/sun.jvm.hotspot.oops
@ -59,11 +59,6 @@ public class SASymbolTableTest {
public static void main(String[] args) throws Exception {
if (!Platform.shouldSAAttach()) {
System.out.println("SA attach not expected to work - test skipped.");
return;
}
CDSTestUtils.createArchiveAndCheck();
run(true);
run(false);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -27,10 +27,11 @@ import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
/*
/**
* @test
* @bug 8191658
* @summary Test clhsdb attach, detach, reattach commands
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbAttach
*/

View File

@ -21,11 +21,12 @@
* questions.
*/
/*
/**
* @test
* @bug 8174994
* @summary Test the clhsdb commands 'printmdo', 'printall' on a CDS enabled corefile.
* @requires vm.cds
* @requires vm.hasSA
* @requires os.family != "windows"
* @requires vm.flavor == "server"
* @library /test/lib

View File

@ -21,11 +21,11 @@
* questions.
*/
/*
/**
* @test
* @bug 8174994
* @summary Test the clhsdb commands 'jstack', 'printall', 'where' with CDS enabled
* @requires vm.cds
* @requires vm.hasSA & vm.cds
* @library /test/lib
* @run main/othervm/timeout=2400 -Xmx1g ClhsdbCDSJstackPrintAll
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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,10 +26,11 @@ import java.util.List;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
/*
/**
* @test
* @bug 8191538
* @summary Test clhsdb 'field' command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbField
*/

View File

@ -28,10 +28,11 @@ import java.util.ArrayList;
import jdk.test.lib.apps.LingeredApp;
/*
/**
* @test
* @bug 8193124
* @summary Test the clhsdb 'findpc' command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbFindPC
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -30,10 +30,11 @@ import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
/*
/**
* @test
* @bug 8190198
* @summary Test clhsdb flags command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbFlags
*/

View File

@ -27,10 +27,11 @@ import java.util.Map;
import java.util.ArrayList;
import jdk.test.lib.apps.LingeredApp;
/*
/**
* @test
* @bug 8192985
* @summary Test the clhsdb 'inspect' command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbInspect
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -28,10 +28,11 @@ import java.util.ArrayList;
import jdk.test.lib.apps.LingeredApp;
/*
/**
* @test
* @bug 8193124
* @summary Test the clhsdb 'jdis' command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbJdis
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -29,10 +29,11 @@ import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Utils;
/*
/**
* @test
* @bug 8191658
* @summary Test clhsdb jhisto command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbJhisto
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -28,10 +28,11 @@ import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
/*
/**
* @test
* @bug 8190198
* @summary Test clhsdb Jstack command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbJstack
*/

View File

@ -28,10 +28,11 @@ import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
/*
/**
* @test
* @bug 8190198
* @summary Test clhsdb longConstant command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbLongConstant
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -28,10 +28,11 @@ import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
/*
/**
* @test
* @bug 8190198
* @summary Test clhsdb pmap command
* @requires vm.hasSA
* @library /test/lib
* @requires os.family != "mac"
* @run main/othervm ClhsdbPmap

View File

@ -26,10 +26,11 @@ import java.util.List;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
/*
/**
* @test
* @bug 8175384
* @summary Test clhsdb 'printall' command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm/timeout=2400 -Xmx1g ClhsdbPrintAll
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -27,10 +27,11 @@ import java.util.Map;
import java.util.ArrayList;
import jdk.test.lib.apps.LingeredApp;
/*
/**
* @test
* @bug 8192985
* @summary Test the clhsdb 'printas' command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbPrintAs
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -28,10 +28,11 @@ import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
/*
/**
* @test
* @bug 8190198
* @summary Test clhsdb printstatics command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbPrintStatics
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -28,12 +28,12 @@ import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
/*
/**
* @test
* @bug 8190198
* @summary Test clhsdb pstack command
* @requires vm.hasSA & os.family != "mac"
* @library /test/lib
* @requires os.family != "mac"
* @run main/othervm ClhsdbPstack
*/

View File

@ -27,12 +27,12 @@ import java.util.ArrayList;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
/*
/**
* @test
* @bug 8175312
* @summary Test clhsdb 'g1regiondetails' and 'scanoops' commands for G1GC
* @requires vm.hasSA & (vm.bits == "64" & os.maxMemory > 8g)
* @library /test/lib
* @requires (vm.bits == "64" & os.maxMemory > 8g)
* @run main/othervm/timeout=2400 ClhsdbRegionDetailsScanOopsForG1
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -28,10 +28,11 @@ import java.util.ArrayList;
import jdk.test.lib.Utils;
import jdk.test.lib.apps.LingeredApp;
/*
/**
* @test
* @bug 8192985
* @summary Test the clhsdb 'scanoops' command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm/timeout=1200 ClhsdbScanOops
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -30,10 +30,11 @@ import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
/*
/**
* @test
* @bug 8192823
* @summary Test clhsdb source command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbSource
*/

View File

@ -28,10 +28,11 @@ import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
/*
/**
* @test
* @bug 8190198
* @summary Test clhsdb symboldump command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbSymbol
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -27,10 +27,11 @@ import java.util.Map;
import java.util.ArrayList;
import jdk.test.lib.apps.LingeredApp;
/*
/**
* @test
* @bug 8191538
* @summary Test the clhsdb 'symboltable' and 'symbol' commands
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbSymbolTable
*/

View File

@ -26,10 +26,11 @@ import java.util.List;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
/*
/**
* @test
* @bug 8193352
* @summary Test clhsdb 'thread' and 'threads' commands
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbThread
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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,10 +26,11 @@ import java.util.List;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
/*
/**
* @test
* @bug 8191538
* @summary Test clhsdb 'vmstructsdump' command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbVmStructsDump
*/

View File

@ -28,10 +28,11 @@ import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
/*
/**
* @test
* @bug 8190198
* @summary Test clhsdb where command
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbWhere
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -35,9 +35,10 @@ import jdk.test.lib.JDKToolLauncher;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
/*
/**
* @test
* @summary Test deadlock detection
* @requires vm.hasSAandCanAttach
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules java.management
@ -69,14 +70,6 @@ public class DeadlockDetectionTest {
public static void main(String[] args) throws Exception {
System.out.println("Starting DeadlockDetectionTest");
if (!Platform.shouldSAAttach()) {
// Silently skip the test if we don't have enough permissions to attach
// Not all conditions checked by function is relevant to SA but it's worth
// to check
System.err.println("Error! Insufficient permissions to attach.");
return;
}
if (Platform.isOSX()) {
// Coredump stackwalking is not implemented for Darwin
System.out.println("This test is not expected to work on OS X. Skipping");

View File

@ -32,18 +32,15 @@ import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
/*
/**
* @test
* @requires vm.hasSAandCanAttach
* @library /test/lib
* @run main JhsdbThreadInfoTest
*/
public class JhsdbThreadInfoTest {
public static void main(String[] args) throws Exception {
if (!Platform.shouldSAAttach()) {
System.out.println("SA attach not expected to work - test skipped.");
return;
}
LingeredApp app = null;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -30,10 +30,11 @@ import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
/*
/**
* @test
* @bug 8184982
* @summary Test ClassDump tool
* @requires vm.hasSAandCanAttach
* @library /test/lib
* @run main/othervm TestClassDump
*/
@ -82,12 +83,6 @@ public class TestClassDump {
}
public static void main(String[] args) throws Exception {
if (!Platform.shouldSAAttach()) {
// Silently skip the test if we don't have enough permissions to attach
System.out.println("SA attach not expected to work - test skipped.");
return;
}
LingeredApp theApp = null;
try {
theApp = LingeredApp.startApp();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -36,8 +36,9 @@ import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.Asserts;
/*
/**
* @test
* @requires vm.hasSAandCanAttach
* @library /test/lib
* @run main/othervm TestClhsdbJstackLock
*/
@ -145,11 +146,6 @@ public class TestClhsdbJstackLock {
LingeredApp app = null;
if (!Platform.shouldSAAttach()) {
System.out.println("SA attach not expected to work - test skipped.");
return;
}
try {
List<String> vmArgs = new ArrayList<String>(Utils.getVmOptions());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, 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
@ -41,10 +41,10 @@ import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.Asserts;
/*
/**
* @test
* @library /test/lib
* @requires os.family != "mac"
* @requires vm.hasSAandCanAttach & os.family != "mac"
* @modules java.base/jdk.internal.misc
* jdk.hotspot.agent/sun.jvm.hotspot
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
@ -120,12 +120,6 @@ public class TestCpoolForInvokeDynamic {
"LingeredAppWithInvokeDynamic"
};
if (!Platform.shouldSAAttach()) {
System.out.println(
"SA attach not expected to work - test skipped.");
return;
}
if (args == null || args.length == 0) {
try {
List<String> vmArgs = new ArrayList<String>();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -40,10 +40,10 @@ import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.Asserts;
/*
/**
* @test
* @library /test/lib
* @requires os.family != "mac"
* @requires vm.hasSAandCanAttach & os.family != "mac"
* @modules java.base/jdk.internal.misc
* jdk.hotspot.agent/sun.jvm.hotspot
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
@ -131,12 +131,6 @@ public class TestDefaultMethods {
"SlytherinSpeak"
};
if (!Platform.shouldSAAttach()) {
System.out.println(
"SA attach not expected to work - test skipped.");
return;
}
if (args == null || args.length == 0) {
try {
List<String> vmArgs = new ArrayList<String>();

View File

@ -36,10 +36,10 @@ import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.Utils;
/*
/**
* @test
* @library /test/lib
* @requires os.family != "mac"
* @requires vm.hasSAandCanAttach & os.family != "mac"
* @requires vm.gc.G1
* @modules jdk.hotspot.agent/sun.jvm.hotspot
* jdk.hotspot.agent/sun.jvm.hotspot.gc.g1
@ -88,12 +88,6 @@ public class TestG1HeapRegion {
}
public static void main (String... args) throws Exception {
if (!Platform.shouldSAAttach()) {
System.out.println(
"SA attach not expected to work - test skipped.");
return;
}
if (args == null || args.length == 0) {
try {
List<String> vmArgs = new ArrayList<String>();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, 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
@ -46,10 +46,10 @@ import jdk.test.lib.hprof.parser.HprofReader;
import jdk.test.lib.hprof.parser.PositionDataInputStream;
import jdk.test.lib.hprof.model.Snapshot;
/*
/**
* @test
* @library /test/lib
* @requires os.family != "mac"
* @requires vm.hasSAandCanAttach & os.family != "mac"
* @modules java.base/jdk.internal.misc
* jdk.hotspot.agent/sun.jvm.hotspot
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
@ -115,12 +115,6 @@ public class TestHeapDumpForInvokeDynamic {
String heapDumpFileName = "lambdaHeapDump.bin";
if (!Platform.shouldSAAttach()) {
System.out.println(
"SA attach not expected to work - test skipped.");
return;
}
File heapDumpFile = new File(heapDumpFileName);
if (heapDumpFile.exists()) {
heapDumpFile.delete();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -42,11 +42,11 @@ import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.Asserts;
/*
/**
* @test
* @library /test/lib
* @bug 8171084
* @requires (vm.bits == "64" & os.maxMemory > 8g)
* @requires vm.hasSAandCanAttach & (vm.bits == "64" & os.maxMemory > 8g)
* @modules java.base/jdk.internal.misc
* jdk.hotspot.agent/sun.jvm.hotspot
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
@ -89,12 +89,6 @@ public class TestHeapDumpForLargeArray {
String heapDumpFileName = "LargeArrayHeapDump.bin";
if (!Platform.shouldSAAttach()) {
System.out.println(
"SA attach not expected to work - test skipped.");
return;
}
File heapDumpFile = new File(heapDumpFileName);
if (heapDumpFile.exists()) {
heapDumpFile.delete();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -41,9 +41,10 @@ import jdk.test.lib.Asserts;
import java.io.*;
import java.util.*;
/*
/**
* @test
* @library /test/lib
* @requires vm.hasSAandCanAttach
* @modules java.base/jdk.internal.misc
* jdk.hotspot.agent/sun.jvm.hotspot
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
@ -174,11 +175,6 @@ public class TestInstanceKlassSize {
public static void main(String[] args) throws Exception {
if (!Platform.shouldSAAttach()) {
System.out.println("SA attach not expected to work - test skipped.");
return;
}
if (args == null || args.length == 0) {
System.out.println ("No args run. Starting with args now.");
startMeWithArgs();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -38,9 +38,10 @@ import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.Asserts;
/*
/**
* @test
* @library /test/lib
* @requires vm.hasSAandCanAttach
* @modules java.base/jdk.internal.misc
* jdk.hotspot.agent/sun.jvm.hotspot
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
@ -152,12 +153,6 @@ public class TestInstanceKlassSizeForInterface {
"LingeredAppWithInterface$1"
};
if (!Platform.shouldSAAttach()) {
System.out.println(
"SA attach not expected to work - test skipped.");
return;
}
if (args == null || args.length == 0) {
try {
List<String> vmArgs = new ArrayList<String>();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -32,10 +32,11 @@ import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
/*
/**
* @test
* @summary Test the 'intConstant' command of jhsdb clhsdb.
* @bug 8190307
* @requires vm.hasSAandCanAttach
* @library /test/lib
* @build jdk.test.lib.apps.*
* @run main/othervm TestIntConstant
@ -129,12 +130,6 @@ public class TestIntConstant {
public static void main (String... args) throws Exception {
if (!Platform.shouldSAAttach()) {
System.out.println(
"SA attach not expected to work - test skipped.");
return;
}
try {
testIntConstant();
} catch (Exception e) {

View File

@ -37,8 +37,9 @@ import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.Utils;
/*
/**
* @test
* @requires vm.hasSAandCanAttach
* @library /test/lib
* @run main/othervm TestJhsdbJstackLock
*/
@ -49,11 +50,6 @@ public class TestJhsdbJstackLock {
LingeredApp app = null;
if (!Platform.shouldSAAttach()) {
System.out.println("SA attach not expected to work - test skipped.");
return;
}
try {
List<String> vmArgs = new ArrayList<String>(Utils.getVmOptions());

View File

@ -21,9 +21,10 @@
* questions.
*/
/*
/**
* @test TestJmapCore
* @summary Test verifies that jhsdb jmap could generate heap dump from core when heap is full
* @requires vm.hasSA
* @library /test/lib
* @run driver/timeout=240 TestJmapCore run heap
*/

View File

@ -21,9 +21,10 @@
* questions.
*/
/*
/**
* @test TestJmapCoreMetaspace
* @summary Test verifies that jhsdb jmap could generate heap dump from core when metspace is full
* @requires vm.hasSA
* @library /test/lib
* @run driver/timeout=240 TestJmapCore run metaspace
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -36,9 +36,10 @@ import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.Asserts;
/*
/**
* @test
* @library /test/lib
* @requires vm.hasSAandCanAttach
* @requires vm.flavor == "server" & !vm.emulatedClient & !(vm.opt.TieredStopAtLevel == 1)
* @build jdk.test.lib.apps.*
* @run main/othervm TestPrintMdo
@ -148,12 +149,6 @@ public class TestPrintMdo {
LingeredApp app = null;
if (!Platform.shouldSAAttach()) {
System.out.println(
"SA attach not expected to work - test skipped.");
return;
}
try {
List<String> vmArgs = new ArrayList<String>();
vmArgs.add("-XX:+ProfileInterpreter");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -36,10 +36,10 @@ import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.Utils;
/*
/**
* @test
* @library /test/lib
* @requires os.family != "mac"
* @requires vm.hasSAandCanAttach & os.family != "mac"
* @modules java.base/jdk.internal.misc
* jdk.hotspot.agent/sun.jvm.hotspot
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
@ -80,12 +80,6 @@ public class TestRevPtrsForInvokeDynamic {
}
public static void main (String... args) throws Exception {
if (!Platform.shouldSAAttach()) {
System.out.println(
"SA attach not expected to work - test skipped.");
return;
}
if (args == null || args.length == 0) {
try {
List<String> vmArgs = new ArrayList<String>();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -32,10 +32,11 @@ import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
/*
/**
* @test
* @summary Test the 'type' command of jhsdb clhsdb.
* @bug 8190307
* @requires vm.hasSAandCanAttach
* @library /test/lib
* @build jdk.test.lib.apps.*
* @run main/othervm TestType
@ -95,12 +96,6 @@ public class TestType {
public static void main (String... args) throws Exception {
LingeredApp app = null;
if (!Platform.shouldSAAttach()) {
System.out.println(
"SA attach not expected to work - test skipped.");
return;
}
try {
List<String> vmArgs = new ArrayList<String>();
vmArgs.addAll(Utils.getVmOptions());

View File

@ -33,10 +33,10 @@ import jdk.test.lib.JDKToolLauncher;
import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
/*
/**
* @test
* @summary Test the 'universe' command of jhsdb clhsdb.
* @requires vm.gc != "Z"
* @requires vm.hasSAandCanAttach & vm.gc != "Z"
* @bug 8190307
* @library /test/lib
* @build jdk.test.lib.apps.*
@ -45,10 +45,10 @@ import jdk.test.lib.process.OutputAnalyzer;
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestUniverse withoutZ
*/
/*
/**
* @test
* @summary Test the 'universe' command of jhsdb clhsdb.
* @requires vm.gc == "Z"
* @requires vm.hasSAandCanAttach & vm.gc == "Z"
* @bug 8190307
* @library /test/lib
* @build jdk.test.lib.apps.*
@ -147,13 +147,6 @@ public class TestUniverse {
public static void main (String... args) throws Exception {
if (!Platform.shouldSAAttach()) {
System.out.println(
"SA attach not expected to work - test skipped.");
return;
}
try {
test("-XX:+UseG1GC");
test("-XX:+UseParallelGC");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2018, 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
@ -37,10 +37,11 @@ import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
/*
/**
* @test
* @bug 6313383
* @key regression
* @requires vm.hasSAandCanAttach
* @summary Regression test for hprof export issue due to large heaps (>2G)
* @library /test/lib
* @modules java.base/jdk.internal.misc
@ -58,10 +59,6 @@ public class JMapHProfLargeHeapTest {
private static final long G = 1024L * M;
public static void main(String[] args) throws Exception {
if (!Platform.shouldSAAttach()) {
System.out.println("SA attach not expected to work - test skipped.");
return;
}
// All heap dumps should create 1.0.2 file format
testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_2);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, 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
@ -21,15 +21,17 @@
* questions.
*/
/*
/**
* @test
* @summary Checks that the jshdb debugd utility sucessfully starts
* and tries to attach to a running process
* @requires vm.hasSAandCanAttach
* @modules java.base/jdk.internal.misc
* @library /test/lib
*
* @run main/othervm SADebugDTest
*/
import java.io.File;
import java.util.concurrent.CountDownLatch;
import java.io.InputStreamReader;
@ -38,7 +40,6 @@ import java.io.Reader;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import static jdk.test.lib.Asserts.assertTrue;
import static jdk.test.lib.Platform.shouldSAAttach;
import static jdk.test.lib.process.ProcessTools.startProcess;
public class SADebugDTest {
@ -55,11 +56,6 @@ public class SADebugDTest {
public static void main(String[] args) throws Exception {
if (!shouldSAAttach()) {
log("Not possible to attach the SA. Skipping the test");
return;
}
long ourPid = ProcessHandle.current().pid();
// The string we are expecting in the debugd ouput

View File

@ -51,7 +51,7 @@ public class TestMutuallyExclusivePlatformPredicates {
VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero", "isEmbedded"),
MODE("isInt", "isMixed", "isComp"),
IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild", "isSlowDebugBuild",
"shouldSAAttach", "isTieredSupported", "areCustomLoadersSupportedForCDS");
"hasSA", "shouldSAAttach", "isTieredSupported", "areCustomLoadersSupportedForCDS");
public final List<String> methodNames;

View File

@ -40,6 +40,8 @@ requires.properties= \
vm.gc.Z \
vm.graal.enabled \
vm.cds \
vm.hasSA \
vm.hasSAandCanAttach \
docker.support \
release.implementor

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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
@ -21,10 +21,11 @@
* questions.
*/
/*
/**
* @test
* @bug 8030750
* @summary Test alternate hashing of strings in Serviceability Agent.
* @requires vm.hasSAandCanAttach
* @library /test/lib
* @library /lib/testlibrary
* @compile AlternateHashingTest.java
@ -111,13 +112,6 @@ public class AlternateHashingTest {
public static void main(String[] args) throws Exception {
if (!Platform.shouldSAAttach()) {
// Silently skip the test if we don't have enough permissions to attach
System.err.println("Error! Insufficient permissions to attach - test skipped.");
return;
}
testAltHashing();
// The test throws RuntimeException on error.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -21,11 +21,12 @@
* questions.
*/
/*
/**
* @test
* @summary Basic test for jhsdb launcher
* @library /test/lib
* @library /lib/testlibrary
* @requires vm.hasSAandCanAttach
* @build jdk.testlibrary.*
* @build jdk.test.lib.apps.*
* @run main BasicLauncherTest
@ -200,12 +201,6 @@ public class BasicLauncherTest {
public static void main(String[] args) throws Exception {
if (!Platform.shouldSAAttach()) {
// Silently skip the test if we don't have enough permissions to attach
System.err.println("Error! Insufficient permissions to attach.");
return;
}
launchCLHSDB();
launch("compiler detected", null, "jmap", "--clstats");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, 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
@ -21,10 +21,11 @@
* questions.
*/
/*
/**
* @test
* @bug 8163346
* @summary Test hashing of extended characters in Serviceability Agent.
* @requires vm.hasSAandCanAttach
* @library /test/lib
* @library /lib/testlibrary
* @compile -encoding utf8 HeapDumpTest.java
@ -125,13 +126,6 @@ public class HeapDumpTest {
public static void main(String[] args) throws Exception {
if (!Platform.shouldSAAttach()) {
// Silently skip the test if we don't have enough permissions to attach
System.err.println("Error! Insufficient permissions to attach - test skipped.");
return;
}
testHeapDump();
// The test throws RuntimeException on error.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -32,11 +32,12 @@ import jdk.test.lib.apps.LingeredApp;
import jdk.testlibrary.Utils;
import jdk.test.lib.Platform;
/*
/**
* @test
* @bug 8042397
* @summary Unit test for jmap utility test heap configuration reader
*
* @requires vm.hasSAandCanAttach
* @library /test/lib
* @library /lib/testlibrary
* @modules java.management
@ -119,12 +120,6 @@ public class JMapHeapConfigTest {
public static void main(String[] args) throws Exception {
System.out.println("Starting JMapHeapConfigTest");
if (!Platform.shouldSAAttach()) {
// Silently skip the test if we don't have enough permissions to attach
System.err.println("Error! Insufficient permissions to attach.");
return;
}
if (!LingeredApp.isLastModifiedWorking()) {
// Exact behaviour of the test depends to operating system and the test nature,
// so just print the warning and continue

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -34,9 +34,10 @@ import jdk.testlibrary.JDKToolLauncher;
import jdk.testlibrary.OutputAnalyzer;
import jdk.testlibrary.ProcessTools;
/*
/**
* @test
* @summary Test deadlock detection
* @requires vm.hasSAandCanAttach
* @library /test/lib
* @library /lib/testlibrary
* @build jdk.testlibrary.*
@ -69,12 +70,6 @@ public class DeadlockDetectionTest {
public static void main(String[] args) throws Exception {
System.out.println("Starting DeadlockDetectionTest");
if (!Platform.shouldSAAttach()) {
// Silently skip the test if we don't have enough permissions to attach
System.err.println("Error! Insufficient permissions to attach.");
return;
}
if (!LingeredApp.isLastModifiedWorking()) {
// Exact behaviour of the test depends on operating system and the test nature,
// so just print the warning and continue

View File

@ -73,6 +73,12 @@ public class VMProps implements Callable<Map<String, String>> {
map.put("vm.debug", vmDebug());
map.put("vm.jvmci", vmJvmci());
map.put("vm.emulatedClient", vmEmulatedClient());
// vm.hasSA is "true" if the VM contains the serviceability agent
// and jhsdb.
map.put("vm.hasSA", vmHasSA());
// vm.hasSAandCanAttach is "true" if the VM contains the serviceability agent
// and jhsdb and it can attach to the VM.
map.put("vm.hasSAandCanAttach", vmHasSAandCanAttach());
map.put("vm.cpu.features", cpuFeatures());
map.put("vm.rtm.cpu", vmRTMCPU());
map.put("vm.rtm.os", vmRTMOS());
@ -258,6 +264,28 @@ public class VMProps implements Callable<Map<String, String>> {
vmOptFinalFlag(map, "UseCompressedOops");
}
/**
* @return "true" if VM has a serviceability agent.
*/
protected String vmHasSA() {
return "" + Platform.hasSA();
}
/**
* @return "true" if VM has a serviceability agent and it can
* attach to the VM.
*/
protected String vmHasSAandCanAttach() {
try {
return "" + Platform.shouldSAAttach();
} catch (IOException e) {
System.out.println("Checking whether SA can attach to the VM failed.");
e.printStackTrace();
// Run the tests anyways.
return "true";
}
}
/**
* @return true if VM runs RTM supported OS and false otherwise.
*/

View File

@ -252,16 +252,29 @@ public class Platform {
}
/**
* Return a boolean for whether we expect to be able to attach
* the SA to our own processes on this system.
* Return a boolean for whether SA and jhsdb are ported/available
* on this platform.
*/
public static boolean shouldSAAttach() throws IOException {
public static boolean hasSA() {
if (isAix()) {
return false; // SA not implemented.
} else if (isLinux()) {
if (isS390x()) {
return false; // SA not implemented.
}
}
// Other platforms expected to work:
return true;
}
/**
* Return a boolean for whether we expect to be able to attach
* the SA to our own processes on this system. This requires
* that SA is ported/available on this platform.
*/
public static boolean shouldSAAttach() throws IOException {
if (!hasSA()) return false;
if (isLinux()) {
return canPtraceAttachLinux();
} else if (isOSX()) {
return canAttachOSX();