Skip to content

Commit f993ef5

Browse files
Sonia Zaldana CallesGoeLin
Sonia Zaldana Calles
authored andcommitted
8284331: Add sanity check for signal handler modification warning.
Backport-of: 116763cb5d58a7316b7bada689a0fa34a7250ee7
1 parent 92c5062 commit f993ef5

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

test/jdk/sun/tools/jcmd/TestJcmdSanity.java

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2022, 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
@@ -32,6 +32,7 @@
3232

3333
import jdk.test.lib.process.OutputAnalyzer;
3434
import jdk.test.lib.process.ProcessTools;
35+
import jdk.test.lib.Platform;
3536
import jdk.test.lib.Utils;
3637

3738
/*
@@ -59,6 +60,7 @@ public static void main(String[] args) throws Exception {
5960
testJcmdPid_f();
6061
testJcmdPidPerfCounterPrint();
6162
testJcmdPidBigScript();
63+
testJcmdPidVMinfo();
6264
}
6365

6466
/**
@@ -166,4 +168,21 @@ private static void verifyOutputAgainstFile(OutputAnalyzer output) throws IOExce
166168
"The ouput should contain all content of " + path.toAbsolutePath());
167169
}
168170

171+
/**
172+
* Sanity check for VM.info
173+
*/
174+
private static void testJcmdPidVMinfo() throws Exception {
175+
OutputAnalyzer output = JcmdBase.jcmd(VM_ARGS, new String[] {"VM.info"});
176+
output.shouldHaveExitValue(0);
177+
output.shouldContain(Long.toString(ProcessTools.getProcessId()) + ":");
178+
179+
// Should find the signal handler summary (except on Windows):
180+
if (!Platform.isWindows()) {
181+
output.shouldContain("Signal Handlers:");
182+
// Should not find any of the possible signal handler modification warnings:
183+
output.shouldNotContain(" handler modified!"); // e.g. Warning: SIGILL handler modified!
184+
output.shouldNotContain("*** Handler was modified!");
185+
output.shouldNotContain("*** Expected: "); // e.g. *** Expected: javaSignalHandler in ...
186+
}
187+
}
169188
}

0 commit comments

Comments
 (0)