CompileCircularSources.java revision 3219:aacc4ceb35c9
1249592Sken/* 2249592Sken * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. 3249592Sken * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4249592Sken * 5249592Sken * This code is free software; you can redistribute it and/or modify it 6249592Sken * under the terms of the GNU General Public License version 2 only, as 7249592Sken * published by the Free Software Foundation. 8249592Sken * 9249592Sken * This code is distributed in the hope that it will be useful, but WITHOUT 10249592Sken * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11249592Sken * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12249592Sken * version 2 for more details (a copy is included in the LICENSE file that 13249592Sken * accompanied this code). 14249592Sken * 15249592Sken * You should have received a copy of the GNU General Public License version 16249592Sken * 2 along with this work; if not, write to the Free Software Foundation, 17249592Sken * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18249592Sken * 19249592Sken * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20249592Sken * or visit www.oracle.com if you need additional information or have any 21249592Sken * questions. 22249592Sken */ 23249592Sken 24249592Sken/* 25249592Sken * @test 26249592Sken * @summary Verify that circular sources split on multiple cores can be compiled 27249592Sken * @bug 8054689 28249592Sken * @author Fredrik O 29249592Sken * @author sogoel (rewrite) 30249592Sken * @library /tools/lib 31249592Sken * @modules jdk.compiler/com.sun.tools.javac.api 32249592Sken * jdk.compiler/com.sun.tools.javac.file 33249596Sken * jdk.compiler/com.sun.tools.javac.main 34249592Sken * jdk.compiler/com.sun.tools.sjavac 35249592Sken * @build Wrapper ToolBox 36249592Sken * @run main Wrapper CompileCircularSources 37249592Sken */ 38249592Sken 39249592Skenimport java.io.IOException; 40249592Skenimport java.util.*; 41249592Skenimport java.nio.file.*; 42249592Sken 43249592Skenpublic class CompileCircularSources extends SJavacTester { 44249592Sken public static void main(String... args) throws Exception { 45249592Sken CompileCircularSources ccs = new CompileCircularSources(); 46249592Sken ccs.test(); 47249592Sken } 48249592Sken 49249592Sken void test() throws Exception { 50249592Sken Files.createDirectories(BIN); 51249592Sken Files.createDirectories(GENSRC); 52249592Sken 53249592Sken Map<String,Long> previous_bin_state = collectState(BIN); 54249592Sken 55249592Sken tb.writeFile(GENSRC.resolve("alfa/omega/A.java"), 56249592Sken "package alfa.omega; public class A { beta.B b; }"); 57249592Sken tb.writeFile(GENSRC.resolve("beta/B.java"), 58249592Sken "package beta; public class B { gamma.C c; }"); 59249592Sken tb.writeFile(GENSRC.resolve("gamma/C.java"), 60249592Sken "package gamma; public class C { alfa.omega.A a; }"); 61249592Sken 62249592Sken compile(GENSRC.toString(), 63249592Sken "-d", BIN.toString(), 64249592Sken "-h", HEADERS.toString(), 65249592Sken "--state-dir=" + BIN, 66249592Sken "-j", "3", 67249592Sken "--log=debug"); 68249592Sken Map<String,Long> new_bin_state = collectState(BIN); 69249592Sken verifyThatFilesHaveBeenAdded(previous_bin_state, 70249592Sken new_bin_state, 71249592Sken BIN + "/alfa/omega/A.class", 72249592Sken BIN + "/beta/B.class", 73249592Sken BIN + "/gamma/C.class", 74249592Sken BIN + "/javac_state"); 75249592Sken } 76249592Sken} 77249592Sken