Skip to content

Commit 116763c

Browse files
committed
8284331: Add sanity check for signal handler modification warning.
Reviewed-by: dholmes, amenkov
1 parent 95d38bb commit 116763c

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2020, 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
/*
@@ -57,6 +58,7 @@ public static void main(String[] args) throws Exception {
5758
testJcmdPid_f();
5859
testJcmdPidPerfCounterPrint();
5960
testJcmdPidBigScript();
61+
testJcmdPidVMinfo();
6062
}
6163

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

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

0 commit comments

Comments
 (0)