From 6af3f1c6d72353ec5d40b9d1fde05771ef102141 Mon Sep 17 00:00:00 2001 From: Leonid Mesnik Date: Sat, 11 Jan 2025 22:03:00 -0800 Subject: [PATCH 1/2] updated VMProps --- test/hotspot/jtreg/TEST.ROOT | 3 ++- test/jtreg-ext/requires/VMProps.java | 32 +++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/TEST.ROOT b/test/hotspot/jtreg/TEST.ROOT index 1e5094bd11609..fdf8a117f8133 100644 --- a/test/hotspot/jtreg/TEST.ROOT +++ b/test/hotspot/jtreg/TEST.ROOT @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 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 @@ -44,6 +44,7 @@ groups=TEST.groups TEST.quick-groups requires.extraPropDefns = ../../jtreg-ext/requires/VMProps.java requires.extraPropDefns.bootlibs = ../../lib/jdk/test/whitebox requires.extraPropDefns.libs = \ + ../../lib/jdk/test/lib/JDKToolFinder.java \ ../../lib/jdk/test/lib/Platform.java \ ../../lib/jdk/test/lib/Container.java requires.extraPropDefns.javacOpts = --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index f5dcb44db2b79..b03218929f211 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -56,6 +56,7 @@ import jdk.test.whitebox.WhiteBox; import jdk.test.lib.Platform; import jdk.test.lib.Container; +import jdk.test.lib.JDKToolFinder; /** * The Class to be invoked by jtreg prior Test Suite execution to @@ -145,6 +146,7 @@ public Map call() { vmOptFinalFlags(map); dump(map.map); + dumpFlags(); log("Leaving call()"); return map.map; } @@ -696,6 +698,34 @@ private boolean checkProgramSupport(String logString, String cmd) throws IOExcep return (exitValue == 0); } + private void dumpFlags() { + log("dumpFlags() entering:"); + try { + String javapath = JDKToolFinder.getJDKTool("java"); + String options = System.getProperty("test.vm.opts", "") + + System.getProperty("test.java.opts", ""); + ArrayList args = new ArrayList<>(); + args.add(javapath); + Collections.addAll(args, options.trim().split("\\s+")); + args.add("-XX:+PrintFlagsFinal"); + args.add("-version"); + ProcessBuilder pb = new ProcessBuilder(args); + File output = new File("jvm.flags.final.log"); + pb.redirectOutput(output); + pb.redirectErrorStream(); + Process p = pb.start(); + p.waitFor(120, TimeUnit.SECONDS); + + log("The test jvm options: " + options); + log("The final jvm flags are saved to: " + output.getAbsolutePath()); + } catch (Throwable t) { + log("Erro while printing JVM flags " + t.getMessage()); + } + + log("dumpFlags() leaving:"); + } + + /** * Checks musl libc. * From 919c870e0475597f4128b663c3f303ae56d06e1c Mon Sep 17 00:00:00 2001 From: Leonid Mesnik Date: Sun, 12 Jan 2025 07:41:43 -0800 Subject: [PATCH 2/2] The test lib is not ued --- test/hotspot/jtreg/TEST.ROOT | 3 +-- test/jtreg-ext/requires/VMProps.java | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/hotspot/jtreg/TEST.ROOT b/test/hotspot/jtreg/TEST.ROOT index fdf8a117f8133..1e5094bd11609 100644 --- a/test/hotspot/jtreg/TEST.ROOT +++ b/test/hotspot/jtreg/TEST.ROOT @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2024, 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 @@ -44,7 +44,6 @@ groups=TEST.groups TEST.quick-groups requires.extraPropDefns = ../../jtreg-ext/requires/VMProps.java requires.extraPropDefns.bootlibs = ../../lib/jdk/test/whitebox requires.extraPropDefns.libs = \ - ../../lib/jdk/test/lib/JDKToolFinder.java \ ../../lib/jdk/test/lib/Platform.java \ ../../lib/jdk/test/lib/Container.java requires.extraPropDefns.javacOpts = --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index b03218929f211..1914a8dcbd582 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -56,7 +56,6 @@ import jdk.test.whitebox.WhiteBox; import jdk.test.lib.Platform; import jdk.test.lib.Container; -import jdk.test.lib.JDKToolFinder; /** * The Class to be invoked by jtreg prior Test Suite execution to @@ -701,11 +700,14 @@ private boolean checkProgramSupport(String logString, String cmd) throws IOExcep private void dumpFlags() { log("dumpFlags() entering:"); try { - String javapath = JDKToolFinder.getJDKTool("java"); + String testJdk = System.getProperty("test.jdk"); + String toolName = "java" + (Platform.isWindows() ? ".exe" : ""); + Path javaPath = Paths.get(testJdk, "bin", toolName); + String options = System.getProperty("test.vm.opts", "") + System.getProperty("test.java.opts", ""); ArrayList args = new ArrayList<>(); - args.add(javapath); + args.add(javaPath.toAbsolutePath().toString()); Collections.addAll(args, options.trim().split("\\s+")); args.add("-XX:+PrintFlagsFinal"); args.add("-version");