8284331: Add sanity check for signal handler modification warning.

Reviewed-by: dholmes, amenkov
This commit is contained in:
Kevin Walls 2022-04-29 20:14:55 +00:00
parent 95d38bbd6b
commit 116763cb5d

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2022, 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,6 +32,7 @@ import java.util.List;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
/*
@ -57,6 +58,7 @@ public class TestJcmdSanity {
testJcmdPid_f();
testJcmdPidPerfCounterPrint();
testJcmdPidBigScript();
testJcmdPidVMinfo();
}
/**
@ -164,4 +166,21 @@ public class TestJcmdSanity {
"The ouput should contain all content of " + path.toAbsolutePath());
}
/**
* Sanity check for VM.info
*/
private static void testJcmdPidVMinfo() throws Exception {
OutputAnalyzer output = JcmdBase.jcmd(VM_ARGS, new String[] {"VM.info"});
output.shouldHaveExitValue(0);
output.shouldContain(Long.toString(ProcessTools.getProcessId()) + ":");
// Should find the signal handler summary (except on Windows):
if (!Platform.isWindows()) {
output.shouldContain("Signal Handlers:");
// Should not find any of the possible signal handler modification warnings:
output.shouldNotContain(" handler modified!"); // e.g. Warning: SIGILL handler modified!
output.shouldNotContain("*** Handler was modified!");
output.shouldNotContain("*** Expected: "); // e.g. *** Expected: javaSignalHandler in ...
}
}
}