Path: blob/master/test/langtools/tools/sjavac/ParallelCompilations.java
41144 views
/*1* Copyright (c) 2015, 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 Test to check that -j option works with more than one value26* @bug 807162927* @author sogoel28* @library /tools/lib29* @modules jdk.compiler/com.sun.tools.javac.api30* jdk.compiler/com.sun.tools.javac.main31* jdk.compiler/com.sun.tools.sjavac32* @build Wrapper toolbox.ToolBox33* @run main Wrapper ParallelCompilations34*/3536import java.io.*;37import java.nio.file.*;38import com.sun.tools.sjavac.Main;3940class ParallelCompilations extends SJavacTester {41public static void main(String[] args) throws Exception {42new ParallelCompilations().run();43}4445public void run() throws Exception {46// Generate 10 files47for (int i = 0; i < 10; i++) {48String content = "package foo"+ i + ";\n" +49"public class Test" + i + "{\n" +50" public static void main(String[] args) {}\n" +51"\n}";52Path srcDir = Paths.get("src");53tb.writeJavaFiles(srcDir, content);54}55// Method will throw an exception if compilation fails56compile("src",57"-d", BIN.toString(),58"--state-dir=" + BIN,59"-j", "10",60"--log=debug");61}62}636465