changeset 13521:144701234109

Replace shell test for ModuleReader
author alanb
date Sun, 26 Jul 2015 11:41:35 +0100
parents ccdc121bb57e
children 3a0dcb0595da
files src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java test/jdk/jigsaw/lib/CompilerUtils.java test/jdk/jigsaw/lib/JarUtils.java test/jdk/jigsaw/module/ModuleReader/ModuleReaderTest.java test/jdk/jigsaw/module/ModuleReader/src/m/module-info.java test/jdk/jigsaw/module/ModuleReader/src/m/p/Main.java test/jdk/jigsaw/reader/Basic.java test/jdk/jigsaw/reader/basic.sh test/jdk/jigsaw/reader/src/m/module-info.java test/jdk/jigsaw/reader/src/m/p/Foo.java test/lib/testlibrary/jdk/testlibrary/CompilerUtils.java
diffstat 11 files changed, 465 insertions(+), 349 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java	Sat Jul 25 19:31:47 2015 +0100
+++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java	Sun Jul 26 11:41:35 2015 +0100
@@ -84,7 +84,7 @@
 /**
  * Implementation for the jmod tool.
  */
-class JmodTask {
+public class JmodTask {
 
     static class CommandException extends RuntimeException {
         private static final long serialVersionUID = 0L;
@@ -127,7 +127,7 @@
     private static final String MODULE_INFO = "module-info.class";
 
     private Options options;
-    private PrintStream out;
+    private PrintStream out = System.out;
     void setLog(PrintStream out) {
         this.out = out;
     }
@@ -159,9 +159,7 @@
         Pattern dependencesToHash;
     }
 
-    int run(String[] args) {
-        if (out == null)
-            out = System.out;
+    public int run(String[] args) {
 
         try {
             handleOptions(args);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jigsaw/lib/CompilerUtils.java	Sun Jul 26 11:41:35 2015 +0100
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.tools.JavaCompiler;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * This class consists exclusively of static utility methods for invoking the
+ * java compiler.
+ *
+ * This class will eventually move to jdk.testlibrary.
+ */
+
+public final class CompilerUtils {
+    private CompilerUtils() { }
+
+    /**
+     * Compile all the java sources in {@code <source>/**} to
+     * {@code <destination>/**}. The destination directory will be created if
+     * it doesn't exist.
+     *
+     * All warnings/errors emitted by the compiler are output to System.out/err.
+     *
+     * @return true if the compilation is successful
+     *
+     * @throws IOException if there is an I/O error scanning the source tree or
+     *                     creating the destination directory
+     */
+    public static boolean compile(Path source, Path destination, String ... options)
+        throws IOException
+    {
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
+
+        List<Path> sources
+            = Files.find(source, Integer.MAX_VALUE,
+                (file, attrs) -> (file.toString().endsWith(".java")))
+                .collect(Collectors.toList());
+
+        Files.createDirectories(destination);
+        jfm.setLocationFromPaths(StandardLocation.CLASS_OUTPUT,
+                                 Arrays.asList(destination));
+
+        List<String> opts = Arrays.asList(options);
+        JavaCompiler.CompilationTask task
+            = compiler.getTask(null, jfm, null, opts, null,
+                jfm.getJavaFileObjectsFromPaths(sources));
+
+        return task.call();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jigsaw/lib/JarUtils.java	Sun Jul 26 11:41:35 2015 +0100
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.stream.Stream;
+
+/**
+ * This class consists exclusively of static utility methods that are useful
+ * for creating and manipulating JAR files.
+ *
+ * It will eventually be combined with jdk.testlibrary.JarUtils.
+ */
+
+public final class JarUtils {
+    private JarUtils() { }
+
+    /**
+     * Creates a JAR file.
+     *
+     * Equivalent to {@code jar cf <jarfile> -C <dir> file...}
+     *
+     * The input files are resolve against the given directory. Any input
+     * files that are directories then they are processed recursively.
+     */
+    public static void createJarFile(Path jarfile, Path dir, Path... file)
+        throws IOException
+    {
+        // create
+        Path parent = jarfile.getParent();
+        if (parent != null)
+            Files.createDirectories(parent);
+
+        List<Path> entries = new ArrayList<>();
+        for (Path entry : file) {
+            Files.find(dir.resolve(entry), Integer.MAX_VALUE,
+                        (p, attrs) -> attrs.isRegularFile())
+                    .map(e -> dir.relativize(e))
+                    .forEach(entries::add);
+        }
+
+        try (OutputStream out = Files.newOutputStream(jarfile);
+             JarOutputStream jos = new JarOutputStream(out))
+        {
+            for (Path entry : entries) {
+
+                // map the file path to a name in the JAR file
+                Path normalized = entry.normalize();
+                String name = normalized
+                        .subpath(0, normalized.getNameCount())  // drop root
+                        .toString()
+                        .replace(File.separatorChar, '/');
+
+                jos.putNextEntry(new JarEntry(name));
+                Files.copy(dir.resolve(entry), jos);
+            }
+        }
+    }
+
+    /**
+     * Creates a JAR file.
+     *
+     * Equivalent to {@code jar cf <jarfile> -C <dir> file...}
+     *
+     * The input files are resolve against the given directory. Any input
+     * files that are directories then they are processed recursively.
+     */
+    public static void createJarFile(Path jarfile, Path dir, String... input)
+        throws IOException
+    {
+        Path[] paths = Stream.of(input).map(Paths::get).toArray(Path[]::new);
+        createJarFile(jarfile, dir, paths);
+    }
+
+    /**
+     * Creates a JAR file from the contents of a directory.
+     *
+     * Equivalent to {@code jar cf <jarfile> -C <dir> .}
+     */
+    public static void createJarFile(Path jarfile, Path dir) throws IOException {
+        createJarFile(jarfile, dir, Paths.get("."));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jigsaw/module/ModuleReader/ModuleReaderTest.java	Sun Jul 26 11:41:35 2015 +0100
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @library ../../lib
+ * @modules jdk.jlink/jdk.tools.jmod
+ * @build ModuleReaderTest CompilerUtils JarUtils
+ * @run testng ModuleReaderTest
+ * @summary Basic tests for java.lang.module.ModuleReader
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReader;
+import java.lang.module.ModuleReference;
+import java.nio.ByteBuffer;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Optional;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+@Test
+public class ModuleReaderTest {
+
+    private static final String TEST_SRC = System.getProperty("test.src");
+
+    private static final Path USER_DIR   = Paths.get(System.getProperty("user.dir"));
+    private static final Path SRC_DIR    = Paths.get(TEST_SRC, "src");
+    private static final Path MODS_DIR   = Paths.get("mods");
+
+    // the module name of the test module
+    private static final String TEST_MODULE = "m";
+
+    // resources in test module (can't use module-info.class as a test
+    // resource as it will be modified by the jmod tool)
+    private static final String[] RESOURCES = {
+        "p/Main.class"
+    };
+
+    // a resource that is not in the test module
+    private static final String NOT_A_RESOURCE = "NotAResource";
+
+
+    @BeforeTest
+    public void compileTestModule() throws Exception {
+
+        // javac -d mods/$TESTMODULE src/$TESTMODULE/**
+        boolean compiled
+            = CompilerUtils.compile(SRC_DIR.resolve(TEST_MODULE),
+                                    MODS_DIR.resolve(TEST_MODULE));
+        assertTrue(compiled, "test module did not compile");
+    }
+
+
+    /**
+     * Test exploded module
+     */
+    public void testExplodedModule() throws Exception {
+        test(MODS_DIR);
+    }
+
+
+    /**
+     * Test modular JAR
+     */
+    public void testModularJar() throws Exception {
+        Path dir = Files.createTempDirectory(USER_DIR, "mlib");
+
+        // jar cf mlib/${TESTMODULE}.jar -C mods .
+        JarUtils.createJarFile(dir.resolve("m.jar"),
+                               MODS_DIR.resolve(TEST_MODULE));
+
+        test(dir);
+    }
+
+
+    /**
+     * Test JMOD
+     */
+    public void testJMod() throws Exception {
+        Path dir = Files.createTempDirectory(USER_DIR, "mlib");
+
+        // jmod create --class-path mods/${TESTMODULE}  mlib/${TESTMODULE}.jmod
+        String cp = MODS_DIR.resolve(TEST_MODULE).toString();
+        String jmod = dir.resolve("m.jmod").toString();
+        String[] args = { "create", "--class-path", cp, jmod };
+        jdk.tools.jmod.JmodTask task = new jdk.tools.jmod.JmodTask();
+        assertEquals(task.run(args), 0);
+
+        test(dir);
+    }
+
+
+    /**
+     * The test module is found on the given module path. Open a ModuleReader
+     * to the test module and test the reader.
+     */
+    void test(Path mp) throws Exception {
+
+        ModuleFinder finder = ModuleFinder.of(mp);
+        ModuleReference mref = finder.find(TEST_MODULE).get();
+        ModuleReader reader = mref.open();
+
+        try (reader) {
+
+            // test each of the known resources in the module
+            for (String name : RESOURCES) {
+                byte[] expectedBytes
+                    = Files.readAllBytes(MODS_DIR
+                        .resolve(TEST_MODULE)
+                        .resolve(name.replace('/', File.separatorChar)));
+
+                testOpen(reader, name, expectedBytes);
+                testRead(reader, name, expectedBytes);
+            }
+
+            // test "not found"
+            assertFalse(reader.open(NOT_A_RESOURCE).isPresent());
+            assertFalse(reader.read(NOT_A_RESOURCE).isPresent());
+
+            // test nulls
+            try {
+                reader.open(null);
+                assertTrue(false);
+            } catch (NullPointerException expected) { }
+
+            try {
+                reader.read(null);
+                assertTrue(false);
+            } catch (NullPointerException expected) { }
+
+            // should release(null) throw NPE?
+
+        }
+
+        // test closed ModuleReader
+        try {
+            reader.open(RESOURCES[0]);
+            assertTrue(false);
+        } catch (IOException expected) { }
+
+
+        try {
+            reader.read(RESOURCES[0]);
+            assertTrue(false);
+        } catch (IOException expected) { }
+    }
+
+    /**
+     * Test ModuleReader#open
+     */
+    void testOpen(ModuleReader reader, String name, byte[] expectedBytes)
+        throws Exception
+    {
+        Optional<InputStream> oin = reader.open(name);
+        assertTrue(oin.isPresent());
+
+        InputStream in = oin.get();
+        try (in) {
+            byte[] bytes = in.readAllBytes();
+            assertTrue(Arrays.equals(bytes, expectedBytes));
+        }
+    }
+
+    /**
+     * Test ModuleReader#read
+     */
+    void testRead(ModuleReader reader, String name, byte[] expectedBytes)
+        throws Exception
+    {
+        Optional<ByteBuffer> obb = reader.read(name);
+        assertTrue(obb.isPresent());
+
+        ByteBuffer bb = obb.get();
+        try {
+            int rem = bb.remaining();
+            assertTrue(rem == expectedBytes.length);
+            byte[] bytes = new byte[rem];
+            bb.get(bytes);
+            assertTrue(Arrays.equals(bytes, expectedBytes));
+        } finally {
+            reader.release(bb);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jigsaw/module/ModuleReader/src/m/module-info.java	Sun Jul 26 11:41:35 2015 +0100
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+module m {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jigsaw/module/ModuleReader/src/m/p/Main.java	Sun Jul 26 11:41:35 2015 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * Main class for dummy module.
+ */
+
+public class Main {
+    public static void main(String[] args) {
+    }
+}
--- a/test/jdk/jigsaw/reader/Basic.java	Sat Jul 25 19:31:47 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.module.ModuleReference;
-import java.lang.module.ModuleFinder;
-import java.lang.module.ModuleReader;
-import java.nio.ByteBuffer;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.Objects;
-
-/**
- * Basic test for java.lang.module.ModuleReader. Usage:
- *
- * java Basic $MODULE $DIR $NAME $EXPECTED
- *
- *     $MODULE is the module name
- *     $DIR is the directory containing the module
- *     $NAME is the name of a resource in the module
- *     $EXPECTED is the file path to a copy of the resource on the file system
- */
-
-public class Basic {
-
-    // name of resource that will never be found
-    static final String NOT_A_RESOURCE = "NotAResource";
-
-    public static void main(String[] args) throws IOException {
-
-        String module = args[0];
-        Path dir = Paths.get(args[1]);
-        String name = args[2];
-        byte[] expectedBytes = Files.readAllBytes(Paths.get(args[3]));
-
-        // find the module
-        ModuleFinder finder = ModuleFinder.of(dir);
-        ModuleReference mref = finder.find(module).get();
-        assertTrue(mref != null);
-
-        // test the reader on this module
-        test(mref, name, expectedBytes);
-    }
-
-    /**
-     * Opens the given module reference and tests its ModuleReader.
-     *
-     * @param reference the module reference to open
-     * @param name the name of a resource that exists in the module
-     * @param bytes the bytes in the resource to ensure that the resource
-     *              is correctly read
-     */
-    static void test(ModuleReference mref, String name, byte[] bytes)
-        throws IOException
-    {
-        ModuleReader reader = mref.open();
-        try (reader) {
-
-            // test open
-            try (InputStream in = reader.open(name).get()) {
-                byte[] b = readAll(in);
-                assertTrue(Arrays.equals(b, bytes));
-            }
-
-            // test read
-            ByteBuffer bb = reader.read(name).get();
-            try {
-                int rem = bb.remaining();
-                assertTrue(rem == bytes.length);
-                byte[] b = new byte[rem];
-                bb.get(b);
-                assertTrue(Arrays.equals(b, bytes));
-            } finally {
-                reader.release(bb);
-            }
-
-            // test "not found"
-            assertTrue(!reader.open(NOT_A_RESOURCE).isPresent());
-            assertTrue(!reader.read(NOT_A_RESOURCE).isPresent());
-
-            // test "null"
-            try {
-                reader.open(null);
-                assertTrue(false);
-            } catch (NullPointerException expected) { }
-            try {
-                reader.read(null);
-                assertTrue(false);
-            } catch (NullPointerException expected) { }
-        }
-
-        // test closed reader
-        try {
-            reader.open(name);
-            assertTrue(false);
-        } catch (IOException expected) { }
-
-        try {
-            reader.read(name);
-            assertTrue(false);
-        } catch (IOException expected) { }
-
-    }
-
-    /**
-     * Return a byte array with all bytes read from the given input stream
-     */
-    static byte[] readAll(InputStream in) throws IOException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        in.transferTo(baos);
-        return baos.toByteArray();
-    }
-
-    static void assertTrue(boolean e) {
-        if (!e)
-            throw new RuntimeException();
-
-    }
-    static void assertEquals(Object x, Object y) {
-        if (!Objects.equals(x, y))
-            throw new RuntimeException();
-    }
-
-}
--- a/test/jdk/jigsaw/reader/basic.sh	Sat Jul 25 19:31:47 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-#
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @summary Basic test for ModuleReader with the built-in artifact types
-
-set -e
-
-if [ -z "$TESTJAVA" ]; then
-  if [ $# -lt 1 ]; then exit 1; fi
-  TESTJAVA="$1"; shift
-  COMPILEJAVA="${TESTJAVA}"
-  TESTSRC="`pwd`"
-  TESTCLASSES="`pwd`"
-fi
-
-JAVAC="$COMPILEJAVA/bin/javac"
-JAVA="$TESTJAVA/bin/java ${TESTVMOPTS}"
-JAR="$TESTJAVA/bin/jar ${TESTTOOLVMOPTS}"
-JMOD="$TESTJAVA/bin/jmod ${TESTTOOLVMOPTS}"
-
-# Compile test
-$JAVAC -d . $TESTSRC/Basic.java
-
-# Compile module used by the test
-rm -rf mods
-mkdir -p mods/m
-$JAVAC -d mods/m `find $TESTSRC/src/m -name "*.java"`
-
-# Test exploded module
-$JAVA Basic m mods p/Foo.class mods/m/p/Foo.class
-
-# Test modular JAR
-rm -rf mlib
-mkdir -p mlib
-$JAR cf mlib/m.jar -C mods/m .
-$JAVA Basic m mlib p/Foo.class mods/m/p/Foo.class
-
-# Test jmod
-rm -rf mlib
-mkdir -p mlib
-$JMOD create --class-path mods/m mlib/m.jmod
-$JAVA Basic m mlib p/Foo.class mods/m/p/Foo.class
-
-exit 0
--- a/test/jdk/jigsaw/reader/src/m/module-info.java	Sat Jul 25 19:31:47 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-module m {
-}
--- a/test/jdk/jigsaw/reader/src/m/p/Foo.java	Sat Jul 25 19:31:47 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public class Foo {
-}
--- a/test/lib/testlibrary/jdk/testlibrary/CompilerUtils.java	Sat Jul 25 19:31:47 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.testlibrary;
-
-import javax.tools.JavaCompiler;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-import javax.tools.ToolProvider;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * This class consists exclusively of static utility methods for invoking the
- * java compiler.
- */
-
-public final class CompilerUtils {
-    private CompilerUtils() { }
-
-    /**
-     * Compile all the java sources in {@code <source>/**} to
-     * {@code <destination>/**}. The destination directory will be created if
-     * it doesn't exist.
-     *
-     * All warnings/errors emitted by the compiler are output to System.out/err.
-     *
-     * @return true if the compilation is successful
-     *
-     * @throws IOException if there is an I/O error scanning the source tree or
-     *                     creating the destination directory
-     */
-    public static boolean compile(Path source, Path destination, String ... options)
-        throws IOException
-    {
-        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
-        StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
-
-        List<Path> sources
-            = Files.find(source, Integer.MAX_VALUE,
-                (file, attrs) -> (file.toString().endsWith(".java")))
-                .collect(Collectors.toList());
-
-        Files.createDirectories(destination);
-        jfm.setLocationFromPaths(StandardLocation.CLASS_OUTPUT,
-                                 Arrays.asList(destination));
-
-        List<String> opts = Arrays.asList(options);
-        JavaCompiler.CompilationTask task
-            = compiler.getTask(null, jfm, null, opts, null,
-                jfm.getJavaFileObjectsFromPaths(sources));
-
-        return task.call();
-    }
-}