From 67fbd87378a9b3861f1676977f9f2b36052add29 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Wed, 21 Jun 2023 07:05:41 +0000 Subject: [PATCH] 8310143: RandomCommandsTest fails due to unexpected VM exit code after JDK-8282797 Reviewed-by: rcastanedalo, chagedorn --- .../compilercontrol/jcmd/StressAddJcmdBase.java | 2 +- .../compiler/compilercontrol/share/MultiCommand.java | 7 +++++-- .../compilercontrol/share/scenario/Executor.java | 12 ++++-------- .../compilercontrol/share/scenario/Scenario.java | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/test/hotspot/jtreg/compiler/compilercontrol/jcmd/StressAddJcmdBase.java b/test/hotspot/jtreg/compiler/compilercontrol/jcmd/StressAddJcmdBase.java index cfd9e1c4bb0..a8c57bc408a 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/jcmd/StressAddJcmdBase.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/jcmd/StressAddJcmdBase.java @@ -116,7 +116,7 @@ public abstract class StressAddJcmdBase { private class TimeLimitedExecutor extends Executor { public TimeLimitedExecutor() { /* There are no need to check the state */ - super(true, VM_OPTIONS, null, null); + super(VM_OPTIONS, null, null); } @Override diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/MultiCommand.java b/test/hotspot/jtreg/compiler/compilercontrol/share/MultiCommand.java index b043414b76a..3fceae41146 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/MultiCommand.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/MultiCommand.java @@ -56,6 +56,7 @@ public class MultiCommand extends AbstractTestBase { List testCases = new ArrayList<>(); for (Command cmd : commands) { + boolean isValid = true; String argument = null; if (validOnly && cmd == Command.NONEXISTENT) { @@ -67,6 +68,7 @@ public class MultiCommand extends AbstractTestBase { argument = Utils.getRandomElement(VALID_INTRINSIC_SAMPLES); } else { argument = Utils.getRandomElement(INVALID_INTRINSIC_SAMPLES); + isValid = false; } } @@ -78,12 +80,13 @@ public class MultiCommand extends AbstractTestBase { md = AbstractTestBase.getValidMethodDescriptor(exec); } else { md = AbstractTestBase.METHOD_GEN.generateRandomDescriptor(exec); + isValid &= md.isValid(); } CompileCommand cc; if (cmd == Command.INTRINSIC) { - cc = cmdGen.generateCompileCommand(cmd, true, md, null, argument); + cc = cmdGen.generateCompileCommand(cmd, isValid, md, null, argument); } else { - cc = cmdGen.generateCompileCommand(cmd, true, md, null); + cc = cmdGen.generateCompileCommand(cmd, isValid, md, null); } testCases.add(cc); } diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Executor.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Executor.java index 8a868e89ee6..0111d1e90a1 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Executor.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Executor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -45,7 +45,6 @@ import java.util.List; import java.util.Map; public class Executor { - private final boolean isValid; private final List vmOptions; private final Map states; private final List jcmdCommands; @@ -57,16 +56,13 @@ public class Executor { /** * Constructor * - * @param isValid shows that the input given to the VM is valid and - * VM shouldn't fail * @param vmOptions a list of VM input options * @param states a state map, or null for the non-checking execution * @param jcmdCommands a list of diagnostic commands to be preformed * on test VM */ - public Executor(boolean isValid, List vmOptions, - Map states, List jcmdCommands) { - this.isValid = isValid; + public Executor(List vmOptions, Map states, + List jcmdCommands) { if (vmOptions == null) { this.vmOptions = new ArrayList<>(); } else { @@ -77,7 +73,7 @@ public class Executor { } /** - * Executes separate VM a gets an OutputAnalyzer instance with the results + * Executes separate VM and gets an OutputAnalyzer instance with the results * of execution */ public List execute() { diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Scenario.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Scenario.java index b277ae888b2..ad168f62eda 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Scenario.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Scenario.java @@ -104,7 +104,7 @@ public final class Scenario { jcmdExecCommands.add(JcmdType.PRINT.command); } jcmdProcessor = new PrintDirectivesProcessor(directives); - executor = new Executor(isValid, vmopts, states, jcmdExecCommands); + executor = new Executor(vmopts, states, jcmdExecCommands); } /**