8178380: Module system implementation refresh (5/2017)

Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com>
Reviewed-by: lfoltan, hseigel, mchung, sspitsyn
This commit is contained in:
Alan Bateman 2017-05-04 07:26:28 +00:00
parent fd4f7d938a
commit aefdcda532
27 changed files with 202 additions and 120 deletions

View file

@ -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 @@ import jdk.test.lib.process.ProcessTools;
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 @@ public class ModulesTest {
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());
}
}