Skip to content
Permalink
Browse files
8272553: several hotspot runtime/CommandLine tests don't check exit code
Reviewed-by: dholmes
  • Loading branch information
iignatev committed Aug 23, 2021
1 parent 1884072 commit 709b5910c35ad081b2367435cbc689414098b87a
Showing 7 changed files with 21 additions and 7 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, 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
@@ -48,6 +48,8 @@ public static void main(String[] args) throws Exception {

pb = ProcessTools.createJavaProcessBuilder("-XX:CompileCommandFile=hs_comp.txt", "-version");
output = new OutputAnalyzer(pb.start());
// problems in CompileCommandFile are treated as warnings
output.shouldHaveExitValue(0);
output.shouldContain("An error occurred during parsing");
output.shouldContain("Unrecognized option 'aaa'");
output.shouldContain("aaa, aaa");
@@ -60,6 +62,7 @@ public static void main(String[] args) throws Exception {

pb = ProcessTools.createJavaProcessBuilder("-version");
output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(0);
output.shouldContain("warning: .hotspot_compiler file is present but has been ignored. Run with -XX:CompileCommandFile=.hotspot_compiler to load the file.");
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, 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
@@ -59,6 +59,7 @@ public static void main(String[] args) throws Exception {

pb = ProcessTools.createJavaProcessBuilder("-version");
output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(0);
output.shouldContain("warning: .hotspotrc file is present but has been ignored. Run with -XX:Flags=.hotspotrc to load the file.");
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, 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
@@ -52,6 +52,7 @@ public static void main(String[] args) throws Exception {
"-XX:+" + flag, "-version");

OutputAnalyzer output2 = new OutputAnalyzer(pb2.start());
output2.shouldHaveExitValue(0);
output2.shouldContain("Ignoring option").shouldContain("support was removed");
output2.shouldContain(flag);
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, 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
@@ -48,6 +48,7 @@ public static void main(String args[]) throws Exception {

// UnlockDiagnostic turned off, should fail
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldNotHaveExitValue(0);
output.shouldContain("Error: VM option 'LogTouchedMethods' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions.");
output.shouldContain("Error: Could not create the Java Virtual Machine.");

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, 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
@@ -47,6 +47,7 @@ public static void main(String args[]) throws Exception {
pb = ProcessTools.createJavaProcessBuilder(
"-XX:SharedBaseAddress=1D000000", "-version");
output = new OutputAnalyzer(pb.start());
output.shouldNotHaveExitValue(0);
output.shouldContain("Could not create the Java Virtual Machine");
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, 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
@@ -42,18 +42,21 @@ public static void main(String[] args) throws Exception {
"-XX:+IgnoreUnrecognizedVMOptions",
"-XX:+PrintFlagsInitial");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(0);
output.shouldContain("bool UseSerialGC");

pb = ProcessTools.createJavaProcessBuilder(
"-XX:-PrintVMOptions", "-version");
output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(0);
output.shouldMatch("(openjdk|java)\\sversion");

File dir = new File(System.getProperty("test.src", "."));
File file = new File(dir, "flagfile.txt");
String s = file.getAbsolutePath();
pb = ProcessTools.createJavaProcessBuilder("-XX:Flags="+s);
output = new OutputAnalyzer(pb.start());
output.shouldNotHaveExitValue(0);
output.shouldContain("VM option '-IgnoreUnrecognizedVMOptions'");
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, 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
@@ -39,6 +39,7 @@ public class VMOptionWarning {
public static void main(String[] args) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+AlwaysSafeConstructors", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldNotHaveExitValue(0);
output.shouldContain("Error: VM option 'AlwaysSafeConstructors' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions.");

if (Platform.isDebugBuild()) {
@@ -48,14 +49,17 @@ public static void main(String[] args) throws Exception {

pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintInlining", "-version");
output = new OutputAnalyzer(pb.start());
output.shouldNotHaveExitValue(0);
output.shouldContain("Error: VM option 'PrintInlining' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions.");

pb = ProcessTools.createJavaProcessBuilder("-XX:+VerifyStack", "-version");
output = new OutputAnalyzer(pb.start());
output.shouldNotHaveExitValue(0);
output.shouldContain("Error: VM option 'VerifyStack' is develop and is available only in debug version of VM.");

pb = ProcessTools.createJavaProcessBuilder("-XX:+CheckCompressedOops", "-version");
output = new OutputAnalyzer(pb.start());
output.shouldNotHaveExitValue(0);
output.shouldContain("Error: VM option 'CheckCompressedOops' is notproduct and is available only in debug version of VM.");
}
}

3 comments on commit 709b591

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 709b591 Aug 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 709b591 Jan 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 709b591 Jan 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin the backport was successfully created on the branch GoeLin-backport-709b5910 in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 709b5910 from the openjdk/jdk repository.

The commit being backported was authored by Igor Ignatyev on 23 Aug 2021 and was reviewed by David Holmes.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev GoeLin-backport-709b5910:GoeLin-backport-709b5910
$ git checkout GoeLin-backport-709b5910
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev GoeLin-backport-709b5910

Please sign in to comment.