Skip to content
Commits on Source (6)
repo: 9f51ef22f00a3d5b681472cacf3ce15868073103
node: 7a38f21e077821a5015792e85b3793c90c81b866
node: ec37d2900cd42987270f98423a60eb6297bdc37b
branch: default
tag: jtreg4.2-b13
tag: jtreg4.2-b14
......@@ -26,3 +26,4 @@ cce0ac75e87864ed365a420fb836a4430421ab0f jtreg4.2-b08
746c6d1328721541d3b16154c25a0179fbf53f7c jtreg4.2-b10
a13ec77e7adcc4c9ed434e664abc350abaacc045 jtreg4.2-b11
652902f7fb0ed0b4f307d61a799caf50a6e609be jtreg4.2-b12
7a38f21e077821a5015792e85b3793c90c81b866 jtreg4.2-b13
......@@ -15,7 +15,7 @@ This is the recommended way to build jtreg, for those that want a simple,
basic way to build jtreg.
The script is intended to be run in a Unix-like shell, such as bash on Linux or
MacOS, or with Cygwin on Windows. It takes one argument which is the
Mac OS X, or with Cygwin or WSL on Windows. It takes one argument which is the
installation of JDK to be used to build jtreg. In addition, Ant must be on your
execution path as well as a suitable version of Java to run Ant. The version of
JDK must be either JDK 7 or JDK 8.
......@@ -181,3 +181,12 @@ Some of the tests can be invoked with individual targets beginning
"jtreg-test" rather than "test" is to protect against interactions with JUnit in
older versions of NetBeans.)
Using the IntelliJ IDE
The jtreg repo also contains a plugin for the IntelliJ IDE.
This is a convenience plugin which adds jtreg capabilities to the IntelliJ IDE.
With this plugin, OpenJDK developers can write, run, and debug jtreg tests
without leaving their IDE environment. For more details, see the file
`plugins/idea/README.md` in this repo.
jtreg (4.2-b14-1) unstable; urgency=medium
* Team upload.
* New upstream release
- Refreshed the patches
* Standards-Version updated to 4.3.0
-- Emmanuel Bourg <ebourg@apache.org> Mon, 25 Feb 2019 12:44:58 +0100
jtreg (4.2-b13-2) unstable; urgency=medium
* Team upload.
......
......@@ -3,24 +3,28 @@ Section: java
Priority: optional
Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
Uploaders: Guillaume Mazoyer <respawneral@gmail.com>
Build-Depends: debhelper (>= 11~), javahelper, help2man
Build-Depends-Indep: default-jdk,
libjtharness-java,
Build-Depends:
ant,
debhelper (>= 11~),
default-jdk,
help2man,
javahelp2,
javahelper,
libjtharness-java,
libxalan2-java,
testng
Standards-Version: 4.2.1
Standards-Version: 4.3.0
Vcs-Git: https://salsa.debian.org/java-team/jtreg.git
Vcs-Browser: https://salsa.debian.org/java-team/jtreg
Homepage: http://openjdk.java.net/jtreg
Package: jtreg
Architecture: all
Depends: ${java:Depends},
Depends:
${java:Depends},
${misc:Depends},
libjtharness-java,
javahelp2,
libjtharness-java,
libxalan2-java
Recommends: testng
Description: Regression Test Harness for the OpenJDK platform
......
......@@ -4,7 +4,7 @@ Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: no
--- a/src/share/classes/com/sun/javatest/regtest/exec/MainAction.java
+++ b/src/share/classes/com/sun/javatest/regtest/exec/MainAction.java
@@ -558,6 +558,7 @@
@@ -556,6 +556,7 @@
.append(jdk.getJDKClassPath())
.append(script.getJUnitPath())
.append(script.getTestNGPath())
......@@ -14,7 +14,7 @@ Forwarded: no
SearchPath classpath = paths.get(PathKind.CLASSPATH);
--- a/src/share/classes/com/sun/javatest/regtest/exec/RegressionScript.java
+++ b/src/share/classes/com/sun/javatest/regtest/exec/RegressionScript.java
@@ -732,16 +732,20 @@
@@ -771,16 +771,20 @@
File md = workDir.getFile("modules");
if (needJUnit)
install(params.getJUnitPath(), md);
......@@ -37,7 +37,7 @@ Forwarded: no
}
// Extras:
@@ -833,8 +837,10 @@
@@ -872,8 +876,10 @@
File md = workDir.getFile("modules");
if (needJUnit)
install(params.getJUnitPath(), md);
......@@ -49,7 +49,7 @@ Forwarded: no
mp.append(md);
}
} else {
@@ -842,8 +848,10 @@
@@ -881,8 +887,10 @@
if (needJUnit)
fp.append(params.getJUnitPath());
......
......@@ -93,9 +93,9 @@
$jtdiffOpts
--- a/src/share/bin/jtreg.sh
+++ b/src/share/bin/jtreg.sh
@@ -47,40 +47,6 @@
#
# jtreg also provides Ant tasks; see the documentation for details.
@@ -68,36 +68,6 @@
esac
-# Determine jtreg/JavaTest installation directory
-if [ -n "$JT_HOME" ]; then
......@@ -106,7 +106,8 @@
-else
- # Deduce where script is installed
- # - should work on most derivatives of Bourne shell, like ash, bash, ksh,
- # sh, zsh, etc, including on Windows, MKS (ksh) and Cygwin (ash or bash)
- # sh, zsh, etc, including on Windows, MKS (ksh), Cygwin (ash or bash)
- # and Windows Subsystem for Linux (WSL)
- if type -p type 1>/dev/null 2>&1 && test -z "`type -p type`" ; then
- myname=`type -p "$0"`
- elif type type 1>/dev/null 2>&1 ; then
......@@ -125,16 +126,11 @@
- fi
-fi
-
-# Normalize JT_HOME if using Cygwin
-case "`uname -s`" in
- CYGWIN* ) cygwin=1 ; JT_HOME=`cygpath -a -m "$JT_HOME"` ;;
-esac
-
-
# Separate out -J* options for the JVM
# Note jdk as possible default to run jtreg
# Look for -jdk option as possible default to run jtreg
# Unset IFS and use newline as arg separator to preserve spaces in args
@@ -101,37 +67,24 @@
DUALCASE=1 # for MKS: make case statement case-sensitive (6709498)
@@ -113,17 +83,9 @@
done
unset DUALCASE
......@@ -154,6 +150,11 @@
+ JT_JAVA="/usr/lib/jvm/default-java"
fi
# Fixup JT_JAVA, JTHOME as needed, if using Cygwin or WSL
@@ -134,16 +96,8 @@
JT_HOME=`wslpath -a -m "$JT_HOME"`
fi
-# Verify java version (1.)7 or newer used to run jtreg
-version=`"$JT_JAVA" -classpath "${JT_HOME}/lib/jtreg.jar" com.sun.javatest.regtest.agent.GetSystemProperty java.version 2>&1 |
- grep 'java.version=' | sed -e 's/^.*=//' -e 's/^1\.//' -e 's/\([1-9][0-9]*\).*/\1/'`
......@@ -168,6 +169,9 @@
+ JT_HOME="/usr/share/java"
fi
# Separate out -J* options for the JVM
@@ -170,10 +124,13 @@
# And finally ...
+JT_CLASSPATH="${JT_HOME}/jtreg.jar:/usr/share/java/javatest.jar:/usr/share/java/jh.jar:/usr/share/java/junit4.jar"
......
......@@ -141,6 +141,15 @@ JDKJAVA = $(JDKHOME)/bin/java
JDKJAVAC = $(JDKHOME)/bin/javac
JAR = $(JDKHOME)/bin/jar
# Only use -source -target, to support legacy platforms, when building with JDK 7 or 8
# Otherwise, use default values for $JDKHOME/bin/javac
SUPPORT_OLD_SOURCE_TARGET = $(shell $(JDKJAVAC) -version 2>&1 | grep '[78]' > /dev/null && echo true )
ifneq ($(SUPPORT_OLD_SOURCE_TARGET),)
OLD_JAVAC_SOURCE_TARGET = -source 1.2 -target 1.1
AGENT_JAVAC_SOURCE_TARGET = -source 5 -target 5
TOOL_JAVAC_SOURCE_TARGET = -source 7 -target 7
endif
ifdef JDK15HOME
JDK15_BOOTCLASSPATH = -bootclasspath $(JDK15HOME)/jre/lib/rt.jar
endif
......@@ -151,17 +160,17 @@ endif
# for files needed to run othervm tests on oldest supported platforms
REGTEST_OLD_JAVAC = $(JDKHOME)/bin/javac
REGTEST_OLD_JAVAC_OPTIONS = \
-source 1.2 -target 1.1 $(JDK15_BOOTCLASSPATH) -Xlint:all,-options -Werror
$(OLD_JAVAC_SOURCE_TARGET) $(JDK15_BOOTCLASSPATH) -Xlint:all,-options -Werror
# for files needed to run agentvm tests (on platforms back to JDK 1.5)
REGTEST_AGENT_JAVAC = $(JDKHOME)/bin/javac
REGTEST_AGENT_JAVAC_OPTIONS = \
-source 5 -target 5 $(JDK15_BOOTCLASSPATH) -Xlint:all,-options -Werror
$(AGENT_JAVAC_SOURCE_TARGET) $(JDK15_BOOTCLASSPATH) -Xlint:all,-options -Werror
# for files needed for jtreg tool
REGTEST_TOOL_JAVAC = $(JDKHOME)/bin/javac
REGTEST_TOOL_JAVAC_OPTIONS = \
-source 7 -target 7 $(JDK17_BOOTCLASSPATH) -Xlint:all,-options -Werror
$(TOOL_JAVAC_SOURCE_TARGET) $(JDK17_BOOTCLASSPATH) -Xlint:all,-options -Werror
#----- JavaHelp
#
......@@ -408,6 +417,13 @@ GREP := $(shell if [ -r /bin/grep ]; then echo /bin/grep ; else echo /usr/bin/g
LN = /bin/ln
MKDIR = /bin/mkdir
MV = /bin/mv
PANDOC = $(shell if [ -r /usr/bin/pandoc ]; then \
echo /usr/bin/pandoc ; \
elif [ -r /usr/local/bin/pandoc ]; then \
echo /usr/local/bin/pandoc ; \
else \
echo /bin/echo "pandoc not available" ; \
fi )
PERL = /usr/bin/perl
RM = /bin/rm -rf
SED := $(shell if [ -r /bin/sed ]; then echo /bin/sed ; else echo /usr/bin/sed ; fi )
......
......@@ -93,8 +93,8 @@ MAVEN_REPO_URL=https://repo1.maven.org/maven2
CODE_TOOLS_URL=http://hg.openjdk.java.net/code-tools
# The following are Mercurial tags for the corresponding OpenJDK Code Tools repo
ASMTOOLS_VERSION=${ASMTOOLS_VERSION:-7.0-b04} # early access for 7.0
JTHARNESS_VERSION=${JTHARNESS_VERSION:-jt6.0-b02} # early access for 6.0
ASMTOOLS_VERSION=${ASMTOOLS_VERSION:-7.0-b06} # early access for 7.0
JTHARNESS_VERSION=${JTHARNESS_VERSION:-jt6.0-b04} # early access for 6.0
JCOV_VERSION=${JCOV_VERSION:-jcov3.0-b05} # jcov3.0, ASM 6.2
# ANT
......
......@@ -99,11 +99,13 @@ TARGETS.com.sun.javatest.regtest += $(RESOURCES.com.sun.javatest.regtest)
JTREG_COPYRIGHT = $(JTREG_IMAGEDIR)/COPYRIGHT
JTREG_LICENSE = $(JTREG_IMAGEDIR)/LICENSE
JTREG_README = $(JTREG_IMAGEDIR)/README
JTREG_FAQ = $(JTREG_IMAGEDIR)/doc/jtreg/faq.html
JTREG_TAGSPEC = $(JTREG_IMAGEDIR)/doc/jtreg/tag-spec.html
JTREG_USAGE = $(JTREG_IMAGEDIR)/doc/jtreg/usage.txt
JTREG_DOCS = \
$(JTREG_COPYRIGHT) \
$(JTREG_FAQ) \
$(JTREG_LICENSE) \
$(JTREG_README) \
$(JTREG_TAGSPEC) \
......@@ -114,6 +116,28 @@ $(JTREG_COPYRIGHT): $(TOPDIR)/COPYRIGHT
$(RM) $@
$(CP) $< $@
$(JTREG_FAQ): $(SRCJTREGDOCDIR)/faq.md \
$(SRCJTREGDOCDIR)/faq-local-style.html \
$(SRCJTREGDOCDIR)/faq-intro.html
$(MKDIR) -p $(@D)
$(ECHO) '/<header>/{;:a;N;/<\/header>/!ba;};/<h1 class="title">/d' | tr ';' '\n' > $(BUILDDIR)/fixupheader
$(PANDOC) \
--standalone \
--include-in-header $(SRCJTREGDOCDIR)/faq-local-style.html \
--include-before $(SRCJTREGDOCDIR)/faq-intro.html \
--toc \
--to html5 \
--number-sections \
$(SRCJTREGDOCDIR)/faq.md | \
$(SED) \
-e 's/^code > span\.\([a-z][a-z] .*\)/code span.\1/' \
-e 's/-section-number">0./-section-number">/' \
-e 's/…/\&hellip;/g' \
-e 's/™/\&trade;/g' \
-f $(BUILDDIR)/fixupheader \
> $(JTREG_FAQ)
$(JTREG_README): $(SRCJTREGDOCDIR)/README
$(MKDIR) -p $(@D)
$(RM) $@
......
<!--
~ Copyright (c) 2016, 2018 Oracle and/or its affiliates. All rights reserved.
~ Copyright (c) 2016, 2019 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
......@@ -26,13 +26,16 @@
<idea-plugin>
<id>jtreg</id>
<name>jtreg Test Support</name>
<version>1.6</version>
<version>1.9</version>
<description><![CDATA[
Allows execution of tests developed using the <a href="http://openjdk.java.net/jtreg/">jtreg</a> framework.
]]></description>
<change-notes><![CDATA[
Fixed misc issues with plugin build against newer versions of IntelliJ IDE
<ul>
<li>Add support for IntelliJ IDE2018.3</li>
<li>Allow support for external library resolution</li>
</ul>
]]>
</change-notes>
......
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2019 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
......@@ -204,6 +204,7 @@ public class JTRegFileManagerListener implements FileEditorManagerListener {
for (VirtualFile f : sourceRoots) {
Integer i = refCount.get(f);
if (i == null) {
LOG.debug("Adding source folder: " + f);
contentEntry.addSourceFolder(f, true);
}
refCount.put(f, i == null ? 1 : i + 1);
......@@ -226,6 +227,7 @@ public class JTRegFileManagerListener implements FileEditorManagerListener {
if (i == null) {
//not found - skip
} else if (i == 1) {
LOG.debug("Removing source folder: " + s);
contentEntry.removeSourceFolder(s);
refCount.remove(f);
} else {
......
......@@ -78,13 +78,12 @@ public class JTRegConfiguration extends JavaTestConfigurationBase {
}
@NotNull
@Override
public String getFrameworkPrefix() {
return "jtreg";
}
@Override
public void setEnvs(@NotNull Map<String, String> map) {
public void setEnvs(Map<String, String> map) {
}
@NotNull
......@@ -147,7 +146,7 @@ public class JTRegConfiguration extends JavaTestConfigurationBase {
@Nullable
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment executionEnvironment) throws ExecutionException {
public JTRegConfigurationRunnableState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment executionEnvironment) throws ExecutionException {
return new JTRegConfigurationRunnableState(this, executionEnvironment);
}
......@@ -297,4 +296,16 @@ public class JTRegConfiguration extends JavaTestConfigurationBase {
public TestSearchScope getTestSearchScope() {
return null;
}
public void setSearchScope(TestSearchScope testSearchScope) {
//do nothing
}
public String getTestType() {
return "jtreg";
}
public byte getTestFrameworkId() {
return 2; //for now
}
}
......@@ -173,6 +173,7 @@ public class JTRegService implements PersistentStateComponent<Element> {
public void setOptTargets(List<AntBuildTarget> targets) {
optTargets = targets.stream()
.filter(target -> target != null)
.map(t -> Pair.create(t.getModel().getBuildFile().getVirtualFile().getUrl(), t.getName()))
.collect(Collectors.toList());
}
......@@ -180,6 +181,7 @@ public class JTRegService implements PersistentStateComponent<Element> {
public List<AntBuildTarget> getOptTargets(AntConfiguration antConfiguration) {
return optTargets.stream()
.map(p -> findTargetByFileAndName(antConfiguration, p.first, p.second))
.filter(target -> target != null)
.collect(Collectors.toList());
}
//where
......
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019 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
......@@ -32,16 +32,22 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.openapi.diagnostic.Logger;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.*;
import java.util.stream.Stream;
/**
* This class contains several helper routines that are used by the jtreg plugin.
*/
public class JTRegUtils {
private static final Logger LOG = Logger.getInstance(JTRegUtils.class);
/**
* Are we inside a jtreg test root?
*/
......@@ -58,16 +64,77 @@ public class JTRegUtils {
return findJTRegRoot(file) != null;
}
/**
* Given a file, searches up the vfs hierarchy for the closest parent directory containing the
* associated test suite config (TEST.ROOT).
* @param file the file
* @return file referring to the test root directory or null if not found
*/
public static VirtualFile findJTRegRoot(VirtualFile file) {
VirtualFile test_root_file = findRootFile(file);
if (test_root_file != null) {
return file.getParent();
}
return null;
}
/**
* Given a file, searches up the vfs hierarchy for the associated test suite
* configuration (a TEST.ROOT file in a parent directory).
* @param file the virtual file
* @return virtual file referring to TEST.ROOT or null if not found.
*/
private static VirtualFile findRootFile(VirtualFile file) {
while (file != null) {
if (file.findChild("TEST.ROOT") != null) {
return file;
VirtualFile rootFile = file.findChild("TEST.ROOT");
if (rootFile != null) {
return rootFile;
}
file = file.getParent();
}
return null;
}
/**
* Parse a test suite configuration.
* @param rootFile a file representing a test suite configuration (TEST.ROOT)
* @return a Properties object containing the parsed TEST.ROOT
*/
private static Properties parseTestSuiteConfig(VirtualFile rootFile) {
Properties prop = null;
try {
prop = new Properties();
InputStream input = rootFile.getInputStream();
prop.load(input);
} catch (IOException e) {
e.printStackTrace();
}
return prop;
}
// cache parsed test configurations.
private static HashMap<VirtualFile, Properties> _cachedTestConfigs = new HashMap<>();
/**
* Parse a test suite configuration.
* @param rootFile a file representing a test suite configuration (TEST.ROOT)
* @return a Properties object containing the parsed TEST.ROOT
*/
private static Properties testSuiteConfigForRootFile(VirtualFile rootFile) {
Properties p = _cachedTestConfigs.get(rootFile);
if (p == null) {
p = parseTestSuiteConfig(rootFile);
if (p != null) {
LOG.debug("Parsing test suite config " + rootFile + "...");
_cachedTestConfigs.put(rootFile, p);
LOG.debug("Content: " + p);
}
} else {
LOG.debug("Returning cached test suite config for " + rootFile);
}
return p;
}
/**
* Is the given file a jtreg test?
*/
......@@ -130,6 +197,7 @@ public class JTRegUtils {
* Retrieve the source roots associated with jtreg test with header.
*/
public static List<VirtualFile> getJTRegRoots(PsiFile file) {
LOG.debug("JTregRoots for " + file + "...");
if (file instanceof PsiJavaFile) {
Optional<PsiComment> optHeader = PsiTreeUtil.findChildrenOfType(file, PsiComment.class).stream()
.filter(JTRegUtils::hasTestTag).findFirst();
......@@ -138,8 +206,10 @@ public class JTRegUtils {
List<VirtualFile> roots = new ArrayList<>();
VirtualFile pkgRoot = getPackageRoot(file);
if (pkgRoot != null) {
LOG.debug("Package root: " + pkgRoot.getParent());
roots.add(pkgRoot);
} else {
LOG.debug("Package root not found, adding immediate parent.");
roots.add(file.getVirtualFile().getParent());
}
JTRegTagParser.Result result = JTRegTagParser.parseTags(header);
......@@ -149,16 +219,57 @@ public class JTRegUtils {
for (Tag libTag : libTags) {
String libVal = libTag.getValue();
for (String lib : libVal.split(" ")) {
VirtualFile libFile;
VirtualFile libFile = null;
LOG.debug("Processing @library \"" + lib + "\"...");
if (lib.startsWith("/")) {
//absolute
libFile = findJTRegRoot(file.getVirtualFile()).findFileByRelativePath(lib.substring(1));
// Excerpt from jtreg tags specification:
// "If an argument begins with '/', it will first be evaluated relative to the root
// directory of the test suite. It is an error if the resulting path is outside the
// test suite."
VirtualFile testRootFile = findRootFile(file.getVirtualFile());
if (testRootFile != null) {
VirtualFile jtRegRoot = testRootFile.getParent();
libFile = jtRegRoot.findFileByRelativePath(lib.substring(1));
if (libFile != null) {
LOG.debug("Found : " + libFile + " relative to test suite root.");
} else {
// "If the result does not identify an existing directory, it will be further
// evaluated against each entry of a search path in turn, until an existing
// directory is found. The search path is specified by the external.lib.roots
// entry in the test suite configuration files."
LOG.debug("Nothing found relative to test suite root.");
Properties testSuiteConfig = testSuiteConfigForRootFile(testRootFile);
if (testSuiteConfig != null) {
String s = testSuiteConfig.getProperty("external.lib.roots").trim();
if (s != null) {
LOG.debug("external.lib.roots = \"" + s + "\"");
// Note: jtreg tag specification for "external.lib.roots" talks about a
// search path with separate segments; however, all usages I see in our
// configurations are single paths, so to keep matters simple I treat it
// as a single path.
// The "external.lib.roots" is relative to the jtreg root
VirtualFile searchPath = jtRegRoot.findFileByRelativePath(s);
if (searchPath != null) {
libFile = searchPath.findFileByRelativePath(lib);
}
}
}
}
}
} else {
//relative
libFile = file.getParent().getVirtualFile().findFileByRelativePath(lib);
}
if (libFile != null && libFile.exists()) {
if (libFile != null) {
LOG.debug("@library \"" + lib + "\" resolves to " + libFile + ".");
if (libFile.exists()) {
LOG.debug("which exists.");
roots.add(libFile);
} else {
LOG.debug("which does not exists.");
}
}
}
}
......
#!/bin/sh
#
# Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -47,6 +47,27 @@
#
# jtreg also provides Ant tasks; see the documentation for details.
# Implementation notes for Windows:
# Cygwin:
# Detected with `uname -s` (CYGWIN*)
# Windows drives are mounted with /cygdrive/LETTER
# Windows Subsystem for Linux (WSL):
# Detected with `uname -s` (Linux) and /proc/version contains "Microsoft"
# Windows drives are mounted with /mnt/LETTER
# Windows binaries need an explicit .exe suffix.
#
# Values are evaluated according to whether the are used in the context of the
# shell, or in the context of the JDK under test.
# JTJAVA is evaluated for use in the shell, to run java
# JTHOME is evaluated as a JDK arg, for use in -classpath or -jar args
# Other command line are updated to be JDK args for jtreg.
case "`uname -s`" in
CYGWIN* ) cygwin=1 ;;
Linux ) if grep -q Microsoft /proc/version ; then wsl=1 ; fi ;;
esac
# Determine jtreg/JavaTest installation directory
if [ -n "$JT_HOME" ]; then
if [ ! -r $JT_HOME/lib/jtreg.jar ];then
......@@ -56,7 +77,8 @@ if [ -n "$JT_HOME" ]; then
else
# Deduce where script is installed
# - should work on most derivatives of Bourne shell, like ash, bash, ksh,
# sh, zsh, etc, including on Windows, MKS (ksh) and Cygwin (ash or bash)
# sh, zsh, etc, including on Windows, MKS (ksh), Cygwin (ash or bash)
# and Windows Subsystem for Linux (WSL)
if type -p type 1>/dev/null 2>&1 && test -z "`type -p type`" ; then
myname=`type -p "$0"`
elif type type 1>/dev/null 2>&1 ; then
......@@ -75,14 +97,8 @@ else
fi
fi
# Normalize JT_HOME if using Cygwin
case "`uname -s`" in
CYGWIN* ) cygwin=1 ; JT_HOME=`cygpath -a -m "$JT_HOME"` ;;
esac
# Separate out -J* options for the JVM
# Note jdk as possible default to run jtreg
# Look for -jdk option as possible default to run jtreg
# Unset IFS and use newline as arg separator to preserve spaces in args
DUALCASE=1 # for MKS: make case statement case-sensitive (6709498)
saveIFS="$IFS"
......@@ -90,12 +106,8 @@ nl='
'
for i in "$@" ; do
IFS=
if [ -n "$cygwin" ]; then i=`echo $i | sed -e 's|/cygdrive/\([A-Za-z]\)/|\1:/|'` ; fi
case $i in
-jdk:* ) jdk="`echo $i | sed -e 's/^-jdk://'`"
jtregOpts=$jtregOpts$nl$i ;;
-J* ) javaOpts=$javaOpts$nl`echo $i | sed -e 's/^-J//'` ;;
* ) jtregOpts=$jtregOpts$nl$i ;;
-jdk:* ) jdk="`echo $i | sed -e 's/^-jdk://'`" ;;
esac
IFS="$saveIFS"
done
......@@ -114,6 +126,14 @@ else
JT_JAVA=java
fi
# Fixup JT_JAVA, JTHOME as needed, if using Cygwin or WSL
if [ -n "$cygwin" ]; then
JT_HOME=`cygpath -a -m "$JT_HOME"` ;
elif [ -n "$wsl" -a -x "$JT_JAVA".exe ]; then
JT_JAVA="$JT_JAVA".exe
JT_HOME=`wslpath -a -m "$JT_HOME"`
fi
# Verify java version (1.)7 or newer used to run jtreg
version=`"$JT_JAVA" -classpath "${JT_HOME}/lib/jtreg.jar" com.sun.javatest.regtest.agent.GetSystemProperty java.version 2>&1 |
grep 'java.version=' | sed -e 's/^.*=//' -e 's/^1\.//' -e 's/\([1-9][0-9]*\).*/\1/'`
......@@ -126,6 +146,28 @@ elif [ "$version" -lt 7 ]; then
exit 1;
fi
# Separate out -J* options for the JVM
# Unset IFS and use newline as arg separator to preserve spaces in arg
DUALCASE=1 # for MKS: make case statement case-sensitive (6709498)
saveIFS="$IFS"
nl='
'
if [ -n "$cygwin" ]; then
driveDir=cygdrive ;
elif [ -n "$wsl" -a "${JT_JAVA##*.}" = "exe" ]; then
driveDir=mnt ;
fi
for i in "$@" ; do
IFS=
if [ -n "$driveDir" ]; then i=`echo $i | sed -e 's|/'$driveDir'/\([A-Za-z]\)/|\1:/|'` ; fi
case $i in
-J* ) javaOpts=$javaOpts$nl`echo $i | sed -e 's/^-J//'` ;;
* ) jtregOpts=$jtregOpts$nl$i ;;
esac
IFS="$saveIFS"
done
unset DUALCASE
# And finally ...
IFS=$nl
......
......@@ -304,7 +304,6 @@ public class Help {
for (String n: o.names) {
if (sb.length() > 0)
sb.append(" | ");
sb.append("-");
sb.append(n);
switch (o.argType) {
case NONE:
......
......@@ -94,7 +94,7 @@ public class Main {
title = arg;
}
},
new Option(REST, DOC, "help", "-h", "-help", "-usage") {
new Option(REST, DOC, "help", "-h", "-help", "--help", "-usage") {
@Override
public void process(String opt, String arg) {
if (help == null)
......
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, 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
......@@ -82,15 +82,13 @@ public class SimpleReporter extends Reporter {
writeI18N("simple.set", i, table.getColumnName(i));
print(" ");
writeI18N("simple.counts",
new Object[] {
new Integer(p),
new Integer((p > 0) && (f + e + nr > 0) ? 1 : 0),
new Integer(f),
new Integer((f > 0) && (e + nr > 0) ? 1 : 0),
new Integer(e),
new Integer((e > 0) && (nr > 0) ? 1 : 0),
new Integer(nr)
});
new Integer(nr));
println();
}
}
......
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -48,7 +48,7 @@ import com.sun.javatest.finder.ShScriptCommentStream;
*
* One option is supported:
* <dl>
* <dt><code>-l</code>line-length
* <dt>{@code -l}line-length
* <dd>the amount of each suspect comment to display
* </dl>
*
......