Skip to content

Commit

Permalink
8334057: JLinkReproducibleTest.java support receive test.tool.vm.opts
Browse files Browse the repository at this point in the history
  • Loading branch information
sendaoYan committed Jun 12, 2024
1 parent a7205cc commit 60e746f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/jdk/tools/jlink/JLinkReproducibleTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
Expand Down Expand Up @@ -37,6 +37,9 @@
* @run driver JLinkReproducibleTest
*/
public class JLinkReproducibleTest {

static final String TOOL_VM_OPTIONS = System.getProperty("test.tool.vm.opts", "");

private static void run(List<String> cmd) throws Exception {
var pb = new ProcessBuilder(cmd.toArray(new String[0]));
var res = ProcessTools.executeProcess(pb);
Expand All @@ -46,6 +49,9 @@ private static void run(List<String> cmd) throws Exception {
private static void jlink(Path image, boolean with_default_trace_file) throws Exception {
var cmd = new ArrayList<String>();
cmd.add(JDKToolFinder.getJDKTool("jlink"));
if (!TOOL_VM_OPTIONS.isEmpty()) {
cmd.addAll(Arrays.asList(TOOL_VM_OPTIONS.split("\\s+", -1)));
}
cmd.addAll(List.of(
"--module-path", JMODS_DIR.toString() + File.pathSeparator + CLASS_DIR.toString(),
"--add-modules", "main",
Expand Down

0 comments on commit 60e746f

Please sign in to comment.