|
1 /* |
|
2 * Copyright (c) 2010, 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 import java.io.File; |
|
25 import java.io.IOException; |
|
26 import java.util.ArrayList; |
|
27 import java.util.List; |
|
28 |
|
29 /* |
|
30 * @test |
|
31 * @bug 6982312 |
|
32 * @summary tests various classfile format and attribute handling by pack200 |
|
33 * @compile -XDignore.symbol.file Utils.java AttributeTests.java |
|
34 * @run main AttributeTests |
|
35 * @author ksrini |
|
36 */ |
|
37 |
|
38 |
|
39 public class AttributeTests { |
|
40 |
|
41 public static void main(String... args) throws Exception { |
|
42 test6982312(); |
|
43 } |
|
44 /* |
|
45 * This is an interim test, which ensures pack200 handles JSR-292 related |
|
46 * classfile changes seamlessly, until all the classfile changes in jdk7 |
|
47 * and jdk8 are fully supported. At that time this test should be jettisoned, |
|
48 * along with the associated jar file. |
|
49 * |
|
50 * The jar file contains sources and classes noting the classes were |
|
51 * derived by using the javac from the lambda project, |
|
52 * see http://openjdk.java.net/projects/lambda/. |
|
53 * Therefore the classes contained in the jar cannot be compiled, using |
|
54 * the standard jdk7's javac compiler. |
|
55 */ |
|
56 static void test6982312() throws IOException { |
|
57 String pack200Cmd = Utils.getPack200Cmd(); |
|
58 File dynJar = new File(".", "dyn.jar"); |
|
59 Utils.copyFile(new File(Utils.TEST_SRC_DIR, "dyn.jar"), dynJar); |
|
60 File testJar = new File(".", "test.jar"); |
|
61 List<String> cmds = new ArrayList<String>(); |
|
62 cmds.add(pack200Cmd); |
|
63 cmds.add("--repack"); |
|
64 cmds.add(testJar.getAbsolutePath()); |
|
65 cmds.add(dynJar.getAbsolutePath()); |
|
66 Utils.runExec(cmds); |
|
67 /* |
|
68 * compare the repacked jar bit-wise, as all the files |
|
69 * should be transmitted "as-is". |
|
70 */ |
|
71 Utils.doCompareBitWise(dynJar.getAbsoluteFile(), testJar.getAbsoluteFile()); |
|
72 testJar.delete(); |
|
73 dynJar.delete(); |
|
74 } |
|
75 } |