test/hotspot/jtreg/runtime/appcds/AppendClasspath.java
changeset 48979 514c73a1955b
parent 48469 7312ae4465d6
child 51990 6003e034cdd8
equal deleted inserted replaced
48978:93996c47d36f 48979:514c73a1955b
     1 /*
     1 /*
     2  * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2014, 2018, 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.
    46 
    46 
    47     // Dump an archive with a specified JAR file in -classpath
    47     // Dump an archive with a specified JAR file in -classpath
    48     TestCommon.testDump(appJar, TestCommon.list("Hello"));
    48     TestCommon.testDump(appJar, TestCommon.list("Hello"));
    49 
    49 
    50     // PASS: 1) runtime with classpath containing the one used in dump time
    50     // PASS: 1) runtime with classpath containing the one used in dump time
    51     OutputAnalyzer output = TestCommon.execCommon(
    51     TestCommon.run(
    52         "-cp", appJar + File.pathSeparator + appJar2,
    52         "-cp", appJar + File.pathSeparator + appJar2,
    53         "HelloMore");
    53         "HelloMore")
    54     TestCommon.checkExec(output);
    54       .assertNormalExit();
    55 
    55 
    56     final String errorMessage1 = "Unable to use shared archive";
    56     final String errorMessage1 = "Unable to use shared archive";
    57     final String errorMessage2 = "shared class paths mismatch";
    57     final String errorMessage2 = "shared class paths mismatch";
    58     // FAIL: 2) runtime with classpath different from the one used in dump time
    58     // FAIL: 2) runtime with classpath different from the one used in dump time
    59     // (runtime has an extra jar file prepended to the class path)
    59     // (runtime has an extra jar file prepended to the class path)
    60     output = TestCommon.execCommon(
    60     TestCommon.run(
    61         "-cp", appJar2 + File.pathSeparator + appJar,
    61         "-cp", appJar2 + File.pathSeparator + appJar,
    62         "HelloMore");
    62         "HelloMore")
    63     output.shouldContain(errorMessage1);
    63       .assertAbnormalExit(errorMessage1, errorMessage2);
    64     output.shouldContain(errorMessage2);
       
    65     output.shouldHaveExitValue(1);
       
    66 
    64 
    67     // FAIL: 3) runtime with classpath part of the one used in dump time
    65     // FAIL: 3) runtime with classpath part of the one used in dump time
    68     TestCommon.testDump(appJar + File.pathSeparator + appJar2,
    66     TestCommon.testDump(appJar + File.pathSeparator + appJar2,
    69                                       TestCommon.list("Hello"));
    67                                       TestCommon.list("Hello"));
    70     output = TestCommon.execCommon(
    68     TestCommon.run(
    71         "-cp", appJar2,
    69         "-cp", appJar2,
    72         "Hello");
    70         "Hello")
    73     output.shouldContain(errorMessage1);
    71       .assertAbnormalExit(errorMessage1, errorMessage2);
    74     output.shouldContain(errorMessage2);
       
    75     output.shouldHaveExitValue(1);
       
    76 
    72 
    77     // FAIL: 4) runtime with same set of jar files in the classpath but
    73     // FAIL: 4) runtime with same set of jar files in the classpath but
    78     // with different order
    74     // with different order
    79     output = TestCommon.execCommon(
    75     TestCommon.run(
    80         "-cp", appJar2 + File.pathSeparator + appJar,
    76         "-cp", appJar2 + File.pathSeparator + appJar,
    81         "HelloMore");
    77         "HelloMore")
    82     output.shouldContain(errorMessage1);
    78       .assertAbnormalExit(errorMessage1, errorMessage2);
    83     output.shouldContain(errorMessage2);
       
    84     output.shouldHaveExitValue(1);
       
    85   }
    79   }
    86 }
    80 }