< prev index next >

test/jdk/modules/incubator/DefaultImage.java

Print this page
rev 17315 : 8181335: remove packageless CompilerUtils
Reviewed-by: duke
   1 /*
   2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8170859
  27  * @summary Ensure no incubator modules are resolved by default in the image
  28  * @library /lib/testlibrary
  29  * @modules jdk.compiler
  30  * @build CompilerUtils
  31  * @run testng DefaultImage
  32  */
  33 
  34 import java.io.ByteArrayOutputStream;
  35 import java.io.IOException;
  36 import java.io.PrintStream;
  37 import java.lang.module.ModuleDescriptor;
  38 import java.lang.module.ModuleFinder;
  39 import java.lang.module.ModuleReference;
  40 import java.nio.file.Files;
  41 import java.nio.file.Path;
  42 import java.nio.file.Paths;
  43 import java.util.function.Consumer;
  44 import java.util.stream.Stream;

  45 
  46 import org.testng.annotations.BeforeTest;
  47 import org.testng.annotations.Test;
  48 
  49 import static java.nio.charset.StandardCharsets.UTF_8;
  50 import static jdk.testlibrary.ProcessTools.executeCommand;
  51 import static org.testng.Assert.*;
  52 
  53 @Test
  54 public class DefaultImage {
  55     private static final String JAVA_HOME = System.getProperty("java.home");
  56     private static final Path TEST_SRC = Paths.get(System.getProperty("test.src"));
  57     private static final Path CP_DIR = Paths.get("cp");
  58 
  59     @BeforeTest
  60     private void setup() throws Throwable {
  61         Path src = TEST_SRC.resolve("src").resolve("cp").resolve("listmods");
  62         assertTrue(CompilerUtils.compile(src, CP_DIR));
  63     }
  64 


   1 /*
   2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8170859
  27  * @summary Ensure no incubator modules are resolved by default in the image
  28  * @library /lib/testlibrary /test/lib
  29  * @modules jdk.compiler
  30  * @build jdk.test.lib.compiler.CompilerUtils
  31  * @run testng DefaultImage
  32  */
  33 
  34 import java.io.ByteArrayOutputStream;

  35 import java.io.PrintStream;
  36 import java.lang.module.ModuleDescriptor;
  37 import java.lang.module.ModuleFinder;
  38 import java.lang.module.ModuleReference;
  39 import java.nio.file.Files;
  40 import java.nio.file.Path;
  41 import java.nio.file.Paths;
  42 import java.util.function.Consumer;
  43 import java.util.stream.Stream;
  44 import jdk.test.lib.compiler.CompilerUtils;
  45 
  46 import org.testng.annotations.BeforeTest;
  47 import org.testng.annotations.Test;
  48 
  49 import static java.nio.charset.StandardCharsets.UTF_8;
  50 import static jdk.testlibrary.ProcessTools.executeCommand;
  51 import static org.testng.Assert.*;
  52 
  53 @Test
  54 public class DefaultImage {
  55     private static final String JAVA_HOME = System.getProperty("java.home");
  56     private static final Path TEST_SRC = Paths.get(System.getProperty("test.src"));
  57     private static final Path CP_DIR = Paths.get("cp");
  58 
  59     @BeforeTest
  60     private void setup() throws Throwable {
  61         Path src = TEST_SRC.resolve("src").resolve("cp").resolve("listmods");
  62         assertTrue(CompilerUtils.compile(src, CP_DIR));
  63     }
  64 


< prev index next >