author | lancea |
Thu, 14 Nov 2019 10:54:32 -0500 | |
changeset 59083 | 3e4d8b5856f3 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
21348
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
1 |
/* |
38421 | 2 |
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. |
21348
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
4 |
* |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
8 |
* |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
13 |
* accompanied this code). |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
14 |
* |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
18 |
* |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
21 |
* questions. |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
22 |
*/ |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
23 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
24 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
25 |
/* |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
26 |
* @test |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
27 |
* @run main/timeout=600 TestNormal |
38421 | 28 |
* @bug 8020802 8156807 |
21348
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
29 |
* @summary Need an ability to create jar files that are invariant to the pack200 packing/unpacking |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
30 |
* @author Alexander Zuev |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
31 |
*/ |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
32 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
33 |
import java.io.*; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
34 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
35 |
public class TestNormal { |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
36 |
private static String FS = File.separator; |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
37 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
38 |
public static void main(String args[]) throws Exception { |
27176
7009a264e019
8060432: tools/pack200/TestNormal.java fails on Windows with java.io.FileNotFoundException after JDK-8058854
ksrini
parents:
27035
diff
changeset
|
39 |
String testdir = Utils.TEST_CLS_DIR.getAbsolutePath(); |
21348
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
40 |
|
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
41 |
try { |
38421 | 42 |
String jarCmd = Utils.getJarCmd(); |
43 |
String packCmd = Utils.getPack200Cmd(); |
|
21348
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
44 |
|
38421 | 45 |
// create the original jar |
46 |
Utils.runExec(jarCmd, "cf", "original.jar", "-C", testdir, "."); |
|
47 |
||
48 |
// create the reference jar |
|
49 |
Utils.runExec(packCmd, "-r", "repacked.jar", "original.jar"); |
|
21348
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
50 |
|
38421 | 51 |
// create the normalized jar using jar(1) |
52 |
Utils.runExec(jarCmd, "cnf", "normalized.jar", "-C", testdir, "."); |
|
53 |
||
54 |
// compare archive contents bit wise, these should be identical! |
|
55 |
Utils.doCompareBitWise(new File("repacked.jar"), |
|
56 |
new File("normalized.jar")); |
|
21348
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
57 |
} finally { |
38421 | 58 |
Utils.cleanup(); |
21348
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
59 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
60 |
} |
e30c5696b4c5
8020802: Need an ability to create jar files that are invariant to the pack200 packing/unpacking
kizune
parents:
diff
changeset
|
61 |
} |