--- a/hotspot/test/runtime/logging/ModulesTest.java Sat Apr 22 12:05:20 2017 +0200
+++ b/hotspot/test/runtime/logging/ModulesTest.java Thu May 04 07:26:28 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @summary modules=debug should have logging from statements in the code
+ * @summary -Xlog:module should emit logging output
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
@@ -35,9 +35,16 @@
public class ModulesTest {
public static void main(String[] args) throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
- "-Xlog:modules=trace", "-version");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ testModuleTrace("-Xlog:module=trace", "-version");
+ testModuleLoad("-Xlog:module+load", "-version");
+ testModuleUnload("-Xlog:module+unload", "-version");
+
+ // same as -Xlog:module+load -Xlog:module+unload
+ testModuleLoad("-verbose:module", "-version");
+ }
+
+ static void testModuleTrace(String... args) throws Exception {
+ OutputAnalyzer output = run(args);
output.shouldContain("define_javabase_module(): Definition of module:");
output.shouldContain("define_javabase_module(): creation of package");
output.shouldContain("define_module(): creation of module");
@@ -48,5 +55,22 @@
output.shouldContain("Setting package: class:");
output.shouldHaveExitValue(0);
}
+
+ static void testModuleLoad(String... args) throws Exception {
+ OutputAnalyzer output = run(args);
+ output.shouldContain("java.base location:");
+ output.shouldContain("java.management location:");
+ output.shouldHaveExitValue(0);
+ }
+
+ static void testModuleUnload(String... args) throws Exception {
+ OutputAnalyzer output = run(args);
+ output.shouldHaveExitValue(0);
+ }
+
+ static OutputAnalyzer run(String... args) throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
+ return new OutputAnalyzer(pb.start());
+ }
}