< prev index next >
test/jdk/sun/tools/jcmd/TestJcmdDefaults.java
Print this page
rev 48495 : 8189102: All tools should support -?, -h and --help
Reviewed-by: kvn, jjg, weijun, alanb, rfield, ksrini
*** 1,7 ****
/*
! * Copyright (c) 2011, 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2011, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 50,73 ****
private static final String TEST_SRC = System.getProperty("test.src").trim();
private static final String[] VM_ARGS = new String[] { "-XX:+UsePerfData" };
private static final String JCMD_LIST_REGEX = "(?s)^\\d+\\s*.*";
public static void main(String[] args) throws Exception {
testJcmdUsage("-h");
! testJcmdUsage("-help");
testJcmdDefaults();
testJcmdDefaults("-l");
}
/**
* jcmd -J-XX:+UsePerfData -h
! * jcmd -J-XX:+UsePerfData -help
*/
private static void testJcmdUsage(String... jcmdArgs) throws Exception {
OutputAnalyzer output = JcmdBase.jcmdNoPid(VM_ARGS, jcmdArgs);
! assertNotEquals(output.getExitValue(), 0);
verifyOutputAgainstFile(output);
}
/**
* jcmd -J-XX:+UsePerfData
--- 50,75 ----
private static final String TEST_SRC = System.getProperty("test.src").trim();
private static final String[] VM_ARGS = new String[] { "-XX:+UsePerfData" };
private static final String JCMD_LIST_REGEX = "(?s)^\\d+\\s*.*";
public static void main(String[] args) throws Exception {
+ testJcmdUsage("-?");
testJcmdUsage("-h");
! testJcmdUsage("--help");
testJcmdDefaults();
testJcmdDefaults("-l");
}
/**
+ * jcmd -J-XX:+UsePerfData -?
* jcmd -J-XX:+UsePerfData -h
! * jcmd -J-XX:+UsePerfData --help
*/
private static void testJcmdUsage(String... jcmdArgs) throws Exception {
OutputAnalyzer output = JcmdBase.jcmdNoPid(VM_ARGS, jcmdArgs);
! assertEquals(output.getExitValue(), 0);
verifyOutputAgainstFile(output);
}
/**
* jcmd -J-XX:+UsePerfData
< prev index next >