8368885: NMT CommandLine tests can check for error better

Reviewed-by: phubner, azafari, shade
This commit is contained in:
Johan Sjölen 2025-10-01 09:01:19 +00:00
parent f49849a5ed
commit 84e5d63b9f
2 changed files with 22 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2025, 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
@ -35,13 +35,14 @@ import jdk.test.lib.process.OutputAnalyzer;
public class CommandLineDetail {
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:NativeMemoryTracking=detail",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-Xlog:nmt=warning",
"-XX:NativeMemoryTracking=detail",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldNotContain("NMT initialization failed");
output.shouldNotContain("Could not create the Java Virtual Machine.");
output.shouldHaveExitValue(0);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2025, 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
@ -35,13 +35,14 @@ import jdk.test.lib.process.OutputAnalyzer;
public class CommandLineSummary {
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:NativeMemoryTracking=summary",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-Xlog:nmt=warning",
"-XX:NativeMemoryTracking=summary",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldNotContain("NMT initialization failed");
output.shouldNotContain("Could not create the Java Virtual Machine.");
output.shouldHaveExitValue(0);
}
}