4556N/A/*
4556N/A * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
4556N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4556N/A *
4556N/A * This code is free software; you can redistribute it and/or modify it
4556N/A * under the terms of the GNU General Public License version 2 only, as
4556N/A * published by the Free Software Foundation.
4556N/A *
4556N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4556N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4556N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4556N/A * version 2 for more details (a copy is included in the LICENSE file that
4556N/A * accompanied this code).
4556N/A *
4556N/A * You should have received a copy of the GNU General Public License version
4556N/A * 2 along with this work; if not, write to the Free Software Foundation,
4556N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4556N/A *
4556N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4556N/A * or visit www.oracle.com if you need additional information or have any
4556N/A * questions.
4556N/A */
4556N/A
4556N/A/*
4556N/A * @test
4556N/A * @bug 7167142
4556N/A * @summary Warn if unused .hotspot_rc file is present
4556N/A * @library /testlibrary
4556N/A */
4556N/A
4556N/Aimport java.io.PrintWriter;
4556N/Aimport com.oracle.java.testlibrary.*;
4556N/A
4556N/Apublic class ConfigFileWarning {
4556N/A public static void main(String[] args) throws Exception {
4556N/A String vmVersion = System.getProperty("java.vm.version");
4556N/A if (vmVersion.toLowerCase().contains("debug") || vmVersion.toLowerCase().contains("jvmg")) {
4556N/A System.out.println("Skip on debug builds since we'll always read the file there");
4556N/A return;
4556N/A }
4556N/A
4556N/A PrintWriter pw = new PrintWriter(".hotspotrc");
4556N/A pw.println("aa");
4556N/A pw.close();
4556N/A
4556N/A ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-version");
4556N/A OutputAnalyzer output = new OutputAnalyzer(pb.start());
4556N/A output.shouldContain("warning: .hotspotrc file is present but has been ignored. Run with -XX:Flags=.hotspotrc to load the file.");
4556N/A }
4556N/A}