< prev index next >

test/runtime/modules/ModuleStress/ModuleStress.java

Print this page




  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /*
  27  * @test
  28  * @bug 8159262
  29  * @summary Test differing scenarios where a module's readability list and a package's exportability list should be walked
  30  * @modules java.base/jdk.internal.misc
  31  * @library /testlibrary /test/lib
  32  * @compile ../AccessCheck/ModuleLibrary.java
  33  * @compile ModuleSameCLMain.java
  34  * @compile ModuleNonBuiltinCLMain.java
  35  * @compile CustomSystemClassLoader.java
  36  * @build ModuleStress
  37  * @run main/othervm ModuleStress
  38  */
  39 
  40 import jdk.test.lib.*;


  41 import java.io.File;
  42 
  43 public class ModuleStress {
  44 
  45     public static void main(String[] args) throws Exception {
  46 
  47         // Test #1: java -version
  48         //   All modules' readability lists and packages' exportability
  49         //   lists should contain only modules defined to the 3 builtin
  50         //   loaders (boot, application, platform).  Thus there is
  51         //   not a need to walk those lists at a GC safepoint since
  52         //   those loaders never die.
  53         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  54              "-Xbootclasspath/a:.",
  55              "-Xlog:modules=trace",
  56              "-version");
  57 
  58         OutputAnalyzer oa = new OutputAnalyzer(pb.start());
  59         oa.shouldNotContain("must be walked")
  60           .shouldNotContain("being walked")




  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /*
  27  * @test
  28  * @bug 8159262
  29  * @summary Test differing scenarios where a module's readability list and a package's exportability list should be walked
  30  * @modules java.base/jdk.internal.misc
  31  * @library /test/lib
  32  * @compile ../AccessCheck/ModuleLibrary.java
  33  * @compile ModuleSameCLMain.java
  34  * @compile ModuleNonBuiltinCLMain.java
  35  * @compile CustomSystemClassLoader.java

  36  * @run main/othervm ModuleStress
  37  */
  38 
  39 import jdk.test.lib.process.ProcessTools;
  40 import jdk.test.lib.process.OutputAnalyzer;
  41 import jdk.test.lib.InMemoryJavaCompiler;
  42 import java.io.File;
  43 
  44 public class ModuleStress {
  45 
  46     public static void main(String[] args) throws Exception {
  47 
  48         // Test #1: java -version
  49         //   All modules' readability lists and packages' exportability
  50         //   lists should contain only modules defined to the 3 builtin
  51         //   loaders (boot, application, platform).  Thus there is
  52         //   not a need to walk those lists at a GC safepoint since
  53         //   those loaders never die.
  54         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  55              "-Xbootclasspath/a:.",
  56              "-Xlog:modules=trace",
  57              "-version");
  58 
  59         OutputAnalyzer oa = new OutputAnalyzer(pb.start());
  60         oa.shouldNotContain("must be walked")
  61           .shouldNotContain("being walked")


< prev index next >