ProfileBootClassPathTest.java revision 2933:49d207bf704d
1109998Smarkm/* 2109998Smarkm * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. 3238405Sjkim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4109998Smarkm * 5109998Smarkm * This code is free software; you can redistribute it and/or modify it 6109998Smarkm * under the terms of the GNU General Public License version 2 only, as 7109998Smarkm * published by the Free Software Foundation. 8109998Smarkm * 9109998Smarkm * This code is distributed in the hope that it will be useful, but WITHOUT 10280304Sjkim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11109998Smarkm * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12109998Smarkm * version 2 for more details (a copy is included in the LICENSE file that 13109998Smarkm * accompanied this code). 14109998Smarkm * 15109998Smarkm * You should have received a copy of the GNU General Public License version 16109998Smarkm * 2 along with this work; if not, write to the Free Software Foundation, 17109998Smarkm * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18109998Smarkm * 19109998Smarkm * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20109998Smarkm * or visit www.oracle.com if you need additional information or have any 21109998Smarkm * questions. 22109998Smarkm */ 23109998Smarkm 24109998Smarkm/* 25109998Smarkm * @test 26109998Smarkm * @bug 8044859 27109998Smarkm * @summary test support for checking -profile and -bootclasspath 28109998Smarkm * @modules jdk.compiler/com.sun.tools.javac.api 29109998Smarkm * jdk.compiler/com.sun.tools.javac.file 30109998Smarkm * jdk.compiler/com.sun.tools.javac.main 31109998Smarkm * jdk.compiler/com.sun.tools.javac.util 32109998Smarkm * @build Tester 33109998Smarkm * @run main ProfileBootClassPathTest 34109998Smarkm */ 35109998Smarkm 36109998Smarkmimport com.sun.tools.javac.main.Main; 37109998Smarkmimport java.io.File; 38109998Smarkmimport java.io.IOException; 39109998Smarkm 40109998Smarkmpublic class ProfileBootClassPathTest extends Tester { 41109998Smarkm public static void main(String... args) throws Exception { 42109998Smarkm ProfileBootClassPathTest t = new ProfileBootClassPathTest(); 43109998Smarkm t.runTests(); 44109998Smarkm } 45109998Smarkm 46109998Smarkm @Tester.Test 47109998Smarkm void testProfileBootClassPath() throws IOException { 48109998Smarkm writeFile("C.java", "class C { }"); 49109998Smarkm 50109998Smarkm String javaHome = System.getProperty("java.home"); 51109998Smarkm String rt_jar = new File(javaHome, "jre/lib/rt.jar").getPath(); 52109998Smarkm String[] opts = { "-profile", "compact1", "-bootclasspath", rt_jar }; 53109998Smarkm String[] files = { "C.java" }; 54109998Smarkm 55109998Smarkm runMain(opts, files) 56280304Sjkim .checkResult(Main.Result.CMDERR.exitCode); 57280304Sjkim 58109998Smarkm// The API tests are disabled (for now) because Args.validate does 59109998Smarkm// not have an easy way to access/validate file manager options, 60109998Smarkm// which are handled directly by the file manager 61109998Smarkm 62109998Smarkm// runCall(opts, files) 63109998Smarkm// .checkIllegalStateException(); 64109998Smarkm 65109998Smarkm// runParse(opts, files) 66109998Smarkm// .checkIllegalStateException(); 67109998Smarkm } 68160814Ssimon} 69280304Sjkim