test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java
changeset 48979 514c73a1955b
parent 48469 7312ae4465d6
child 49739 00805b129186
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java	Thu Feb 15 09:22:25 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java	Wed Feb 14 07:08:25 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -72,12 +72,12 @@
         TestCommon.checkDump(output, "Loading classes to share");
 
         // javax.naming.spi.NamingManager is not patched at runtime
-        output = TestCommon.execCommon(
+        TestCommon.run(
             "-XX:+UnlockDiagnosticVMOptions",
             "--patch-module=java.naming2=" + moduleJar,
             "-Xlog:class+path=info",
-            "PatchMain", "javax.naming.spi.NamingManager");
-        output.shouldNotContain("I pass!");
+            "PatchMain", "javax.naming.spi.NamingManager")
+          .assertNormalExit(o -> o.shouldNotContain("I pass!"));
 
         // Case 2: --patch-module specified for dump time but not for run time
         System.out.println("Case 2: --patch-module specified for dump time but not for run time");
@@ -89,11 +89,11 @@
         TestCommon.checkDump(output, "Loading classes to share");
 
         // javax.naming.spi.NamingManager is not patched at runtime
-        output = TestCommon.execCommon(
+        TestCommon.run(
             "-XX:+UnlockDiagnosticVMOptions",
             "-Xlog:class+path=info",
-            "PatchMain", "javax.naming.spi.NamingManager");
-        output.shouldNotContain("I pass!");
+            "PatchMain", "javax.naming.spi.NamingManager")
+          .assertNormalExit(o -> o.shouldNotContain("I pass!"));
 
         // Case 3: --patch-module specified for run time but not for dump time
         System.out.println("Case 3: --patch-module specified for run time but not for dump time");
@@ -104,12 +104,12 @@
         TestCommon.checkDump(output, "Loading classes to share");
 
         // javax.naming.spi.NamingManager is patched at runtime
-        output = TestCommon.execCommon(
+        TestCommon.run(
             "-XX:+UnlockDiagnosticVMOptions",
             "--patch-module=java.naming=" + moduleJar,
             "-Xlog:class+path=info",
-            "PatchMain", "javax.naming.spi.NamingManager");
-        TestCommon.checkExec(output, "I pass!");
+            "PatchMain", "javax.naming.spi.NamingManager")
+          .assertNormalExit("I pass!");
 
         // Case 4: mismatched --patch-module entry counts between dump time and run time
         System.out.println("Case 4: mismatched --patch-module entry counts between dump time and run time");
@@ -121,12 +121,12 @@
         TestCommon.checkDump(output, "Loading classes to share");
 
         // javax.naming.spi.NamingManager is patched at runtime
-        output = TestCommon.execCommon(
+        TestCommon.run(
             "-XX:+UnlockDiagnosticVMOptions",
             "--patch-module=java.naming=" + moduleJar,
             "--patch-module=java.naming2=" + moduleJar,
             "-Xlog:class+path=info",
-            "PatchMain", "javax.naming.spi.NamingManager");
-        TestCommon.checkExec(output, "I pass!");
+            "PatchMain", "javax.naming.spi.NamingManager")
+          .assertNormalExit("I pass!");
     }
 }