Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions test/hotspot/jtreg/serviceability/logging/TestLogRotation.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, 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
Expand Down Expand Up @@ -27,7 +27,7 @@
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
* @run main/othervm/timeout=600 TestLogRotation
* @run driver/timeout=600 TestLogRotation
*
*/
import jdk.test.lib.process.ProcessTools;
Expand Down Expand Up @@ -78,16 +78,10 @@ public static void runTest(int numberOfFiles) throws Exception {
"-Xlog:gc=debug:" + logFileName + "::filesize=" + logFileSizeK + "k,filecount=" + numberOfFiles,
"-XX:-DisableExplicitGC", // to ensure that System.gc() works
"-Xmx128M"};
// System.getProperty("test.java.opts") is '' if no options is set
// need to skip such empty
String[] externalVMopts = System.getProperty("test.java.opts").length() == 0
? new String[0]
: System.getProperty("test.java.opts").split(" ");
args.addAll(Arrays.asList(externalVMopts));
args.addAll(Arrays.asList(logOpts));
args.add(GCLoggingGenerator.class.getName());
args.add(String.valueOf(numberOfFiles * logFileSizeK * 1024));
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args.toArray(new String[0]));
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, args.toArray(String[]::new));
pb.redirectErrorStream(true);
pb.redirectOutput(new File(GCLoggingGenerator.class.getName() + ".log"));
Process process = pb.start();
Expand Down