test/hotspot/jtreg/runtime/CommandLine/DoubleFlagWithIntegerValue.java
author epavlova
Thu, 20 Jun 2019 11:42:33 -0700
changeset 55455 76647c08ce0c
parent 47216 71c04702a3d5
permissions -rw-r--r--
8225684: [AOT] vmTestbase/vm/oom/production/AlwaysOOMProduction tests fail with AOTed java.base Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46377
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
     1
/*
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
     4
 *
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
     7
 * published by the Free Software Foundation.
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
     8
 *
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    13
 * accompanied this code).
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    14
 *
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    18
 *
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    21
 * questions.
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    22
 */
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    23
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    24
/*
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    25
 * @test DoubleFlagWithIntegerValue
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    26
 * @bug 8178364
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    27
 * @summary Command-line flags of type double should accept integer values
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    28
 * @library /test/lib
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    29
 * @modules java.base/jdk.internal.misc
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    30
 *          java.management
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    31
 */
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    32
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    33
import jdk.test.lib.process.ProcessTools;
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    34
import jdk.test.lib.process.OutputAnalyzer;
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    35
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    36
public class DoubleFlagWithIntegerValue {
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    37
  public static void testDoubleFlagWithValue(String value) throws Exception {
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    38
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:G1ConcMarkStepDurationMillis=" + value, "-version");
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    39
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    40
    output.shouldNotContain("Improperly specified VM option");
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    41
    output.shouldHaveExitValue(0);
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    42
  }
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    43
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    44
  public static void main(String[] args) throws Exception {
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    45
    // Test double format
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    46
    testDoubleFlagWithValue("10.0");
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    47
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    48
    // Test integer format
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    49
    testDoubleFlagWithValue("10");
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    50
  }
e2660702788f 8178364: Command-line flags of type double should accept integer values
pliden
parents:
diff changeset
    51
}