jdk/test/tools/pack200/AttributeTests.java
changeset 12544 5768f2e096de
parent 6901 68f3d74dbda1
child 15261 c5b882836677
equal deleted inserted replaced
12543:b77bc2f404ba 12544:5768f2e096de
     1 /*
     1 /*
     2  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    25 import java.util.ArrayList;
    25 import java.util.ArrayList;
    26 import java.util.Arrays;
    26 import java.util.Arrays;
    27 import java.util.List;
    27 import java.util.List;
    28 /*
    28 /*
    29  * @test
    29  * @test
    30  * @bug 6982312
    30  * @bug 6746111
    31  * @summary tests various classfile format and attribute handling by pack200
    31  * @summary tests various classfile format and attribute handling by pack200
    32  * @compile -XDignore.symbol.file Utils.java AttributeTests.java
    32  * @compile -XDignore.symbol.file Utils.java AttributeTests.java
    33  * @run main AttributeTests
    33  * @run main AttributeTests
    34  * @author ksrini
    34  * @author ksrini
    35  */
    35  */
    36 public class AttributeTests {
    36 public class AttributeTests {
    37 
    37 
    38     public static void main(String... args) throws Exception {
    38     public static void main(String... args) throws Exception {
    39         test6982312();
       
    40         test6746111();
    39         test6746111();
    41     }
       
    42     /*
       
    43      * This is an interim test, which ensures pack200 handles JSR-292 related
       
    44      * classfile changes seamlessly, until all the classfile changes in jdk7
       
    45      * and jdk8 are fully supported. At that time this test should be jettisoned,
       
    46      * along with the associated jar file.
       
    47      *
       
    48      * The jar file  contains sources and classes noting the classes were
       
    49      * derived by using the javac from the lambda project,
       
    50      * see http://openjdk.java.net/projects/lambda/.
       
    51      * Therefore the classes contained in the jar cannot be compiled, using
       
    52      * the standard jdk7's javac compiler.
       
    53      */
       
    54     static void test6982312() throws IOException {
       
    55         String pack200Cmd = Utils.getPack200Cmd();
       
    56         File dynJar = new File(".", "dyn.jar");
       
    57         Utils.copyFile(new File(Utils.TEST_SRC_DIR, "dyn.jar"), dynJar);
       
    58         File testJar = new File(".", "test.jar");
       
    59         List<String> cmds = new ArrayList<String>();
       
    60         cmds.add(pack200Cmd);
       
    61         cmds.add("--repack");
       
    62         cmds.add(testJar.getAbsolutePath());
       
    63         cmds.add(dynJar.getAbsolutePath());
       
    64         Utils.runExec(cmds);
       
    65         /*
       
    66          * compare the repacked jar bit-wise, as all the files
       
    67          * should be transmitted "as-is".
       
    68          */
       
    69         Utils.doCompareBitWise(dynJar.getAbsoluteFile(), testJar.getAbsoluteFile());
       
    70         testJar.delete();
       
    71         dynJar.delete();
       
    72     }
    40     }
    73 
    41 
    74     /*
    42     /*
    75      * this test checks to see if we get the expected strings for output
    43      * this test checks to see if we get the expected strings for output
    76      */
    44      */