Merge
This commit is contained in:
commit
d8510ea0c1
make/autoconf
src
hotspot/share
gc/shenandoah/c2
jfr
jdk.jfr/share/classes/jdk/jfr/internal/dcmd
jdk.jlink/share/classes/jdk/tools/jmod
jdk.jshell/share/classes/jdk/internal/jshell/tool
test
@ -782,7 +782,10 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
if test "x$FLAGS_CPU" = xarm; then
|
||||
if test "x$FLAGS_CPU" = xaarch64; then
|
||||
# -Wno-psabi to get rid of annoying "note: parameter passing for argument of type '<type> changed in GCC 9.1"
|
||||
$1_CFLAGS_CPU="-Wno-psabi"
|
||||
elif test "x$FLAGS_CPU" = xarm; then
|
||||
# -Wno-psabi to get rid of annoying "note: the mangling of 'va_list' has changed in GCC 4.4"
|
||||
$1_CFLAGS_CPU="-fsigned-char -Wno-psabi $ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS -DJDK_ARCH_ABI_PROP_NAME='\"\$(JDK_ARCH_ABI_PROP_NAME)\"'"
|
||||
$1_CFLAGS_CPU_JVM="-DARM"
|
||||
|
@ -879,7 +879,7 @@ void ShenandoahBarrierC2Support::test_gc_state(Node*& ctrl, Node* raw_mem, Node*
|
||||
ctrl = new IfTrueNode(gc_state_iff);
|
||||
test_fail_ctrl = new IfFalseNode(gc_state_iff);
|
||||
|
||||
IdealLoopTree* loop = phase->get_loop(ctrl);
|
||||
IdealLoopTree* loop = phase->get_loop(old_ctrl);
|
||||
phase->register_control(gc_state_iff, loop, old_ctrl);
|
||||
phase->register_control(ctrl, loop, gc_state_iff);
|
||||
phase->register_control(test_fail_ctrl, loop, gc_state_iff);
|
||||
|
@ -563,7 +563,8 @@ JfrConfigureFlightRecorderDCmd::JfrConfigureFlightRecorderDCmd(outputStream* out
|
||||
_thread_buffer_size("thread_buffer_size", "Size of a thread buffer", "MEMORY SIZE", false, "8k"),
|
||||
_memory_size("memorysize", "Overall memory size, ", "MEMORY SIZE", false, "10m"),
|
||||
_max_chunk_size("maxchunksize", "Size of an individual disk chunk", "MEMORY SIZE", false, "12m"),
|
||||
_sample_threads("samplethreads", "Activate Thread sampling", "BOOLEAN", false, "true") {
|
||||
_sample_threads("samplethreads", "Activate Thread sampling", "BOOLEAN", false, "true"),
|
||||
_verbose(true) {
|
||||
_dcmdparser.add_dcmd_option(&_repository_path);
|
||||
_dcmdparser.add_dcmd_option(&_dump_path);
|
||||
_dcmdparser.add_dcmd_option(&_stack_depth);
|
||||
@ -650,7 +651,7 @@ void JfrConfigureFlightRecorderDCmd::execute(DCmdSource source, TRAPS) {
|
||||
|
||||
static const char klass[] = "jdk/jfr/internal/dcmd/DCmdConfigure";
|
||||
static const char method[] = "execute";
|
||||
static const char signature[] = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;"
|
||||
static const char signature[] = "(ZLjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;"
|
||||
"Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Long;"
|
||||
"Ljava/lang/Long;Ljava/lang/Boolean;)Ljava/lang/String;";
|
||||
|
||||
@ -658,6 +659,7 @@ void JfrConfigureFlightRecorderDCmd::execute(DCmdSource source, TRAPS) {
|
||||
execute_args.set_receiver(h_dcmd_instance);
|
||||
|
||||
// params
|
||||
execute_args.push_int(_verbose ? 1 : 0);
|
||||
execute_args.push_jobject(repository_path);
|
||||
execute_args.push_jobject(dump_path);
|
||||
execute_args.push_jobject(stack_depth);
|
||||
|
@ -151,9 +151,13 @@ class JfrConfigureFlightRecorderDCmd : public DCmdWithParser {
|
||||
DCmdArgument<MemorySizeArgument> _memory_size;
|
||||
DCmdArgument<MemorySizeArgument> _max_chunk_size;
|
||||
DCmdArgument<bool> _sample_threads;
|
||||
bool _verbose;
|
||||
|
||||
public:
|
||||
JfrConfigureFlightRecorderDCmd(outputStream* output, bool heap);
|
||||
void set_verbose(bool verbose) {
|
||||
_verbose = verbose;
|
||||
}
|
||||
static const char* name() {
|
||||
return "JFR.configure";
|
||||
}
|
||||
|
@ -366,6 +366,7 @@ bool JfrOptionSet::configure(TRAPS) {
|
||||
configure._sample_threads.set_is_set(_dcmd_sample_threads.is_set());
|
||||
configure._sample_threads.set_value(_dcmd_sample_threads.value());
|
||||
|
||||
configure.set_verbose(false);
|
||||
configure.execute(DCmd_Source_Internal, THREAD);
|
||||
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
|
@ -32,7 +32,6 @@ import jdk.jfr.internal.LogLevel;
|
||||
import jdk.jfr.internal.LogTag;
|
||||
import jdk.jfr.internal.Logger;
|
||||
import jdk.jfr.internal.Options;
|
||||
import jdk.jfr.internal.PlatformRecorder;
|
||||
import jdk.jfr.internal.PrivateAccess;
|
||||
import jdk.jfr.internal.Repository;
|
||||
import jdk.jfr.internal.SecuritySupport.SafePath;
|
||||
@ -62,6 +61,7 @@ final class DCmdConfigure extends AbstractDCmd {
|
||||
*/
|
||||
public String execute
|
||||
(
|
||||
boolean verbose,
|
||||
String repositoryPath,
|
||||
String dumpPath,
|
||||
Integer stackDepth,
|
||||
@ -99,66 +99,86 @@ final class DCmdConfigure extends AbstractDCmd {
|
||||
} catch (Exception e) {
|
||||
throw new DCmdException("Could not use " + repositoryPath + " as repository. " + e.getMessage(), e);
|
||||
}
|
||||
printRepositoryPath();
|
||||
if (verbose) {
|
||||
printRepositoryPath();
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (dumpPath != null) {
|
||||
Options.setDumpPath(new SafePath(dumpPath));
|
||||
Logger.log(LogTag.JFR, LogLevel.INFO, "Emergency dump path set to " + dumpPath);
|
||||
printDumpPath();
|
||||
if (verbose) {
|
||||
printDumpPath();
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (stackDepth != null) {
|
||||
Options.setStackDepth(stackDepth);
|
||||
Logger.log(LogTag.JFR, LogLevel.INFO, "Stack depth set to " + stackDepth);
|
||||
printStackDepth();
|
||||
if (verbose) {
|
||||
printStackDepth();
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (globalBufferCount != null) {
|
||||
Options.setGlobalBufferCount(globalBufferCount);
|
||||
Logger.log(LogTag.JFR, LogLevel.INFO, "Global buffer count set to " + globalBufferCount);
|
||||
printGlobalBufferCount();
|
||||
if (verbose) {
|
||||
printGlobalBufferCount();
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (globalBufferSize != null) {
|
||||
Options.setGlobalBufferSize(globalBufferSize);
|
||||
Logger.log(LogTag.JFR, LogLevel.INFO, "Global buffer size set to " + globalBufferSize);
|
||||
printGlobalBufferSize();
|
||||
if (verbose) {
|
||||
printGlobalBufferSize();
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (threadBufferSize != null) {
|
||||
Options.setThreadBufferSize(threadBufferSize);
|
||||
Logger.log(LogTag.JFR, LogLevel.INFO, "Thread buffer size set to " + threadBufferSize);
|
||||
printThreadBufferSize();
|
||||
if (verbose) {
|
||||
printThreadBufferSize();
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (memorySize != null) {
|
||||
Options.setMemorySize(memorySize);
|
||||
Logger.log(LogTag.JFR, LogLevel.INFO, "Memory size set to " + memorySize);
|
||||
printMemorySize();
|
||||
if (verbose) {
|
||||
printMemorySize();
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (maxChunkSize != null) {
|
||||
Options.setMaxChunkSize(maxChunkSize);
|
||||
Logger.log(LogTag.JFR, LogLevel.INFO, "Max chunk size set to " + maxChunkSize);
|
||||
printMaxChunkSize();
|
||||
if (verbose) {
|
||||
printMaxChunkSize();
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (sampleThreads != null) {
|
||||
Options.setSampleThreads(sampleThreads);
|
||||
Logger.log(LogTag.JFR, LogLevel.INFO, "Sample threads set to " + sampleThreads);
|
||||
printSampleThreads();
|
||||
if (verbose) {
|
||||
printSampleThreads();
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (!verbose) {
|
||||
return "";
|
||||
}
|
||||
if (!updated) {
|
||||
println("Current configuration:");
|
||||
println();
|
||||
|
@ -34,6 +34,10 @@ import java.io.UncheckedIOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
import jdk.internal.jmod.JmodFile;
|
||||
@ -44,6 +48,8 @@ import static jdk.internal.jmod.JmodFile.*;
|
||||
* Output stream to write to JMOD file
|
||||
*/
|
||||
class JmodOutputStream extends OutputStream implements AutoCloseable {
|
||||
private final Map<Section, Set<String>> entries = new HashMap<>();
|
||||
|
||||
/**
|
||||
* This method creates (or overrides, if exists) the JMOD file,
|
||||
* returning the the output stream to write to the JMOD file.
|
||||
@ -110,13 +116,22 @@ class JmodOutputStream extends OutputStream implements AutoCloseable {
|
||||
zos.closeEntry();
|
||||
}
|
||||
|
||||
private ZipEntry newEntry(Section section, String path) {
|
||||
private ZipEntry newEntry(Section section, String path) throws IOException {
|
||||
if (contains(section, path)) {
|
||||
throw new IOException("duplicate entry: " + path + " in section " + section);
|
||||
}
|
||||
String prefix = section.jmodDir();
|
||||
String name = Paths.get(prefix, path).toString()
|
||||
.replace(File.separatorChar, '/');
|
||||
entries.get(section).add(path);
|
||||
return new ZipEntry(name);
|
||||
}
|
||||
|
||||
public boolean contains(Section section, String path) {
|
||||
Set<String> set = entries.computeIfAbsent(section, k -> new HashSet<>());
|
||||
return set.contains(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
zos.write(b);
|
||||
|
@ -757,21 +757,17 @@ public class JmodTask {
|
||||
throws IOException
|
||||
{
|
||||
Path relPath = path.relativize(file);
|
||||
if (relPath.toString().equals(MODULE_INFO)
|
||||
&& !Section.CLASSES.equals(section))
|
||||
warning("warn.ignore.entry", MODULE_INFO, section);
|
||||
|
||||
if (!relPath.toString().equals(MODULE_INFO)
|
||||
&& !matches(relPath, excludes)) {
|
||||
try (InputStream in = Files.newInputStream(file)) {
|
||||
out.writeEntry(in, section, relPath.toString());
|
||||
} catch (IOException x) {
|
||||
if (x.getMessage().contains("duplicate entry")) {
|
||||
warning("warn.ignore.duplicate.entry",
|
||||
relPath.toString(), section);
|
||||
return FileVisitResult.CONTINUE;
|
||||
String name = relPath.toString();
|
||||
if (name.equals(MODULE_INFO)) {
|
||||
if (!Section.CLASSES.equals(section))
|
||||
warning("warn.ignore.entry", name, section);
|
||||
} else if (!matches(relPath, excludes)) {
|
||||
if (out.contains(section, name)) {
|
||||
warning("warn.ignore.duplicate.entry", name, section);
|
||||
} else {
|
||||
try (InputStream in = Files.newInputStream(file)) {
|
||||
out.writeEntry(in, section, name);
|
||||
}
|
||||
throw x;
|
||||
}
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
@ -808,7 +804,14 @@ public class JmodTask {
|
||||
public boolean test(JarEntry je) {
|
||||
String name = je.getName();
|
||||
// ## no support for excludes. Is it really needed?
|
||||
return !name.endsWith(MODULE_INFO) && !je.isDirectory();
|
||||
if (name.endsWith(MODULE_INFO) || je.isDirectory()) {
|
||||
return false;
|
||||
}
|
||||
if (out.contains(Section.CLASSES, name)) {
|
||||
warning("warn.ignore.duplicate.entry", name, Section.CLASSES);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,6 +76,8 @@ import jdk.internal.org.jline.terminal.Size;
|
||||
import jdk.internal.org.jline.terminal.Terminal;
|
||||
import jdk.internal.org.jline.terminal.TerminalBuilder;
|
||||
import jdk.internal.org.jline.utils.Display;
|
||||
import jdk.internal.org.jline.utils.NonBlocking;
|
||||
import jdk.internal.org.jline.utils.NonBlockingInputStreamImpl;
|
||||
import jdk.internal.org.jline.utils.NonBlockingReader;
|
||||
import jdk.jshell.ExpressionSnippet;
|
||||
import jdk.jshell.Snippet;
|
||||
@ -103,14 +105,20 @@ class ConsoleIOContext extends IOContext {
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
this.input = new StopDetectingInputStream(() -> repl.stop(),
|
||||
ex -> repl.hard("Error on input: %s", ex));
|
||||
InputStream nonBlockingInput = new NonBlockingInputStreamImpl(null, input) {
|
||||
@Override
|
||||
public int readBuffered(byte[] b) throws IOException {
|
||||
return input.read(b);
|
||||
}
|
||||
};
|
||||
Terminal terminal;
|
||||
if (System.getProperty("test.jdk") != null) {
|
||||
terminal = new TestTerminal(input, cmdout);
|
||||
terminal = new TestTerminal(nonBlockingInput, cmdout);
|
||||
input.setInputStream(cmdin);
|
||||
} else {
|
||||
terminal = TerminalBuilder.builder().inputStreamWrapper(in -> {
|
||||
input.setInputStream(in);
|
||||
return input;
|
||||
return nonBlockingInput;
|
||||
}).build();
|
||||
}
|
||||
originalAttributes = terminal.getAttributes();
|
||||
@ -827,7 +835,7 @@ class ConsoleIOContext extends IOContext {
|
||||
|
||||
private boolean fixes() {
|
||||
try {
|
||||
int c = in.getTerminal().input().read();
|
||||
int c = in.getTerminal().reader().read();
|
||||
|
||||
if (c == (-1)) {
|
||||
return true; //TODO: true or false???
|
||||
@ -1234,11 +1242,11 @@ class ConsoleIOContext extends IOContext {
|
||||
|
||||
private static final int DEFAULT_HEIGHT = 24;
|
||||
|
||||
public TestTerminal(StopDetectingInputStream input, OutputStream output) throws Exception {
|
||||
private final NonBlockingReader inputReader;
|
||||
|
||||
public TestTerminal(InputStream input, OutputStream output) throws Exception {
|
||||
super("test", "ansi", output, Charset.forName("UTF-8"));
|
||||
// setAnsiSupported(true);
|
||||
// setEchoEnabled(false);
|
||||
// this.input = input;
|
||||
this.inputReader = NonBlocking.nonBlocking(getName(), input, encoding());
|
||||
Attributes a = new Attributes(getAttributes());
|
||||
a.setLocalFlag(LocalFlag.ECHO, false);
|
||||
setAttributes(attributes);
|
||||
@ -1252,18 +1260,18 @@ class ConsoleIOContext extends IOContext {
|
||||
// ignore
|
||||
}
|
||||
setSize(new Size(80, h));
|
||||
new Thread(() -> {
|
||||
int r;
|
||||
}
|
||||
|
||||
try {
|
||||
while ((r = input.read()) != (-1)) {
|
||||
processInputByte(r);
|
||||
}
|
||||
slaveInput.close();
|
||||
} catch (IOException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}).start();
|
||||
@Override
|
||||
public NonBlockingReader reader() {
|
||||
return inputReader;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doClose() throws IOException {
|
||||
super.doClose();
|
||||
slaveInput.close();
|
||||
inputReader.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -107,6 +107,19 @@ public final class StopDetectingInputStream extends InputStream {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
int r = read();
|
||||
if (r != (-1)) {
|
||||
b[off] = (byte) r;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public synchronized void shutdown() {
|
||||
state = State.CLOSED;
|
||||
notifyAll();
|
||||
|
@ -703,7 +703,6 @@ sun/security/provider/KeyStore/DKSTest.sh 8180266 windows-
|
||||
sun/security/pkcs11/KeyStore/SecretKeysBasic.sh 8209398 generic-all
|
||||
|
||||
security/infra/java/security/cert/CertPathValidator/certification/ActalisCA.java 8224768 generic-all
|
||||
security/infra/java/security/cert/CertPathValidator/certification/LuxTrustCA.java 8237888 generic-all
|
||||
|
||||
sun/security/smartcardio/TestChannel.java 8039280 generic-all
|
||||
sun/security/smartcardio/TestConnect.java 8039280 generic-all
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2020, 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
|
||||
@ -27,8 +27,12 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.security.Permission;
|
||||
import java.util.HashSet;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.FutureTask;
|
||||
|
||||
import javax.naming.Context;
|
||||
@ -37,11 +41,23 @@ import javax.naming.NamingException;
|
||||
import javax.naming.directory.InitialDirContext;
|
||||
import javax.naming.directory.SearchControls;
|
||||
|
||||
import sun.net.PortConfig;
|
||||
|
||||
import jdk.test.lib.RandomFactory;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8160768
|
||||
* @summary ctx provider tests for ldap
|
||||
* @modules java.naming/com.sun.jndi.ldap
|
||||
* @key randomness intermittent
|
||||
* @summary ctx provider tests for ldap.
|
||||
* Two test cases need to establish connection to the
|
||||
* unreachable port on localhost. Each tries 5 connection
|
||||
* attempts with a random port expecting for connection to fail.
|
||||
* In rare cases it could establish connections due to services
|
||||
* running on these ports, therefore it can fail intermittently.
|
||||
* @modules java.naming/com.sun.jndi.ldap java.base/sun.net
|
||||
* @library /test/lib
|
||||
* @build jdk.test.lib.RandomFactory
|
||||
* @compile dnsprovider/TestDnsProvider.java
|
||||
* @run main/othervm LdapDnsProviderTest
|
||||
* @run main/othervm LdapDnsProviderTest nosm
|
||||
@ -52,16 +68,6 @@ import javax.naming.directory.SearchControls;
|
||||
|
||||
class DNSSecurityManager extends SecurityManager {
|
||||
|
||||
|
||||
|
||||
/* run main/othervm LdapDnsProviderTest
|
||||
|
||||
* run main/othervm LdapDnsProviderTest nosm
|
||||
* run main/othervm LdapDnsProviderTest smnodns
|
||||
* run main/othervm LdapDnsProviderTest smdns
|
||||
* run main/othervm LdapDnsProviderTest nosmbaddns
|
||||
*/
|
||||
|
||||
private boolean dnsProvider = false;
|
||||
|
||||
public void setAllowDnsProvider(boolean allow) {
|
||||
@ -194,14 +200,78 @@ public class LdapDnsProviderTest {
|
||||
// no SecurityManager
|
||||
runTest("ldap:///dc=example,dc=com", "localhost:389");
|
||||
runTest("ldap://localhost/dc=example,dc=com", "localhost:389");
|
||||
runTest("ldap://localhost:1111/dc=example,dc=com", "localhost:1111");
|
||||
runTest("ldaps://localhost:1111/dc=example,dc=com", "localhost:1111");
|
||||
runLocalHostTestWithRandomPort("ldap", "/dc=example,dc=com", 5);
|
||||
runLocalHostTestWithRandomPort("ldaps", "/dc=example,dc=com", 5);
|
||||
runTest("ldaps://localhost/dc=example,dc=com", "localhost:636");
|
||||
runTest(null, "localhost:389");
|
||||
runTest("", "ConfigurationException");
|
||||
}
|
||||
}
|
||||
|
||||
// Pseudorandom number generator
|
||||
private static final Random RND = RandomFactory.getRandom();
|
||||
// Port numbers already seen to be generated by pseudorandom generator
|
||||
private static final Set<Integer> SEEN_PORTS = new HashSet<>();
|
||||
|
||||
// Get random, previously unseen port number from [1111, PortConfig.getUpper()) range
|
||||
private static int generateUnseenPort() {
|
||||
int port;
|
||||
do {
|
||||
port = 1111 + RND.nextInt(PortConfig.getUpper() - 1111);
|
||||
// Seen ports will never contain more than maxAttempts*2 ports
|
||||
} while (SEEN_PORTS.contains(port));
|
||||
SEEN_PORTS.add(port);
|
||||
return port;
|
||||
}
|
||||
|
||||
// Run test with ldap connection to localhost and random port. The test is expected to fail
|
||||
// with CommunicationException that is caused by connection refuse exception.
|
||||
// But in case if there is a service running on the same port the connection
|
||||
// will be established and then closed or timed-out. Both cases will generate exception
|
||||
// messages which differ from the expected one.
|
||||
// For such cases the test will be repeated with another random port. That will be done
|
||||
// maxAttempts times. If the expected exception won't be observed - test will be treated
|
||||
// as failed.
|
||||
private static void runLocalHostTestWithRandomPort(String scheme, String path, int maxAttempts) {
|
||||
for (int attempt = 0; attempt <= maxAttempts; attempt++) {
|
||||
boolean attemptSuccessful = true;
|
||||
int port = generateUnseenPort();
|
||||
|
||||
// Construct URL for the current attempt
|
||||
String url = scheme + "://localhost" + ":" + port + path;
|
||||
|
||||
// Construct text expected to be present in Exception message
|
||||
String expected = "localhost:" + port;
|
||||
|
||||
System.err.printf("Iteration %d: Testing: %s, %s%n", attempt, url, expected);
|
||||
|
||||
FutureTask<Boolean> future = new FutureTask<>(
|
||||
new ProviderTest(url, expected));
|
||||
new Thread(future).start();
|
||||
while (!future.isDone()) {
|
||||
try {
|
||||
if (!future.get()) {
|
||||
if (attempt == maxAttempts) {
|
||||
throw new RuntimeException("Test failed, ProviderTest" +
|
||||
" returned false " + maxAttempts + " times");
|
||||
} else {
|
||||
System.err.printf("Iteration %d failed:" +
|
||||
" ProviderTest returned false%n", attempt);
|
||||
attemptSuccessful = false;
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
System.err.println("Iteration %d failed to execute provider test: " + e.getMessage());
|
||||
attemptSuccessful = false;
|
||||
}
|
||||
}
|
||||
if (attemptSuccessful) {
|
||||
System.err.println("Test passed. It took " + (attempt + 1) + " iterations to complete");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void runTest(String url, String expected) {
|
||||
FutureTask<Boolean> future =
|
||||
new FutureTask<>(
|
||||
|
40
test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java
Normal file
40
test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java
Normal file
@ -0,0 +1,40 @@
|
||||
package jdk.jfr.startupargs;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Checks that locale is respected when using -XX:FlightRecorderOptions
|
||||
* See JDK-8244508
|
||||
* @key jfr
|
||||
* @requires vm.hasJFR
|
||||
* @modules jdk.jfr
|
||||
* @library /test/lib
|
||||
* @run main jdk.jfr.startupargs.TestOptionsWithLocale
|
||||
*/
|
||||
public class TestOptionsWithLocale {
|
||||
|
||||
public static class PrintDate {
|
||||
public static void main(String... args) {
|
||||
GregorianCalendar date = new GregorianCalendar(2020, Calendar.JANUARY, 1);
|
||||
DateFormat formatter = DateFormat.getDateTimeInstance();
|
||||
System.out.println(formatter.format(date.getTime()));
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String... args) throws IOException {
|
||||
ProcessBuilder pb = ProcessTools.createTestJvm(
|
||||
"-Duser.country=DE",
|
||||
"-Duser.language=de",
|
||||
"-XX:FlightRecorderOptions:stackdepth=128",
|
||||
PrintDate.class.getName());
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("01.01.2020, 00:00:00");
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2020, 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
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8142968 8166568 8166286 8170618 8168149
|
||||
* @bug 8142968 8166568 8166286 8170618 8168149 8240910
|
||||
* @summary Basic test for jmod
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
@ -60,6 +60,10 @@ public class JmodTest {
|
||||
.orElseThrow(() ->
|
||||
new RuntimeException("jmod tool not found")
|
||||
);
|
||||
static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar")
|
||||
.orElseThrow(() ->
|
||||
new RuntimeException("jar tool not found")
|
||||
);
|
||||
|
||||
static final String TEST_SRC = System.getProperty("test.src", ".");
|
||||
static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
|
||||
@ -436,6 +440,25 @@ public class JmodTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuplicateEntriesFromJarFile() throws IOException {
|
||||
String cp = EXPLODED_DIR.resolve("foo").resolve("classes").toString();
|
||||
Path jar = Paths.get("foo.jar");
|
||||
Path jmod = MODS_DIR.resolve("testDuplicates.jmod");
|
||||
FileUtils.deleteFileIfExistsWithRetry(jar);
|
||||
FileUtils.deleteFileIfExistsWithRetry(jmod);
|
||||
// create JAR file
|
||||
assertTrue(JAR_TOOL.run(System.out, System.err, "cf", jar.toString(), "-C", cp, ".") == 0);
|
||||
|
||||
jmod("create",
|
||||
"--class-path", jar.toString() + pathSeparator + jar.toString(),
|
||||
jmod.toString())
|
||||
.assertSuccess()
|
||||
.resultChecker(r ->
|
||||
assertContains(r.output, "Warning: ignoring duplicate entry")
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIgnoreModuleInfoInOtherSections() throws IOException {
|
||||
Path jmod = MODS_DIR.resolve("testIgnoreModuleInfoInOtherSections.jmod");
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8182297
|
||||
* @bug 8182297 8242919
|
||||
* @summary Verify that pasting multi-line snippets works properly.
|
||||
* @library /tools/lib
|
||||
* @modules
|
||||
@ -31,6 +31,7 @@
|
||||
* java.base/java.io:open
|
||||
* jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.main
|
||||
* jdk.internal.le/jdk.internal.org.jline.reader.impl
|
||||
* jdk.jshell/jdk.internal.jshell.tool.resources:open
|
||||
* jdk.jshell/jdk.jshell:open
|
||||
* @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
|
||||
@ -42,6 +43,7 @@
|
||||
import java.io.Console;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import jdk.internal.org.jline.reader.impl.LineReaderImpl;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@ -73,4 +75,18 @@ public class PasteAndMeasurementsUITest extends UITesting {
|
||||
});
|
||||
}
|
||||
private static final String LOC = "\033[12;1R";
|
||||
|
||||
public void testBracketedPaste() throws Exception {
|
||||
Field cons = System.class.getDeclaredField("cons");
|
||||
cons.setAccessible(true);
|
||||
Constructor console = Console.class.getDeclaredConstructor();
|
||||
console.setAccessible(true);
|
||||
cons.set(null, console.newInstance());
|
||||
doRunTest((inputSink, out) -> {
|
||||
inputSink.write(LineReaderImpl.BRACKETED_PASTE_BEGIN +
|
||||
"int i;" +
|
||||
LineReaderImpl.BRACKETED_PASTE_END);
|
||||
waitOutput(out, "int i;");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user