8283606: Tests may fail with zh locale on MacOS
Reviewed-by: iklam, rriggs
This commit is contained in:
parent
158d871d05
commit
7d545084f4
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -50,7 +50,8 @@ public class TestEmptyBootstrapMethodsAttr {
|
|||||||
// ======= execute test case #1
|
// ======= execute test case #1
|
||||||
// Expect a lack of main method, this implies that the class loaded correctly
|
// Expect a lack of main method, this implies that the class loaded correctly
|
||||||
// with an empty bootstrap_methods and did not generate a ClassFormatError.
|
// with an empty bootstrap_methods and did not generate a ClassFormatError.
|
||||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(className);
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||||
|
"-Duser.language=en", "-Duser.country=US", className);
|
||||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
output.shouldNotContain("java.lang.ClassFormatError");
|
output.shouldNotContain("java.lang.ClassFormatError");
|
||||||
output.shouldContain("Main method not found in class " + className);
|
output.shouldContain("Main method not found in class " + className);
|
||||||
@ -64,7 +65,8 @@ public class TestEmptyBootstrapMethodsAttr {
|
|||||||
// ======= execute test case #2
|
// ======= execute test case #2
|
||||||
// Expect a lack of main method, this implies that the class loaded correctly
|
// Expect a lack of main method, this implies that the class loaded correctly
|
||||||
// with an empty bootstrap_methods and did not generate ClassFormatError.
|
// with an empty bootstrap_methods and did not generate ClassFormatError.
|
||||||
pb = ProcessTools.createJavaProcessBuilder(className);
|
pb = ProcessTools.createJavaProcessBuilder(
|
||||||
|
"-Duser.language=en", "-Duser.country=US", className);
|
||||||
output = new OutputAnalyzer(pb.start());
|
output = new OutputAnalyzer(pb.start());
|
||||||
output.shouldNotContain("java.lang.ClassFormatError");
|
output.shouldNotContain("java.lang.ClassFormatError");
|
||||||
output.shouldContain("Main method not found in class " + className);
|
output.shouldContain("Main method not found in class " + className);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -56,6 +56,8 @@ public class TestStdDoclet {
|
|||||||
List<String> cmdArgs = new ArrayList<>();
|
List<String> cmdArgs = new ArrayList<>();
|
||||||
cmdArgs.add(javadoc.getPath());
|
cmdArgs.add(javadoc.getPath());
|
||||||
cmdArgs.addAll(Arrays.asList(
|
cmdArgs.addAll(Arrays.asList(
|
||||||
|
"-J-Duser.language=en",
|
||||||
|
"-J-Duser.country=US",
|
||||||
"-classpath", ".", // insulates us from ambient classpath
|
"-classpath", ".", // insulates us from ambient classpath
|
||||||
"-Xdoclint:none",
|
"-Xdoclint:none",
|
||||||
"-package",
|
"-package",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -69,6 +69,8 @@ public class TestUserDoclet implements Doclet {
|
|||||||
List<String> cmdArgs = new ArrayList<>();
|
List<String> cmdArgs = new ArrayList<>();
|
||||||
cmdArgs.add(javadoc.getPath());
|
cmdArgs.add(javadoc.getPath());
|
||||||
cmdArgs.addAll(Arrays.asList(
|
cmdArgs.addAll(Arrays.asList(
|
||||||
|
"-J-Duser.language=en",
|
||||||
|
"-J-Duser.country=US",
|
||||||
"-doclet", thisClassName,
|
"-doclet", thisClassName,
|
||||||
"-docletpath", testClasses.getPath(),
|
"-docletpath", testClasses.getPath(),
|
||||||
new File(testSrc, thisClassName + ".java").getPath()
|
new File(testSrc, thisClassName + ".java").getPath()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -106,7 +106,8 @@ public class EnsureNewOldDoclet extends TestRunner {
|
|||||||
// outcome: new tool and new doclet
|
// outcome: new tool and new doclet
|
||||||
@Test
|
@Test
|
||||||
public void testDefault() throws Exception {
|
public void testDefault() throws Exception {
|
||||||
setArgs("-classpath", ".", // insulates us from ambient classpath
|
setArgs("-J-Duser.language=en", "-J-Duser.country=US",
|
||||||
|
"-classpath", ".", // insulates us from ambient classpath
|
||||||
testSrc.toString());
|
testSrc.toString());
|
||||||
Task.Result tr = task.run(Task.Expect.SUCCESS);
|
Task.Result tr = task.run(Task.Expect.SUCCESS);
|
||||||
List<String> err = tr.getOutputLines(Task.OutputKind.STDERR);
|
List<String> err = tr.getOutputLines(Task.OutputKind.STDERR);
|
||||||
@ -117,7 +118,9 @@ public class EnsureNewOldDoclet extends TestRunner {
|
|||||||
// outcome: new doclet and new taglet should register
|
// outcome: new doclet and new taglet should register
|
||||||
@Test
|
@Test
|
||||||
public void testNewDocletNewTaglet() throws Exception {
|
public void testNewDocletNewTaglet() throws Exception {
|
||||||
setArgs("-classpath", ".", // ambient classpath insulation
|
setArgs("-J-Duser.language=en",
|
||||||
|
"-J-Duser.country=US",
|
||||||
|
"-classpath", ".", // ambient classpath insulation
|
||||||
"-doclet",
|
"-doclet",
|
||||||
NEW_STDDOCLET,
|
NEW_STDDOCLET,
|
||||||
"-taglet",
|
"-taglet",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -242,6 +242,9 @@ public class TestLocaleOption extends TestRunner {
|
|||||||
options.add("-J-Duser.language=" + defaultLocale.getLanguage());
|
options.add("-J-Duser.language=" + defaultLocale.getLanguage());
|
||||||
options.add("-J-Duser.country=" + defaultLocale.getCountry());
|
options.add("-J-Duser.country=" + defaultLocale.getCountry());
|
||||||
options.add("-J-Duser.variant=" + defaultLocale.getVariant());
|
options.add("-J-Duser.variant=" + defaultLocale.getVariant());
|
||||||
|
} else {
|
||||||
|
options.add("-J-Duser.language=en");
|
||||||
|
options.add("-J-Duser.country=us");
|
||||||
}
|
}
|
||||||
if (localeOption != null) {
|
if (localeOption != null) {
|
||||||
options.addAll(List.of("-locale", localeOption.toString()));
|
options.addAll(List.of("-locale", localeOption.toString()));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -125,7 +125,7 @@ public class ClassPathWithDoubleQuotesTest extends TestRunner {
|
|||||||
"and for which they are a legal filename character");
|
"and for which they are a legal filename character");
|
||||||
List<String> log = new JavacTask(tb, Task.Mode.EXEC)
|
List<String> log = new JavacTask(tb, Task.Mode.EXEC)
|
||||||
.envVar("CLASSPATH", "Ztest/jarOut/J.jar" + File.pathSeparator + "test/srcZ")
|
.envVar("CLASSPATH", "Ztest/jarOut/J.jar" + File.pathSeparator + "test/srcZ")
|
||||||
.options("-XDrawDiagnostics")
|
.options("-XDrawDiagnostics", "-J-Duser.language=en", "-J-Duser.country=US")
|
||||||
.files("test/src/A.java").run(Task.Expect.FAIL)
|
.files("test/src/A.java").run(Task.Expect.FAIL)
|
||||||
.writeAll()
|
.writeAll()
|
||||||
.getOutputLines(Task.OutputKind.STDERR);
|
.getOutputLines(Task.OutputKind.STDERR);
|
||||||
@ -138,7 +138,7 @@ public class ClassPathWithDoubleQuotesTest extends TestRunner {
|
|||||||
System.err.println("invoking javac EXEC mode with double quotes in the CLASSPATH env variable");
|
System.err.println("invoking javac EXEC mode with double quotes in the CLASSPATH env variable");
|
||||||
List<String> log2 = new JavacTask(tb, Task.Mode.EXEC)
|
List<String> log2 = new JavacTask(tb, Task.Mode.EXEC)
|
||||||
.envVar("CLASSPATH", "\"test/jarOut/J.jar" + File.pathSeparator + "test/src\"")
|
.envVar("CLASSPATH", "\"test/jarOut/J.jar" + File.pathSeparator + "test/src\"")
|
||||||
.options("-Xlint:path", "-XDrawDiagnostics")
|
.options("-Xlint:path", "-XDrawDiagnostics", "-J-Duser.language=en", "-J-Duser.country=US")
|
||||||
.files("test/src/A.java").run(Task.Expect.FAIL)
|
.files("test/src/A.java").run(Task.Expect.FAIL)
|
||||||
.writeAll()
|
.writeAll()
|
||||||
.getOutputLines(Task.OutputKind.STDERR);
|
.getOutputLines(Task.OutputKind.STDERR);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -206,6 +206,7 @@ public class OptionSmokeTest extends TestRunner {
|
|||||||
List<String> log = new JavacTask(tb, Task.Mode.EXEC)
|
List<String> log = new JavacTask(tb, Task.Mode.EXEC)
|
||||||
.envVar("JDK_JAVAC_OPTIONS",
|
.envVar("JDK_JAVAC_OPTIONS",
|
||||||
String.format("--add-exports jdk.compiler%scom.sun.tools.javac.jvm=\"ALL-UNNAMED", fileSeparator))
|
String.format("--add-exports jdk.compiler%scom.sun.tools.javac.jvm=\"ALL-UNNAMED", fileSeparator))
|
||||||
|
.options("-J-Duser.language=en", "-J-Duser.country=US")
|
||||||
.files(findJavaFiles(src))
|
.files(findJavaFiles(src))
|
||||||
.run(Task.Expect.FAIL)
|
.run(Task.Expect.FAIL)
|
||||||
.writeAll()
|
.writeAll()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -131,7 +131,8 @@ public class PlatformProviderTest implements PlatformProvider {
|
|||||||
Task.Result result =
|
Task.Result result =
|
||||||
new JavacTask(tb, Task.Mode.EXEC)
|
new JavacTask(tb, Task.Mode.EXEC)
|
||||||
.outdir(".")
|
.outdir(".")
|
||||||
.options("-J--class-path=" + System.getProperty("test.classes"),
|
.options("-J-Duser.language=en", "-J-Duser.country=US",
|
||||||
|
"-J--class-path=" + System.getProperty("test.classes"),
|
||||||
"-J--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED",
|
"-J--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED",
|
||||||
"-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
|
"-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
|
||||||
"--release",
|
"--release",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -80,10 +80,10 @@ public class MultiReleaseJar {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void basic() throws Exception {
|
public void basic() throws Exception {
|
||||||
Result r = run("jdeps --multi-release 9 -v missing.jar");
|
Result r = run("jdeps -J-Duser.language=en -J-Duser.country=US --multi-release 9 -v missing.jar");
|
||||||
checkResult(r, false, "Warning: Path does not exist: missing.jar");
|
checkResult(r, false, "Warning: Path does not exist: missing.jar");
|
||||||
|
|
||||||
r = run("jdeps -v Version.jar");
|
r = run("jdeps -J-Duser.language=en -J-Duser.country=US -v Version.jar");
|
||||||
checkResult(r, false, "--multi-release option is not set");
|
checkResult(r, false, "--multi-release option is not set");
|
||||||
|
|
||||||
r = run("jdeps --multi-release base -v Version.jar");
|
r = run("jdeps --multi-release base -v Version.jar");
|
||||||
@ -115,10 +115,10 @@ public class MultiReleaseJar {
|
|||||||
"9/test.NonPublic"
|
"9/test.NonPublic"
|
||||||
);
|
);
|
||||||
|
|
||||||
r = run("jdeps --multi-release 8 -v Version.jar");
|
r = run("jdeps -J-Duser.language=en -J-Duser.country=US --multi-release 8 -v Version.jar");
|
||||||
checkResult(r, false, "Error: invalid argument for option: 8");
|
checkResult(r, false, "Error: invalid argument for option: 8");
|
||||||
|
|
||||||
r = run("jdeps --multi-release 9.1 -v Version.jar");
|
r = run("jdeps -J-Duser.language=en -J-Duser.country=US --multi-release 9.1 -v Version.jar");
|
||||||
checkResult(r, false, "Error: invalid argument for option: 9.1");
|
checkResult(r, false, "Error: invalid argument for option: 9.1");
|
||||||
|
|
||||||
runJdeps("Main.class");
|
runJdeps("Main.class");
|
||||||
@ -127,10 +127,10 @@ public class MultiReleaseJar {
|
|||||||
|
|
||||||
|
|
||||||
private void runJdeps(String path) throws Exception {
|
private void runJdeps(String path) throws Exception {
|
||||||
Result r = run("jdeps -v -R -cp Version.jar " + path);
|
Result r = run("jdeps -J-Duser.language=en -J-Duser.country=US -v -R -cp Version.jar " + path);
|
||||||
checkResult(r, false, "--multi-release option is not set");
|
checkResult(r, false, "--multi-release option is not set");
|
||||||
|
|
||||||
r = run("jdeps -v -R -cp Version.jar --module-path Foo.jar -multi-release 9 " + path);
|
r = run("jdeps -J-Duser.language=en -J-Duser.country=US -v -R -cp Version.jar --module-path Foo.jar -multi-release 9 " + path);
|
||||||
checkResult(r, false,
|
checkResult(r, false,
|
||||||
"Error: unknown option: -multi-release",
|
"Error: unknown option: -multi-release",
|
||||||
"Usage: jdeps <options> <path",
|
"Usage: jdeps <options> <path",
|
||||||
@ -208,7 +208,7 @@ public class MultiReleaseJar {
|
|||||||
"p.Foo"
|
"p.Foo"
|
||||||
);
|
);
|
||||||
|
|
||||||
r = run("jdeps -v -R -cp Version.jar --module-path Foo.jar --multi-release 9.1 " + path);
|
r = run("jdeps -J-Duser.language=en -J-Duser.country=US -v -R -cp Version.jar --module-path Foo.jar --multi-release 9.1 " + path);
|
||||||
checkResult(r, false, "Error: invalid argument for option: 9.1");
|
checkResult(r, false, "Error: invalid argument for option: 9.1");
|
||||||
|
|
||||||
// Version_9.jar does not have any version 10 entry
|
// Version_9.jar does not have any version 10 entry
|
||||||
|
Loading…
Reference in New Issue
Block a user