test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java
changeset 54927 1512d88b24c6
parent 51990 6003e034cdd8
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java	Fri May 17 10:48:02 2019 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java	Fri May 17 08:29:55 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,18 +58,25 @@
         moduleJar = TestCommon.getTestJar("javabase.jar");
 
         System.out.println("Test dumping with --patch-module");
+        String runError = "Unable to use shared archive: CDS is disabled when java.base module is patched";
+        String dumpingError = "Cannot use the following option when dumping the shared archive: --patch-module";
+        String errMsg;
+        if (TestCommon.isDynamicArchive()) {
+            errMsg = runError;
+        } else {
+            errMsg = dumpingError;
+        }
         OutputAnalyzer output =
             TestCommon.dump(null, null,
                 "--patch-module=java.base=" + moduleJar,
                 "PatchMain", "java.lang.NewClass");
         output.shouldHaveExitValue(1)
-              .shouldContain("Cannot use the following option when dumping the shared archive: --patch-module");
+              .shouldContain(errMsg);
 
         TestCommon.run(
             "-XX:+UnlockDiagnosticVMOptions",
             "--patch-module=java.base=" + moduleJar,
             "PatchMain", "java.lang.NewClass")
-          .assertAbnormalExit("Unable to use shared archive",
-                              "CDS is disabled when java.base module is patched");
+          .assertAbnormalExit(runError);
     }
 }