8319569: Several java/util tests should be updated to accept VM flags
Reviewed-by: naoto, lancea
This commit is contained in:
parent
6016536ab9
commit
2bb4b9398d
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2023, 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
|
||||||
@ -34,10 +34,15 @@ import java.util.Calendar;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import static java.util.Calendar.*;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static java.util.Calendar.DAY_OF_YEAR;
|
||||||
|
import static java.util.Calendar.ERA;
|
||||||
|
import static java.util.Calendar.FEBRUARY;
|
||||||
|
import static java.util.Calendar.LONG;
|
||||||
|
import static java.util.Calendar.YEAR;
|
||||||
|
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
|
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
@ -91,19 +96,18 @@ public class SupplementalJapaneseEraTestRun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void testRun(String property, List<String> javaParam)
|
private static void testRun(String property, List<String> javaParam)
|
||||||
throws Throwable{
|
throws Throwable {
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
|
List<String> params = List.of(
|
||||||
launcher.addToolArg("-ea")
|
"-ea", "-esa",
|
||||||
.addToolArg("-esa")
|
"-cp", Utils.TEST_CLASS_PATH,
|
||||||
.addToolArg("-cp")
|
"-Djdk.calendar.japanese.supplemental.era=" + property,
|
||||||
.addToolArg(Utils.TEST_CLASS_PATH)
|
"SupplementalJapaneseEraTest");
|
||||||
.addToolArg("-Djdk.calendar.japanese.supplemental.era=" + property)
|
// Build process (with VM flags)
|
||||||
.addToolArg("SupplementalJapaneseEraTest");
|
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
|
||||||
for (String para: javaParam) {
|
Stream.concat(params.stream(), javaParam.stream()).toList());
|
||||||
launcher.addToolArg(para);
|
// Evaluate process status
|
||||||
}
|
int exitCode = ProcessTools.executeCommand(pb).getExitValue();
|
||||||
int exitCode = ProcessTools.executeCommand(launcher.getCommand())
|
|
||||||
.getExitValue();
|
|
||||||
System.out.println(property + ":pass");
|
System.out.println(property + ":pass");
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
System.out.println(property + ":fail");
|
System.out.println(property + ":fail");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2007, 2023, 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
|
||||||
@ -76,7 +76,7 @@ failures=0
|
|||||||
|
|
||||||
run() {
|
run() {
|
||||||
echo ''
|
echo ''
|
||||||
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} $* 2>&1
|
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} -cp ${TESTCLASSES} $* 2>&1
|
||||||
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,23 +110,23 @@ echo "Properties location: ${PROPLOCATION}"
|
|||||||
|
|
||||||
# run
|
# run
|
||||||
echo ''
|
echo ''
|
||||||
${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest -d dump3
|
${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} -cp ${TESTCLASSES} PropertiesTest -d dump3
|
||||||
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
||||||
if [ ! -f dump3 ]; then echo "file dump3 not created. Test cannot execute. Failed."; exit 1; fi
|
if [ ! -f dump3 ]; then echo "file dump3 not created. Test cannot execute. Failed."; exit 1; fi
|
||||||
|
|
||||||
# run bug7102969 test
|
# run bug7102969 test
|
||||||
echo ''
|
echo ''
|
||||||
${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest bug7102969
|
${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} -cp ${TESTCLASSES} PropertiesTest bug7102969
|
||||||
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
||||||
|
|
||||||
# run bug8157138 test
|
# run bug8157138 test
|
||||||
echo ''
|
echo ''
|
||||||
${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest bug8157138
|
${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} -cp ${TESTCLASSES} PropertiesTest bug8157138
|
||||||
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
||||||
|
|
||||||
# run bug8190904 test
|
# run bug8190904 test
|
||||||
echo ''
|
echo ''
|
||||||
${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest bug8190904
|
${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} ${TESTJAVAOPTS} -cp ${TESTCLASSES} PropertiesTest bug8190904
|
||||||
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2023, 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
|
||||||
@ -39,7 +39,6 @@
|
|||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
|
|
||||||
@ -178,22 +177,18 @@ public class LocaleProvidersRun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void testRun(String prefList, String methodName,
|
private static void testRun(String prefList, String methodName,
|
||||||
String param1, String param2, String param3) throws Throwable{
|
String param1, String param2, String param3) throws Throwable {
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
|
|
||||||
launcher.addToolArg("-ea")
|
// Build process (with VM flags)
|
||||||
.addToolArg("-esa")
|
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
|
||||||
.addToolArg("-cp")
|
"-ea", "-esa",
|
||||||
.addToolArg(Utils.TEST_CLASS_PATH)
|
"-cp", Utils.TEST_CLASS_PATH,
|
||||||
.addToolArg("-Djava.util.logging.config.class=LocaleProviders$LogConfig")
|
"-Djava.util.logging.config.class=LocaleProviders$LogConfig",
|
||||||
.addToolArg("-Djava.locale.providers=" + prefList)
|
"-Djava.locale.providers=" + prefList,
|
||||||
.addToolArg("--add-exports=java.base/sun.util.locale.provider=ALL-UNNAMED")
|
"--add-exports=java.base/sun.util.locale.provider=ALL-UNNAMED",
|
||||||
.addToolArg("LocaleProviders")
|
"LocaleProviders", methodName, param1, param2, param3);
|
||||||
.addToolArg(methodName)
|
// Evaluate process status
|
||||||
.addToolArg(param1)
|
int exitCode = ProcessTools.executeCommand(pb).getExitValue();
|
||||||
.addToolArg(param2)
|
|
||||||
.addToolArg(param3);
|
|
||||||
int exitCode = ProcessTools.executeCommand(launcher.getCommand())
|
|
||||||
.getExitValue();
|
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
throw new RuntimeException("Unexpected exit code: " + exitCode);
|
throw new RuntimeException("Unexpected exit code: " + exitCode);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2023, 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
|
||||||
@ -84,15 +84,13 @@ public class MissingResourceCauseTestRun {
|
|||||||
// UnreadableRB.properties is in current directory
|
// UnreadableRB.properties is in current directory
|
||||||
String cp = Utils.TEST_CLASSES + File.pathSeparator + Utils.TEST_SRC
|
String cp = Utils.TEST_CLASSES + File.pathSeparator + Utils.TEST_SRC
|
||||||
+ File.pathSeparator + ".";
|
+ File.pathSeparator + ".";
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
|
// Build process (with VM flags)
|
||||||
launcher.addToolArg("-ea")
|
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
|
||||||
.addToolArg("-esa")
|
"-ea", "-esa",
|
||||||
.addToolArg("-cp")
|
"-cp", cp,
|
||||||
.addToolArg(cp)
|
"MissingResourceCauseTest");
|
||||||
.addToolArg("MissingResourceCauseTest");
|
// Evaluate process status
|
||||||
|
int exitCode = ProcessTools.executeCommand(pb).getExitValue();
|
||||||
int exitCode = ProcessTools.executeCommand(launcher.getCommand())
|
|
||||||
.getExitValue();
|
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
throw new RuntimeException("Execution of the test failed. "
|
throw new RuntimeException("Execution of the test failed. "
|
||||||
+ "Unexpected exit code: " + exitCode);
|
+ "Unexpected exit code: " + exitCode);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2023, 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
|
||||||
@ -29,6 +29,7 @@ import java.util.List;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
|
import jdk.test.lib.Utils;
|
||||||
import jdk.test.lib.compiler.CompilerUtils;
|
import jdk.test.lib.compiler.CompilerUtils;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
|
||||||
@ -133,17 +134,15 @@ public class ModuleTestUtil {
|
|||||||
*/
|
*/
|
||||||
public static void runModule(String mp, String mn, List<String> localeList)
|
public static void runModule(String mp, String mn, List<String> localeList)
|
||||||
throws Throwable {
|
throws Throwable {
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
|
List<String> args = List.of(
|
||||||
launcher.addToolArg("-ea")
|
"-ea", "-esa",
|
||||||
.addToolArg("-esa")
|
"-p", mp,
|
||||||
.addToolArg("-p")
|
"-m", mn);
|
||||||
.addToolArg(mp)
|
// Build process (with VM flags)
|
||||||
.addToolArg("-m")
|
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
|
||||||
.addToolArg(mn);
|
Stream.concat(args.stream(), localeList.stream()).toList());
|
||||||
localeList.forEach(launcher::addToolArg);
|
// Evaluate process status
|
||||||
|
int exitCode = ProcessTools.executeCommand(pb).getExitValue();
|
||||||
int exitCode = ProcessTools.executeCommand(launcher.getCommand())
|
|
||||||
.getExitValue();
|
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
throw new RuntimeException("Execution of the test failed. "
|
throw new RuntimeException("Execution of the test failed. "
|
||||||
+ "Unexpected exit code: " + exitCode);
|
+ "Unexpected exit code: " + exitCode);
|
||||||
@ -161,19 +160,17 @@ public class ModuleTestUtil {
|
|||||||
*/
|
*/
|
||||||
public static void runModuleWithCp(String cp, String mp, String mn,
|
public static void runModuleWithCp(String cp, String mp, String mn,
|
||||||
List<String> localeList, boolean expected) throws Throwable {
|
List<String> localeList, boolean expected) throws Throwable {
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
|
List<String> args = List.of(
|
||||||
launcher.addToolArg("-ea")
|
"-ea", "-esa",
|
||||||
.addToolArg("-esa")
|
"-cp", cp,
|
||||||
.addToolArg("-cp")
|
"-p", mp,
|
||||||
.addToolArg(cp)
|
"-m", mn);
|
||||||
.addToolArg("-p")
|
// Build process (with VM flags)
|
||||||
.addToolArg(mp)
|
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
|
||||||
.addToolArg("-m")
|
Stream.concat(args.stream(), localeList.stream()).toList());
|
||||||
.addToolArg(mn);
|
// Evaluate process status
|
||||||
localeList.forEach(launcher::addToolArg);
|
int exitCode = ProcessTools.executeCommand(pb).getExitValue();
|
||||||
|
|
||||||
int exitCode = ProcessTools.executeCommand(launcher.getCommand())
|
|
||||||
.getExitValue();
|
|
||||||
if (expected) {
|
if (expected) {
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
throw new RuntimeException("Execution of the test loads bundles "
|
throw new RuntimeException("Execution of the test loads bundles "
|
||||||
@ -198,18 +195,17 @@ public class ModuleTestUtil {
|
|||||||
*/
|
*/
|
||||||
public static void runModuleWithLegacyCode(String mp, String mn, List<String> localeList)
|
public static void runModuleWithLegacyCode(String mp, String mn, List<String> localeList)
|
||||||
throws Throwable {
|
throws Throwable {
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
|
List<String> args = List.of(
|
||||||
launcher.addToolArg("-ea")
|
"-ea", "-esa",
|
||||||
.addToolArg("-esa")
|
"-Djava.locale.useOldISOCodes=true",
|
||||||
.addToolArg("-Djava.locale.useOldISOCodes=true")
|
"-p", mp,
|
||||||
.addToolArg("-p")
|
"-m", mn);
|
||||||
.addToolArg(mp)
|
// Build process (with VM flags)
|
||||||
.addToolArg("-m")
|
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
|
||||||
.addToolArg(mn);
|
Stream.concat(args.stream(), localeList.stream()).toList());
|
||||||
localeList.forEach(launcher::addToolArg);
|
// Evaluate process status
|
||||||
|
int exitCode = ProcessTools.executeCommand(pb).getExitValue();
|
||||||
|
|
||||||
int exitCode = ProcessTools.executeCommand(launcher.getCommand())
|
|
||||||
.getExitValue();
|
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
throw new RuntimeException("Execution of the test failed. "
|
throw new RuntimeException("Execution of the test failed. "
|
||||||
+ "Unexpected exit code: " + exitCode);
|
+ "Unexpected exit code: " + exitCode);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2023, 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
|
||||||
@ -71,16 +71,13 @@ public class LayerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void runCmd() throws Throwable {
|
private static void runCmd() throws Throwable {
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
|
// Build process (with VM flags)
|
||||||
launcher.addToolArg("-ea")
|
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
|
||||||
.addToolArg("-esa")
|
"-ea", "-esa",
|
||||||
.addToolArg("-cp")
|
"-cp", Utils.TEST_CLASSES,
|
||||||
.addToolArg(Utils.TEST_CLASSES)
|
"Main", Utils.TEST_CLASSES);
|
||||||
.addToolArg("Main")
|
// Evaluate process status
|
||||||
.addToolArg(Utils.TEST_CLASSES);
|
int exitCode = ProcessTools.executeCommand(pb).getExitValue();
|
||||||
|
|
||||||
int exitCode = ProcessTools.executeCommand(launcher.getCommand())
|
|
||||||
.getExitValue();
|
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
throw new RuntimeException("Execution of the test failed. "
|
throw new RuntimeException("Execution of the test failed. "
|
||||||
+ "Unexpected exit code: " + exitCode);
|
+ "Unexpected exit code: " + exitCode);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2023, 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
|
||||||
@ -39,6 +39,7 @@
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
@ -73,42 +74,34 @@ public class UnNamedTest {
|
|||||||
|
|
||||||
private static void runCmd() throws Throwable {
|
private static void runCmd() throws Throwable {
|
||||||
// access resource bundles that are exported private unconditionally.
|
// access resource bundles that are exported private unconditionally.
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
|
List<String> args = List.of(
|
||||||
launcher.addToolArg("-ea")
|
"-ea", "-esa",
|
||||||
.addToolArg("-esa")
|
"-cp", Utils.TEST_CLASSES,
|
||||||
.addToolArg("-cp")
|
"--module-path", MODS_DIR.toString(),
|
||||||
.addToolArg(Utils.TEST_CLASSES)
|
"--add-modules", "bundles",
|
||||||
.addToolArg("--module-path")
|
"Main");
|
||||||
.addToolArg(MODS_DIR.toString())
|
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
|
||||||
.addToolArg("--add-modules")
|
Stream.concat(args.stream(), LOCALE_LIST.stream()).toList());
|
||||||
.addToolArg("bundles")
|
// Evaluate process status
|
||||||
.addToolArg("Main");
|
int exitCode = ProcessTools.executeCommand(pb).getExitValue();
|
||||||
LOCALE_LIST.forEach(launcher::addToolArg);
|
|
||||||
|
|
||||||
int exitCode = ProcessTools.executeCommand(launcher.getCommand())
|
|
||||||
.getExitValue();
|
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
throw new RuntimeException("Execution of the test1 failed. "
|
throw new RuntimeException("Execution of the test1 failed. "
|
||||||
+ "Unexpected exit code: " + exitCode);
|
+ "Unexpected exit code: " + exitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --add-exports can't open resources
|
// --add-exports can't open resources
|
||||||
launcher = JDKToolLauncher.createUsingTestJDK("java");
|
List<String> argsWithOpens = List.of(
|
||||||
launcher.addToolArg("-ea")
|
"-ea", "-esa",
|
||||||
.addToolArg("-esa")
|
"-cp", Utils.TEST_CLASSES,
|
||||||
.addToolArg("-cp")
|
"--module-path", MODS_DIR.toString(),
|
||||||
.addToolArg(Utils.TEST_CLASSES)
|
"--add-modules", "bundles",
|
||||||
.addToolArg("--module-path")
|
"--add-opens", "bundles/jdk.test.internal.resources=ALL-UNNAMED",
|
||||||
.addToolArg(MODS_DIR.toString())
|
"Main");
|
||||||
.addToolArg("--add-modules")
|
pb = ProcessTools.createTestJavaProcessBuilder(
|
||||||
.addToolArg("bundles")
|
Stream.concat(argsWithOpens.stream(), LOCALE_LIST.stream()).toList());
|
||||||
.addToolArg("--add-opens")
|
|
||||||
.addToolArg("bundles/jdk.test.internal.resources=ALL-UNNAMED")
|
|
||||||
.addToolArg("Main");
|
|
||||||
LOCALE_LIST.forEach(launcher::addToolArg);
|
|
||||||
|
|
||||||
exitCode = ProcessTools.executeCommand(launcher.getCommand())
|
// Evaluate process status
|
||||||
.getExitValue();
|
exitCode = ProcessTools.executeCommand(pb).getExitValue();
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
throw new RuntimeException("Execution of the test2 failed. "
|
throw new RuntimeException("Execution of the test2 failed. "
|
||||||
+ "Unexpected exit code: " + exitCode);
|
+ "Unexpected exit code: " + exitCode);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2019, 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.
|
* 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
|
||||||
@ -39,10 +39,12 @@
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.Utils;
|
import jdk.test.lib.Utils;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
@ -328,11 +330,10 @@ public class VisibilityTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int runCmd(List<String> argsList) throws Throwable {
|
private int runCmd(List<String> argsList) throws Throwable {
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
|
// Build process (with VM flags)
|
||||||
launcher.addToolArg("-ea")
|
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
|
||||||
.addToolArg("-esa");
|
Stream.concat(Stream.of("-ea", "-esa"), argsList.stream()).toList());
|
||||||
argsList.forEach(launcher::addToolArg);
|
// Evaluate process status
|
||||||
|
return ProcessTools.executeCommand(pb).getExitValue();
|
||||||
return ProcessTools.executeCommand(launcher.getCommand()).getExitValue();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -29,16 +29,18 @@
|
|||||||
* @requires os.family != "windows"
|
* @requires os.family != "windows"
|
||||||
* @run main/othervm CustomTzIDCheckDST
|
* @run main/othervm CustomTzIDCheckDST
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.SimpleTimeZone;
|
import java.util.SimpleTimeZone;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.time.temporal.TemporalAdjusters;
|
import java.time.temporal.TemporalAdjusters;
|
||||||
|
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
|
||||||
public class CustomTzIDCheckDST {
|
public class CustomTzIDCheckDST {
|
||||||
// Northern Hemisphere
|
// Northern Hemisphere
|
||||||
private static String CUSTOM_TZ = "MEZ-1MESZ,M3.5.0,M10.5.0/3";
|
private static String CUSTOM_TZ = "MEZ-1MESZ,M3.5.0,M10.5.0/3";
|
||||||
@ -46,7 +48,7 @@ public class CustomTzIDCheckDST {
|
|||||||
private static String CUSTOM_TZ2 = "MEZ-1MESZ,M10.5.0,M3.5.0/3";
|
private static String CUSTOM_TZ2 = "MEZ-1MESZ,M10.5.0,M3.5.0/3";
|
||||||
public static void main(String args[]) throws Throwable {
|
public static void main(String args[]) throws Throwable {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(List.of("CustomTzIDCheckDST", "runTZTest"));
|
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("CustomTzIDCheckDST", "runTZTest");
|
||||||
pb.environment().put("TZ", CUSTOM_TZ);
|
pb.environment().put("TZ", CUSTOM_TZ);
|
||||||
OutputAnalyzer output = ProcessTools.executeProcess(pb);
|
OutputAnalyzer output = ProcessTools.executeProcess(pb);
|
||||||
output.shouldHaveExitValue(0);
|
output.shouldHaveExitValue(0);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2009, 2023, 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
|
||||||
@ -66,17 +66,15 @@ public class TimeZoneDatePermissionCheckRun {
|
|||||||
//run it with the security manager on, plus accesscontroller debugging
|
//run it with the security manager on, plus accesscontroller debugging
|
||||||
//will go into infinite recursion trying to get enough permissions for
|
//will go into infinite recursion trying to get enough permissions for
|
||||||
//printing Date of failing certificate unless fix is applied.
|
//printing Date of failing certificate unless fix is applied.
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
|
// Build process (with VM flags)
|
||||||
launcher.addToolArg("-Djava.security.manager")
|
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
|
||||||
.addToolArg("-Djava.security.debug=access,failure,policy")
|
"-Djava.security.manager",
|
||||||
.addToolArg("-ea")
|
"-Djava.security.debug=access,failure,policy",
|
||||||
.addToolArg("-esa")
|
"-ea", "-esa",
|
||||||
.addToolArg("-cp")
|
"-cp", jarPath,
|
||||||
.addToolArg(jarPath)
|
"TimeZoneDatePermissionCheck");
|
||||||
.addToolArg("TimeZoneDatePermissionCheck");
|
// Evaluate process status
|
||||||
|
int exitCode = ProcessTools.executeCommand(pb).getExitValue();
|
||||||
int exitCode = ProcessTools.executeCommand(launcher.getCommand())
|
|
||||||
.getExitValue();
|
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
throw new RuntimeException("Unexpected exit code: " + exitCode);
|
throw new RuntimeException("Unexpected exit code: " + exitCode);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2023, 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
|
||||||
@ -25,11 +25,12 @@
|
|||||||
* @test
|
* @test
|
||||||
* @bug 6467152 6716076 6829503 8132550
|
* @bug 6467152 6716076 6829503 8132550
|
||||||
* @summary deadlock occurs in LogManager initialization and JVM termination
|
* @summary deadlock occurs in LogManager initialization and JVM termination
|
||||||
|
* @key randomness
|
||||||
|
* @library /test/lib
|
||||||
* @author Serguei Spitsyn / Hitachi / Martin Buchholz
|
* @author Serguei Spitsyn / Hitachi / Martin Buchholz
|
||||||
*
|
*
|
||||||
* @build LoggingDeadlock2
|
* @build LoggingDeadlock2
|
||||||
* @run main LoggingDeadlock2
|
* @run main LoggingDeadlock2
|
||||||
* @key randomness
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -50,7 +51,6 @@
|
|||||||
* This is a regression test for this bug.
|
* This is a regression test for this bug.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.CyclicBarrier;
|
import java.util.concurrent.CyclicBarrier;
|
||||||
@ -63,6 +63,8 @@ import java.io.InputStreamReader;
|
|||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
|
||||||
public class LoggingDeadlock2 {
|
public class LoggingDeadlock2 {
|
||||||
|
|
||||||
// ask child process to dumpstack after 60secs
|
// ask child process to dumpstack after 60secs
|
||||||
@ -74,7 +76,9 @@ public class LoggingDeadlock2 {
|
|||||||
public static void realMain(String arg[]) throws Throwable {
|
public static void realMain(String arg[]) throws Throwable {
|
||||||
try {
|
try {
|
||||||
System.out.println(javaChildArgs);
|
System.out.println(javaChildArgs);
|
||||||
ProcessBuilder pb = new ProcessBuilder(javaChildArgs);
|
// Build process (with VM flags)
|
||||||
|
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
|
||||||
|
javaChildArgs);
|
||||||
ProcessResults r = run(pb.start());
|
ProcessResults r = run(pb.start());
|
||||||
equal(r.exitValue(), 99);
|
equal(r.exitValue(), 99);
|
||||||
|
|
||||||
@ -151,9 +155,6 @@ public class LoggingDeadlock2 {
|
|||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
// The rest of this test is copied from ProcessBuilder/Basic.java
|
// The rest of this test is copied from ProcessBuilder/Basic.java
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
private static final String javaExe =
|
|
||||||
System.getProperty("java.home") +
|
|
||||||
File.separator + "bin" + File.separator + "java";
|
|
||||||
private static final String jstackExe =
|
private static final String jstackExe =
|
||||||
System.getProperty("java.home") +
|
System.getProperty("java.home") +
|
||||||
File.separator + "bin" + File.separator + "jstack";
|
File.separator + "bin" + File.separator + "jstack";
|
||||||
@ -161,10 +162,8 @@ public class LoggingDeadlock2 {
|
|||||||
private static final String classpath =
|
private static final String classpath =
|
||||||
System.getProperty("java.class.path");
|
System.getProperty("java.class.path");
|
||||||
|
|
||||||
private static final List<String> javaChildArgs =
|
private static final List<String> javaChildArgs = List.of(
|
||||||
Arrays.asList(new String[]
|
"-classpath", classpath, "LoggingDeadlock2$JavaChild");
|
||||||
{ javaExe, "-classpath", classpath,
|
|
||||||
"LoggingDeadlock2$JavaChild"});
|
|
||||||
|
|
||||||
private static class ProcessResults {
|
private static class ProcessResults {
|
||||||
private final String out;
|
private final String out;
|
||||||
|
@ -37,7 +37,6 @@ import java.nio.file.Files;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
@ -161,11 +160,7 @@ public class EntryCount64k {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check java -jar
|
// Check java -jar
|
||||||
String javaHome = System.getProperty("java.home");
|
OutputAnalyzer a = ProcessTools.executeTestJvm("-jar", zipFile.getName());
|
||||||
String java = Paths.get(javaHome, "bin", "java").toString();
|
|
||||||
String[] cmd = { java, "-jar", zipFile.getName() };
|
|
||||||
ProcessBuilder pb = new ProcessBuilder(cmd);
|
|
||||||
OutputAnalyzer a = ProcessTools.executeProcess(pb);
|
|
||||||
a.shouldHaveExitValue(0);
|
a.shouldHaveExitValue(0);
|
||||||
a.stdoutShouldMatch("\\AMain\\Z");
|
a.stdoutShouldMatch("\\AMain\\Z");
|
||||||
a.stderrShouldMatch("\\A\\Z");
|
a.stderrShouldMatch("\\A\\Z");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user