Sat, 22 Dec 2018 13:10:38 -0800
Added tag jdk8u202-b25 for changeset 15d8c732039b
vromero@1591 | 1 | /* |
bpb@2900 | 2 | * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
vromero@1591 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
vromero@1591 | 4 | * |
vromero@1591 | 5 | * This code is free software; you can redistribute it and/or modify it |
vromero@1591 | 6 | * under the terms of the GNU General Public License version 2 only, as |
vromero@1591 | 7 | * published by the Free Software Foundation. |
vromero@1591 | 8 | * |
vromero@1591 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
vromero@1591 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
vromero@1591 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
vromero@1591 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
vromero@1591 | 13 | * accompanied this code). |
vromero@1591 | 14 | * |
vromero@1591 | 15 | * You should have received a copy of the GNU General Public License version |
vromero@1591 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
vromero@1591 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
vromero@1591 | 18 | * |
vromero@1591 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
vromero@1591 | 20 | * or visit www.oracle.com if you need additional information or have any |
vromero@1591 | 21 | * questions. |
vromero@1591 | 22 | */ |
vromero@1591 | 23 | |
vromero@1591 | 24 | /* |
vromero@1591 | 25 | * @test |
vromero@1591 | 26 | * @bug 4266026 |
vromero@1591 | 27 | * @summary javac no longer follows symlinks |
vromero@1591 | 28 | * @library /tools/javac/lib |
vromero@1591 | 29 | * @build ToolBox |
vromero@1591 | 30 | * @run main LinksTest |
vromero@1591 | 31 | */ |
vromero@1591 | 32 | |
bpb@2900 | 33 | import java.io.IOException; |
vromero@1591 | 34 | import java.nio.file.Files; |
vromero@1591 | 35 | import java.nio.file.Paths; |
vromero@1591 | 36 | |
vromero@1591 | 37 | //original test: test/tools/javac/links/links.sh |
vromero@1591 | 38 | public class LinksTest { |
vromero@1591 | 39 | |
vromero@1591 | 40 | private static final String BSrc = |
vromero@1591 | 41 | "package a;\n" + |
vromero@1591 | 42 | "\n" + |
vromero@1591 | 43 | "public class B {}"; |
vromero@1591 | 44 | |
vromero@1591 | 45 | private static final String TSrc = |
vromero@1591 | 46 | "class T extends a.B {}"; |
vromero@1591 | 47 | |
vromero@1591 | 48 | public static void main(String args[]) |
vromero@1591 | 49 | throws Exception { |
vromero@1591 | 50 | // mkdir tmp |
vromero@1591 | 51 | // cp ${TESTSRC}/b/B.java tmp |
bpb@2900 | 52 | ToolBox.writeFile(Paths.get("tmp/B.java"), BSrc); |
vromero@1591 | 53 | |
bpb@2900 | 54 | // Try to set up a symbolic link for the test. |
bpb@2900 | 55 | // ln -s `pwd`/tmp "${TESTCLASSES}/a" |
vromero@1637 | 56 | try { |
vromero@1637 | 57 | Files.createSymbolicLink(Paths.get("a"), Paths.get("tmp")); |
bpb@2900 | 58 | System.err.println("Created symbolic link"); |
bpb@2900 | 59 | } catch (UnsupportedOperationException | IOException e) { |
bpb@2900 | 60 | System.err.println("Problem creating symbolic link: " + e); |
bpb@2900 | 61 | System.err.println("Test cannot continue; test passed by default"); |
bpb@2900 | 62 | return; |
vromero@1637 | 63 | } |
bpb@2900 | 64 | |
bpb@2900 | 65 | // If symbolic link was successfully created, |
bpb@2900 | 66 | // try a compilation that will use it. |
bpb@2900 | 67 | ////"${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -sourcepath "${TESTCLASSES}" -d "${TESTCLASSES}/classes" "${TESTSRC}/T.java" 2>&1 |
bpb@2900 | 68 | ToolBox.JavaToolArgs javacArgs = |
bpb@2900 | 69 | new ToolBox.JavaToolArgs() |
bpb@2900 | 70 | .setOptions("-sourcepath", ".", "-d", ".").setSources(TSrc); |
bpb@2900 | 71 | ToolBox.javac(javacArgs); |
vromero@1591 | 72 | } |
vromero@1591 | 73 | |
vromero@1591 | 74 | } |