JDK-8216352 : SA: ClhsdbLauncher should throw errors on Unrecognized commands
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc-agent
  • Affected Version: 12,13
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • CPU: generic
  • Submitted: 2019-01-08
  • Updated: 2019-10-09
  • Resolved: 2019-10-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 14
14 b18Fixed
Related Reports
Relates :  
Description
The ClhsdbLauncher test launcher should catch unrecognized commands issued to clhsdb. Snippet from a .jtr file below when 'printmado' instead of 'printmdo' was issued to clhsdb in TestPrintMdo.java

==================================================
----------System.out:(7/221)----------
Starting TestPrintMdo test
Started LingeredApp with pid 28190
Starting clhsdb against 28190
Warning! JS Engine can't start, some commands will not be available.
hsdb> Unrecognized command.  Try help...
hsdb> 
Test PASSED
====================================================
The test passes without actually testing the command. 
Mail snippet from JC Beyler on this: 
=======================================================
I saw this typo:
http://cr.openjdk.java.net/~jgeorge/8215568/webrev.00/test/hotspot/jtreg/serviceability/sa/TestPrintMdo.java.udiff.html

+            List<String> cmds = List.of("printmado -a");

Should it not be printmdo and not printmado? does printmado exist? If it doesn't how does the test pass (my guess is that we do not catch a "unexpected command" and that the hashmaps are not finding the keys so they are not checking the expected/unexpected results; if so perhaps a follow-up should fix that an unknown command fails a test trying to do that / and perhaps if the key is not found, the test fails as well?)
=====================================================





Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/13f29c43b6c7 User: rpatil Date: 2019-10-04 06:56:18 +0000
04-10-2019

If the typo is only made in the cmds, then it will not match the key in the expected and unexpected strings. See ClhsdbLauncher.runCmd(). One way to fulfill the intent of this bug is to add a special case check in runCmd() diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java @@ -140,6 +140,7 @@ for (String cmd : commands) { int index = commands.indexOf(cmd) + 1; OutputAnalyzer out = new OutputAnalyzer(parts[index]); + out.shouldNotMatch("Unrecognized command."); if (expectedStrMap != null) { List<String> expectedStr = expectedStrMap.get(cmd);
26-06-2019