hotspot/test/runtime/CommandLine/CompilerConfigFileWarning.java
author ccheung
Fri, 04 Oct 2013 21:00:43 -0700
changeset 20384 49bfb2ec8f8f
parent 18070 9a34d7b9556d
child 22518 e23c5545e376
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18070
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
     1
/*
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
     4
 *
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
     8
 *
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    13
 * accompanied this code).
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    14
 *
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    18
 *
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    21
 * questions.
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    22
 */
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    23
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    24
/*
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    25
 * @test
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    26
 * @bug 7167142
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    27
 * @summary Warn if unused .hotspot_compiler file is present
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    28
 * @library /testlibrary
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    29
 */
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    30
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    31
import java.io.PrintWriter;
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    32
import com.oracle.java.testlibrary.*;
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    33
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    34
public class CompilerConfigFileWarning {
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    35
    public static void main(String[] args) throws Exception {
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    36
        String vmVersion = System.getProperty("java.vm.version");
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    37
        if (vmVersion.toLowerCase().contains("debug") || vmVersion.toLowerCase().contains("jvmg")) {
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    38
            System.out.println("Skip on debug builds since we'll always read the file there");
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    39
            return;
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    40
        }
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    41
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    42
        PrintWriter pw = new PrintWriter(".hotspot_compiler");
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    43
        pw.println("aa");
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    44
        pw.close();
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    45
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    46
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-version");
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    47
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    48
        output.shouldContain("warning: .hotspot_compiler file is present but has been ignored.  Run with -XX:CompileCommandFile=.hotspot_compiler to load the file.");
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    49
    }
9a34d7b9556d 8016065: Write regression test for 7167142
ctornqvi
parents:
diff changeset
    50
}