This commit is contained in:
David Dehaven 2016-06-15 12:47:50 -07:00
commit a513e6fe8a
16 changed files with 92 additions and 140 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2016, 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
@ -61,17 +61,25 @@ public class DriverResource extends ListResourceBundle {
"Usage: pack200 [-opt... | --option=value]... x.pack[.gz] y.jar",
"",
"Packing Options",
" -g, --no-gzip output a plain *.pack file with no zipping",
" --gzip (default) post-process the pack output with gzip",
" -G, --strip-debug remove debugging attributes while packing",
" -r, --repack repack or normalize a jar, suitable for ",
" signing with jarsigner",
" -g, --no-gzip output a plain pack file, suitable to be",
" compressed with a file compression utility",
" --gzip (default) post compress the pack output",
" with gzip",
" -G, --strip-debug remove debugging attributes (SourceFile,",
" LineNumberTable, LocalVariableTable",
" and LocalVariableTypeTable) while packing",
" -O, --no-keep-file-order do not transmit file ordering information",
" --keep-file-order (default) preserve input file ordering",
" -S{N}, --segment-limit={N} output segment limit (default N=1Mb)",
" -S{N}, --segment-limit={N} limit segment sizes (default unlimited)",
" -E{N}, --effort={N} packing effort (default N=5)",
" -H{h}, --deflate-hint={h} transmit deflate hint: true, false, or keep (default)",
" -H{h}, --deflate-hint={h} transmit deflate hint: true, false,",
" or keep (default)",
" -m{V}, --modification-time={V} transmit modtimes: latest or keep (default)",
" -P{F}, --pass-file={F} transmit the given input element(s) uncompressed",
" -U{a}, --unknown-attribute={a} unknown attribute action: error, strip, or pass (default)",
" -P{F}, --pass-file={F} transmit the given input element(s) unchanged",
" -U{a}, --unknown-attribute={a} unknown attribute action: error, strip,",
" or pass (default)",
" -C{N}={L}, --class-attribute={N}={L} (user-defined attribute)",
" -F{N}={L}, --field-attribute={N}={L} (user-defined attribute)",
" -M{N}={L}, --method-attribute={N}={L} (user-defined attribute)",
@ -79,7 +87,8 @@ public class DriverResource extends ListResourceBundle {
" -f{F}, --config-file={F} read file F for Pack200.Packer properties",
" -v, --verbose increase program verbosity",
" -q, --quiet set verbosity to lowest level",
" -l{F}, --log-file={F} output to the given log file, or '-' for System.out",
" -l{F}, --log-file={F} output to the given log file, ",
" or '-' for System.out",
" -?, -h, --help print this message",
" -V, --version print program version",
" -J{X} pass option X to underlying Java VM",
@ -92,18 +101,23 @@ public class DriverResource extends ListResourceBundle {
" Layout definitions (like RUH) are defined by JSR 200.",
"",
"Repacking mode updates the JAR file with a pack/unpack cycle:",
" pack200 [-r|--repack] [-opt | --option=value]... [repackedy.jar] y.jar\n"
" pack200 [-r|--repack] [-opt | --option=value]... [repackedy.jar] y.jar\n",
"",
"Exit Status:",
" 0 if successful, >0 if an error occurred"
}
},
{UNPACK_HELP, new String[] {
"Usage: unpack200 [-opt... | --option=value]... x.pack[.gz] y.jar\n",
"",
"Unpacking Options",
" -H{h}, --deflate-hint={h} override transmitted deflate hint: true, false, or keep (default)",
" -H{h}, --deflate-hint={h} override transmitted deflate hint:",
" true, false, or keep (default)",
" -r, --remove-pack-file remove input file after unpacking",
" -v, --verbose increase program verbosity",
" -q, --quiet set verbosity to lowest level",
" -l{F}, --log-file={F} output to the given log file, or '-' for System.out",
" -l{F}, --log-file={F} output to the given log file, or",
" '-' for System.out",
" -?, -h, --help print this message",
" -V, --version print program version",
" -J{X} pass option X to underlying Java VM"

View File

@ -142,6 +142,9 @@ class SSLConnection extends HttpConnection {
// TODO: check for closure
String s = "Receive) ";
//debugPrint(s, r.buf);
if (r.result.bytesProduced() > 0) {
assert buf == r.buf;
}
return r.result.bytesProduced();
}

View File

@ -344,8 +344,8 @@ class SSLDelegate {
/* we wait until some user data arrives */
int mark = dst.position();
WrapperResult r = null;
assert dst.position() == 0;
while (dst.position() == 0) {
int pos = dst.position();
while (dst.position() == pos) {
r = wrapper.recvAndUnwrap (dst);
dst = (r.buf != dst) ? r.buf: dst;
Status status = r.result.getStatus();

View File

@ -150,6 +150,10 @@ class SSLTunnelConnection extends HttpConnection {
// TODO: check for closure
String s = "Receive) ";
//debugPrint(s, r.buf);
if (r.result.bytesProduced() > 0) {
assert buf == r.buf;
}
return r.result.bytesProduced();
}

View File

@ -146,14 +146,18 @@ static const char* nbasename(const char* progname) {
#define USAGE_OPTIONS \
"\n" \
"Unpacking Options\n" \
" -H{h}, --deflate-hint={h} override transmitted deflate hint: true, false, or keep (default)\n" \
" -H{h}, --deflate-hint={h} override transmitted deflate hint:\n" \
" true, false, or keep (default)\n" \
" -r, --remove-pack-file remove input file after unpacking\n" \
" -v, --verbose increase program verbosity\n" \
" -q, --quiet set verbosity to lowest level\n" \
" -l{F}, --log-file={F} output to the given log file, or '-' for standard output (default)\n" \
" -l{F}, --log-file={F} output to the given log file,\n" \
" or '-' for standard output (default)\n" \
" -?, -h, --help print this message\n" \
" -V, --version print program version\n" \
" -J{X} Java VM argument (ignored)\n"
"\n" \
"Exit Status:\n" \
" 0 if successful, >0 if an error occurred\n"
static void usage(unpacker* u, const char* progname, bool full = false) {
// WinMain does not set argv[0] to the progrname

View File

@ -25,6 +25,7 @@
* @test
* @summary Exercise Class#getModule
* @modules java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.misc
* java.desktop
* @run testng GetModuleTest
*/
@ -35,7 +36,7 @@ import java.lang.reflect.Module;
import jdk.internal.org.objectweb.asm.ClassWriter;
import static jdk.internal.org.objectweb.asm.Opcodes.*;
import sun.misc.Unsafe;
import jdk.internal.misc.Unsafe;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2016, 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
@ -24,20 +24,23 @@
/*
* @test
* @bug 8060206 8067366
* @library /lib/testlibrary
* @summary Endorsed standards and override mechanism is removed
*/
import java.io.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import jdk.testlibrary.ProcessTools;
import java.util.stream.Stream;
public class EndorsedDirs {
private static String TEST_CLASSES = System.getProperty("test.classes", ".");
private static String[] VALUES = new String[] {
null,
"",
"\"\""
};
public static void main(String... args) throws Exception {
String value = System.getProperty("java.endorsed.dirs");
System.out.format("java.endorsed.dirs = '%s'%n", value);
@ -64,59 +67,20 @@ public class EndorsedDirs {
start(2, "-Djava.endorsed.dirs=\"\"");
}
static ProcessBuilder newProcessBuilder(int testParam, String... args) throws Exception {
List<String> commands = new ArrayList<>();
String java = System.getProperty("java.home") + "/bin/java";
commands.add(java);
for (String s : args) {
commands.add(s);
}
String cpath = System.getProperty("test.classes", ".");
commands.add("-cp");
commands.add(cpath);
commands.add("EndorsedDirs");
commands.add(String.valueOf(testParam));
System.out.println("Testing " + commands.stream().collect(Collectors.joining(" ")));
return new ProcessBuilder(commands);
static String[] launchOptions(int testParam, String... args) {
return Stream.concat(Stream.of(args),
Stream.of("-cp", TEST_CLASSES, "EndorsedDirs",
String.valueOf(testParam)))
.toArray(String[]::new);
}
static void start(int testParam, String... args) throws Exception {
start(newProcessBuilder(testParam, args), false);
ProcessTools.executeTestJava(launchOptions(testParam, args))
.shouldHaveExitValue(0);
}
static void fatalError(int testParam, String... args) throws Exception {
start(newProcessBuilder(testParam, args), true);
}
static void start(ProcessBuilder pb, boolean fatalError) throws Exception {
final Process process = pb.start();
BufferedReader errorStream = new BufferedReader(
new InputStreamReader(process.getErrorStream()));
BufferedReader outStream = new BufferedReader(
new InputStreamReader(process.getInputStream()));
String errorLine;
StringBuilder errors = new StringBuilder();
String outLines;
while ((errorLine = errorStream.readLine()) != null) {
errors.append(errorLine).append("\n");
}
while ((outLines = outStream.readLine()) != null) {
System.out.println(outLines);
}
errorLine = errors.toString();
System.err.println(errorLine);
process.waitFor(1000, TimeUnit.MILLISECONDS);
int exitStatus = process.exitValue();
if (fatalError) {
if (exitStatus == 0) {
throw new RuntimeException("Expected fatal error");
}
if (!errorLine.contains("Could not create the Java Virtual Machine")) {
throw new RuntimeException(errorLine);
}
} else if (exitStatus != 0) {
throw new RuntimeException("Failed: " + errorLine);
}
ProcessTools.executeTestJava(launchOptions(testParam, args))
.stderrShouldContain("Could not create the Java Virtual Machine");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2016, 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
@ -24,21 +24,24 @@
/*
* @test
* @bug 8060206 8067366
* @library /lib/testlibrary
* @summary Extension mechanism is removed
*/
import java.io.*;
import jdk.testlibrary.ProcessTools;
import java.lang.Integer;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class ExtDirs {
private static String TEST_CLASSES = System.getProperty("test.classes", ".");
private static String[] VALUES = new String[] {
null,
"",
"\"\""
};
public static void main(String... args) throws Exception {
String value = System.getProperty("java.ext.dirs");
System.out.format("java.ext.dirs = '%s'%n", value);
@ -65,59 +68,20 @@ public class ExtDirs {
start(2, "-Djava.ext.dirs=\"\"");
}
static ProcessBuilder newProcessBuilder(int testParam, String... args) throws Exception {
List<String> commands = new ArrayList<>();
String java = System.getProperty("java.home") + "/bin/java";
commands.add(java);
for (String s : args) {
commands.add(s);
}
String cpath = System.getProperty("test.classes", ".");
commands.add("-cp");
commands.add(cpath);
commands.add("ExtDirs");
commands.add(String.valueOf(testParam));
System.out.println("Testing " + commands.stream().collect(Collectors.joining(" ")));
return new ProcessBuilder(commands);
static String[] launchOptions(int testParam, String... args) {
return Stream.concat(Stream.of(args),
Stream.of("-cp", TEST_CLASSES, "ExtDirs",
String.valueOf(testParam)))
.toArray(String[]::new);
}
static void start(int testParam, String... args) throws Exception {
start(newProcessBuilder(testParam, args), false);
ProcessTools.executeTestJava(launchOptions(testParam, args))
.shouldHaveExitValue(0);
}
static void fatalError(int testParam, String... args) throws Exception {
start(newProcessBuilder(testParam, args), true);
}
static void start(ProcessBuilder pb, boolean fatalError) throws Exception {
final Process process = pb.start();
BufferedReader errorStream = new BufferedReader(
new InputStreamReader(process.getErrorStream()));
BufferedReader outStream = new BufferedReader(
new InputStreamReader(process.getInputStream()));
String errorLine;
StringBuilder errors = new StringBuilder();
String outLines;
while ((errorLine = errorStream.readLine()) != null) {
errors.append(errorLine).append("\n");
}
while ((outLines = outStream.readLine()) != null) {
System.out.println(outLines);
}
errorLine = errors.toString();
System.err.println(errorLine);
process.waitFor(1000, TimeUnit.MILLISECONDS);
int exitStatus = process.exitValue();
if (fatalError) {
if (exitStatus == 0) {
throw new RuntimeException("Expected fatal error");
}
if (!errorLine.contains("Could not create the Java Virtual Machine")) {
throw new RuntimeException(errorLine);
}
} else if (exitStatus != 0) {
throw new RuntimeException("Failed: " + errorLine);
}
ProcessTools.executeTestJava(launchOptions(testParam, args))
.stderrShouldContain("Could not create the Java Virtual Machine");
}
}

View File

@ -29,6 +29,7 @@
*
* @modules jdk.compiler
* java.instrument
* jdk.zipfs
* @run build ManyMethodsBenchmarkApp ManyMethodsBenchmarkAgent
* @run shell MakeJAR3.sh ManyMethodsBenchmarkAgent 'Can-Retransform-Classes: true'
* @run main/othervm -javaagent:ManyMethodsBenchmarkAgent.jar ManyMethodsBenchmarkApp

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2016, 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
@ -31,6 +31,7 @@ import jdk.testlibrary.Utils;
* @summary test when the agent's class is missing the premain() function.
* @library /lib/testlibrary
* @modules java.management
* java.instrument
* @run build jdk.testlibrary.* DummyMain
* @run shell ../MakeJAR3.sh NoPremainAgent
* @run main/othervm -XX:-CreateCoredumpOnCrash NoPremainAgentTest

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2016, 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
@ -31,6 +31,7 @@ import jdk.testlibrary.Utils;
* @summary test when the agent's class has a zero arg premain() function.
* @library /lib/testlibrary
* @modules java.management
* java.instrument
* @run build jdk.testlibrary.* DummyMain
* @run shell ../MakeJAR3.sh ZeroArgPremainAgent
* @run main/othervm -XX:-CreateCoredumpOnCrash ZeroArgPremainAgentTest

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, 2016, 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,7 +27,7 @@
# @author Stefan Karlsson
#
# @modules java.instrument
# java.management
# jdk.management
# @run shell MakeJAR3.sh RedefineMethodInBacktraceAgent 'Can-Redefine-Classes: true'
# @run build RedefineMethodInBacktraceTarget RedefineMethodInBacktraceApp
# @run shell RedefineMethodInBacktrace.sh

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2016, 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
@ -34,8 +34,6 @@ import static java.lang.invoke.MethodType.*;
import java.lang.reflect.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.*;
import static org.junit.Assert.*;

View File

@ -23,6 +23,7 @@
/**
* @test
* @modules java.desktop
* @run main/othervm -XaddExports:java.desktop/sun.awt=java.base AddExportsTest
* @run main/othervm -XaddExports:java.desktop/sun.awt=ALL-UNNAMED AddExportsTest
* @summary Test Module isExported methods with exports changed by -AddExportsTest

View File

@ -35,7 +35,7 @@ import static org.testng.Assert.*;
/**
* @test
* @library /lib/testlibrary
* @modules java.compiler
* @modules jdk.compiler
* @build AccessTest CompilerUtils jdk.testlibrary.*
* @run testng AccessTest
* @summary Driver for test that checks access to public members in exported

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2016, 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,7 +47,7 @@ import org.testng.annotations.Test;
/* @test
* @summary Unit test for j.u.Formatter threeten date/time support
* @bug 8003680 8012638
* @bug 8003680 8043387 8012638
*/
@Test
public class TestFormatter {
@ -235,10 +235,6 @@ public class TestFormatter {
}
}
private String toZoneIdStr(String expected) {
return expected.replaceAll("(?:GMT|UTC)(?<off>[+\\-]?[0-9]{2}:[0-9]{2})", "${off}");
}
private String toZoneOffsetStr(String expected) {
return expected.replaceAll("(?:GMT|UTC)(?<off>[+\\-]?[0-9]{2}:[0-9]{2})", "${off}")
.replaceAll("GMT|UTC|UT", "Z");
@ -247,7 +243,7 @@ public class TestFormatter {
private void testZoneId(Locale locale, ChronoZonedDateTime<?> zdt, Calendar cal) {
String fmtStr = "z:[%tz] z:[%1$Tz] Z:[%1$tZ] Z:[%1$TZ]";
printFmtStr(locale, fmtStr);
String expected = toZoneIdStr(test(fmtStr, locale, null, cal));
String expected = test(fmtStr, locale, null, cal);
test(fmtStr, locale, expected, zdt);
// get a new cal with fixed tz
Calendar cal0 = Calendar.getInstance();
@ -263,7 +259,7 @@ public class TestFormatter {
// datetime + zid
fmtStr = "c:[%tc] c:[%1$Tc]";
printFmtStr(locale, fmtStr);
expected = toZoneIdStr(test(fmtStr, locale, null, cal));
expected = test(fmtStr, locale, null, cal);
test(fmtStr, locale, expected, zdt);
}