author | duke |
Wed, 05 Jul 2017 20:17:33 +0200 | |
changeset 28710 | 5b8db585a33c |
parent 18594 | b6a3c9f71ac8 |
child 37306 | 645dd89cd76c |
permissions | -rw-r--r-- |
17490
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
1 |
/* |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
4 |
* |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
8 |
* |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
13 |
* accompanied this code). |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
14 |
* |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
18 |
* |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
21 |
* questions. |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
22 |
*/ |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
23 |
|
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
24 |
/* |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
25 |
* @test |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
26 |
* @summary test ensures the proper sequencing of bands, dump bands as well. |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
27 |
* @compile -XDignore.symbol.file Utils.java BandIntegrity.java |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
28 |
* @run main BandIntegrity |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
29 |
* @author ksrini |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
30 |
*/ |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
31 |
import java.io.File; |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
32 |
import java.io.IOException; |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
33 |
import java.util.ArrayList; |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
34 |
import java.util.List; |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
35 |
|
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
36 |
/* |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
37 |
* This makes use of the optDebugBands to ensure the bands are read in the |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
38 |
* same sequence as it was written. The caveat is that this works only with |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
39 |
* the java unpacker, therefore it will work only with --repack such that |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
40 |
* the java packer and unpacker must be called in the same java instance. |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
41 |
*/ |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
42 |
public class BandIntegrity { |
18594
b6a3c9f71ac8
8017463: [TEST_BUG] 2 tests from tools/pack200/ remain about 1 GB of data in work directory after execution
ksrini
parents:
17490
diff
changeset
|
43 |
public static void main(String... args) throws IOException { |
17490
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
44 |
File testFile = new File("test.jar"); |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
45 |
Utils.jar("cvf", testFile.getName(), |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
46 |
"-C", Utils.TEST_CLS_DIR.getAbsolutePath(), |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
47 |
"."); |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
48 |
List<String> scratch = new ArrayList<>(); |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
49 |
// band debugging works only with java unpacker |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
50 |
scratch.add("com.sun.java.util.jar.pack.disable.native=true"); |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
51 |
scratch.add("com.sun.java.util.jar.pack.debug.bands=true"); |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
52 |
// while at it, might as well exercise this functionality |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
53 |
scratch.add("com.sun.java.util.jar.pack.dump.bands=true"); |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
54 |
scratch.add("pack.unknown.attribute=error"); |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
55 |
File configFile = new File("pack.conf"); |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
56 |
Utils.createFile(configFile, scratch); |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
57 |
File outFile = new File("out.jar"); |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
58 |
Utils.repack(testFile, outFile, true, |
18594
b6a3c9f71ac8
8017463: [TEST_BUG] 2 tests from tools/pack200/ remain about 1 GB of data in work directory after execution
ksrini
parents:
17490
diff
changeset
|
59 |
"-v", "--config-file=" + configFile.getName()); |
b6a3c9f71ac8
8017463: [TEST_BUG] 2 tests from tools/pack200/ remain about 1 GB of data in work directory after execution
ksrini
parents:
17490
diff
changeset
|
60 |
Utils.cleanup(); |
17490
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
61 |
} |
46864558d068
8001163: [pack200] should support attributes introduced by JSR-308
ksrini
parents:
diff
changeset
|
62 |
} |