14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24
25
26 /*
27 * @test
28 * @bug 8221738
29 * @summary Test that subsequent crashes will overwrite the file given to -XX:ErrorFile (unless %a is specified
30 * in the error file name)
31 * @library /test/lib
32 * @modules java.base/jdk.internal.misc
33 * @requires (vm.debug == true)
34 */
35
36 import jdk.test.lib.process.OutputAnalyzer;
37 import jdk.test.lib.process.ProcessTools;
38
39 import java.io.*;
40 import java.util.regex.Pattern;
41
42 public class ErrorFileOverwriteTest {
43
44 private static File findHsErrorFileInOutput(OutputAnalyzer output) {
45
46 String hs_err_file = output.firstMatch("# *(\\S*hs_err_pid.*\\.log)", 1);
47 if(hs_err_file ==null) {
48 throw new RuntimeException("Did not find hs-err file in output.\n");
49 }
50
51 File f = new File(hs_err_file);
52 if (!f.exists()) {
53 throw new RuntimeException("hs-err file missing at "
|
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24
25
26 /*
27 * @test
28 * @bug 8221738
29 * @summary Test that subsequent crashes will overwrite the file given to -XX:ErrorFile (unless %a is specified
30 * in the error file name)
31 * @library /test/lib
32 * @modules java.base/jdk.internal.misc
33 * @requires (vm.debug == true)
34 * @run driver ErrorFileOverwriteTest
35 */
36
37 import jdk.test.lib.process.OutputAnalyzer;
38 import jdk.test.lib.process.ProcessTools;
39
40 import java.io.*;
41 import java.util.regex.Pattern;
42
43 public class ErrorFileOverwriteTest {
44
45 private static File findHsErrorFileInOutput(OutputAnalyzer output) {
46
47 String hs_err_file = output.firstMatch("# *(\\S*hs_err_pid.*\\.log)", 1);
48 if(hs_err_file ==null) {
49 throw new RuntimeException("Did not find hs-err file in output.\n");
50 }
51
52 File f = new File(hs_err_file);
53 if (!f.exists()) {
54 throw new RuntimeException("hs-err file missing at "
|