Path: blob/master/test/langtools/tools/sjavac/CompileCircularSources.java
41144 views
/*1* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @summary Verify that circular sources split on multiple cores can be compiled26* @bug 805468927* @author Fredrik O28* @author sogoel (rewrite)29* @library /tools/lib30* @modules jdk.compiler/com.sun.tools.javac.api31* jdk.compiler/com.sun.tools.javac.main32* jdk.compiler/com.sun.tools.sjavac33* @build Wrapper toolbox.ToolBox34* @run main Wrapper CompileCircularSources35*/3637import java.io.IOException;38import java.util.*;39import java.nio.file.*;4041public class CompileCircularSources extends SJavacTester {42public static void main(String... args) throws Exception {43CompileCircularSources ccs = new CompileCircularSources();44ccs.test();45}4647void test() throws Exception {48Files.createDirectories(BIN);49Files.createDirectories(GENSRC);5051Map<String,Long> previous_bin_state = collectState(BIN);5253tb.writeFile(GENSRC.resolve("alfa/omega/A.java"),54"package alfa.omega; public class A { beta.B b; }");55tb.writeFile(GENSRC.resolve("beta/B.java"),56"package beta; public class B { gamma.C c; }");57tb.writeFile(GENSRC.resolve("gamma/C.java"),58"package gamma; public class C { alfa.omega.A a; }");5960compile(GENSRC.toString(),61"-d", BIN.toString(),62"-h", HEADERS.toString(),63"--state-dir=" + BIN,64"-j", "3",65"--log=debug");66Map<String,Long> new_bin_state = collectState(BIN);67verifyThatFilesHaveBeenAdded(previous_bin_state,68new_bin_state,69BIN + "/alfa/omega/A.class",70BIN + "/beta/B.class",71BIN + "/gamma/C.class",72BIN + "/javac_state");73}74}757677