Skip to content
GitLab
Explore
Sign in
Register
Commits on Source
3
New upstream version 4.2-b11
· 74c8229c
Emmanuel Bourg
authored
Aug 02, 2018
74c8229c
New upstream version 4.2-b12
· 81ddc3e5
Emmanuel Bourg
authored
Aug 02, 2018
81ddc3e5
New upstream version 4.2-b13
· 4aecb7d4
Emmanuel Bourg
authored
Aug 02, 2018
4aecb7d4
Show whitespace changes
Inline
Side-by-side
.hg_archival.txt
View file @
4aecb7d4
repo: 9f51ef22f00a3d5b681472cacf3ce15868073103
node: 7
46c6d1328721541d3b16154c25a
0179
fbf53f7c
node: 7
a38f21e077821a5
01
5
79
2e85b3793c90c81b866
branch: default
tag: jtreg4.2-b1
0
tag: jtreg4.2-b1
3
.hgtags
View file @
4aecb7d4
...
...
@@ -23,3 +23,6 @@ dbccea90c34dacf7e0824d5e3d3e9e1e930a103a jtreg4.2-b02
26d8a4a47674c4ca304b9e290dccca1dd1c7224f jtreg4.2-b07
cce0ac75e87864ed365a420fb836a4430421ab0f jtreg4.2-b08
684f12eef4a8c2f42afe2abe3d79eead72efcc5f jtreg4.2-b09
746c6d1328721541d3b16154c25a0179fbf53f7c jtreg4.2-b10
a13ec77e7adcc4c9ed434e664abc350abaacc045 jtreg4.2-b11
652902f7fb0ed0b4f307d61a799caf50a6e609be jtreg4.2-b12
README
View file @
4aecb7d4
Building The Regression Test Harness for the OpenJDK platform: jtreg
There are two ways to build jtreg. The first way uses GNU Make to build jtreg
and run all the tests. The second way uses Ant, and is primarily intended for
developers using an IDE such as NetBeans. Not all of the tests are available
using the Ant build.
(This information is also available at http://openjdk.java.net/jtreg/build.html)
jtreg depends on a number of external components:
JT Harness, TestNG, JUnit, AsmTools. Ant, and JCov.
The fundamental way to build jtreg is with GNU make, specifying where to find
those external components, but a script is also available that will download
appropriate copies of those components before building jtreg.
Building jtreg with the build-all.sh script
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
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.
% cd jtreg-root-directory
% sh make/build-all.sh JDK-directory
The script will create a build sub-directory, download and build dependencies,
and finally build jtreg itself. The resulting image will be in
build/images/jtreg.
No environment variables need to be specified to get a standard build of jtreg.
However, the following environment variables may be set, for a non-standard
build:
ASMTOOLS_VERSION, JCOV_VERSION, JTHARNESS_VERSION
These variables may be set to the name of a tag identifying a specific
changeset in the corresponding OpenJDK repository, or to the pseudo-tag "tip".
MAKE_ARGS
Arguments for the internal invocation of "make". The default is to just build
jtreg, but setting this environment variable allows additional targets, such
as test targets, to be run. The explicit target to build jtreg is "build";
the target to run some basic sanity tests is "quick-test"; and the target
to run all tests is "test". You can also use the make "-j" option to build
targets in parallel. For example:
MAKE_ARGS="-j 4 build quick-test" sh make/build-all.sh
UNZIP_OPTS, WGET_OPTS
These two variables default to "-q", to suppress unnecessary output.
You can set these variables to change the default behavior.
Building jtreg with GNU Make
The Makefile is in make/Makefile, and creates deliverables in the build/
directory, similar to OpenJDK. By default, the build file builds
jtreg and runs
the tests
. You can build jtreg from a Unix-like command shell with the following
directory, similar to OpenJDK. By default, the build file
just
builds
an image
for jtreg
. You can build jtreg from a Unix-like command shell with the following
commands:
% cd jtreg-root-directory
% cd
<
jtreg-root-directory
>
% make -C make
Dependencies
jtreg has a number of build dependencies. These can be set with values on the
make command line or with values in make/Defs.gmk.
make command line or with values in make/Defs.gmk. You can also include the
appropriate license files in the jtreg image, by setting the appropriate make
variables. These are documented in make/Defs.gmk
JDK 1.7 (or better)
Set JDK
17
HOME to the JDK or equivalent used to build jtreg. It must be
Set JDKHOME to the JDK or equivalent used to build jtreg. It must be
equivalent to JDK 1.7 or later.
JavaHelp
See https://javahelp.dev.java.net/. Set JAVAHELP_HOME to an installed copy
of JavaHelp. It should be version 2.0_01 or better.
JT Harness
See https://jtharness.dev.java.net/. Set JTHARNESS_HOME to the installed
copy of the version of JT Harness to be used. It should be version 4.1.3 or
better. (Note, the license changed for version 4.1.3.) See the notes below
on building JT Harness from source for use in jtreg.
Note: there is a bug in JT Harness 4.1.3 which causes some of the jtreg self
tests to fail. These are run automatically if you build jtreg with the
default "all" target. The bug affects the ability to run tests in the root
directory of a test suite. (This does not apply to OpenJDK test suites.) To
work around this issue, you can either download and build JT Harness 4.1.3a
from source, or you can use version 4.1.3 and just build jtreg, with the
"build" target, and avoid running the jtreg self tests invoked by the "test"
target in the Makefile.
Xalan
See http://xml.apache.org/xalan-j/. This is used while building jtreg to
process XML files.
See https://wiki.openjdk.java.net/display/CodeTools/JT+Harness.
Set JTHARNESS_HOME to the installed copy of the version of JT Harness to be
used. It should be version 5.0 or better.
The following dependencies are optional.
Ant
See http://ant.apache.org/. Set ANTHOME to an installed copy of Ant. It
should be version 1.9.x. or better.
AsmTools
See https://wiki.openjdk.java.net/display/CodeTools/asmtools.
Set ASMTOOLS_HOME to the installed copy of the version of AsmTools to be
used. It should be version 6.0 or better.
Note: Do not confuse this component with ASM bytecode engineering library
available at http://asm.ow2.org/
HTMLCheck
This uses nsgmlns, available from http://www.jclark.com/sp/, and DTDs,
available from http://w3c.org/ to validate HTML documentation files.
Set HTMLCHECK to an HTML validation program. It should take a single file
as argument, and exit with a zero return code for a valid file, and non-zero
for an invalid one. This is optional, and if available, it will be used
while building jtreg. It may be left unset to ignore the checks
.
JUnit
See http://junit.org/. The recommended version is currently JUnit 4.10.
TestNG
See http://testng.org/. The recommended version is currently 6.9.5.
The following dependencies are optional
.
LinkLint
See http://www.linklint.org/. This is used to validate the links in HTML
documentation files. Set LINKLINT to your installed copy of LinkLint.
This is optional, and if available, it will be used while building jtreg.
It may be left unset to ignore the checks.
JCov
See https://wiki.openjdk.java.net/display/CodeTools/jcov.
Set JCOV_HOME to the installed copy of the version of JCov to be used.
It should be version 2.0 or better.
The following dependencies are only required when running the tests for jtreg.
(Note: this only applies to the tests for jtreg itself; these dependencies are
not required when using jtreg to run the JDK regression tests
.
JDK 1.5
This is used when running some of the tests. Set JDK15HOME to run these
tests. It need not be set if you are just building jtreg
.
JDK 1.6
This is used when running some of the tests. Set JDK16HOME to run these
tests. It must be equivalent to JDK 1.6 or later. It need not be set if you are
just building jtreg.
tests. It need not be set if you are just building jtreg.
Ant
See http://ant.apache.org/. Set ANTHOME to an installed copy of Ant. This is
used when running some of the tests. It should be version 1.6.5. or better.
It need not be set if you are just building jtreg.
JDK 1.7
This is used when running some of the tests. Set JDK17HOME to run these
tests. It need not be set if you are just building jtreg.
Running Tests
JDK 1.8
This is used when running some of the tests. Set JDK18HOME to run these
tests. It need not be set if you are just building jtreg.
JDK 1.9
This is used when running some of the tests. Set JDK19HOME to run these
tests. It need not be set if you are just building jtreg.
Running jtreg Self-Tests
The tests can be invoked with individual make targets, or collectively via the
"test" target.
...
...
@@ -90,8 +132,8 @@ are running. Various implementations of VNC are available, such as from
http://www.realvnc.com/. Using VNC is optional; it is not required in order to
run the tests.
By default, VNC will be used if vncserver is found on your execution path, or
if
VNC_HOME points to an installed copy of VNC. To explicitly disable the use of
By default, VNC will be used if vncserver is found on your execution path, or
if
VNC_HOME points to an installed copy of VNC. To explicitly disable the use of
VNC, set the VNC environment variable to one of false, off, no, or 0. Unless
explicitly disabled, the tests will check the following:
...
...
@@ -108,9 +150,13 @@ complete.
The logic for using VNC is encapsulated within the script make/display.sh.
Building jtreg with Ant
It is possible to build jtreg with Ant, but this is primarily intended as a
convenience while working on the jtreg source code. If you are building jtreg
to run OpenJDK tests, it is recommended that you build jtreg using the Makefile,
perhaps via the build-all.sh wrapper script.
The build file is in make/build.xml; it creates intermediate files in the build/
directory and deliverables in the dist/ directory. By default, the build file
just builds jtreg, but does not run any tests. You can build jtreg from a
...
...
@@ -130,35 +176,8 @@ For example, on Ubuntu Linux these tasks are in the ant-optional package.
Running Tests
Some of the tests can be invoked with individual targets beginning "test-", or
collectivly via the "test-jtreg" target.
Building JT Harness for jtreg
JT Harness has build-time dependencies on a number of components, some of which
may cause issues. There are workarounds available which allow you to build
JT Harness while not affecting its use for jtreg.
JUnit 4
If your system does not yet support JUnit 4, you can build JT Harness
without needing to install JUnit 4 by executing the "jar" and "dist-doc"
targets instead of the default "build" target. This will avoid building the
jar file which references JUnit 4. The jar file (jt-junit.jar) is not
required when running jtreg.
The Java Communications API (also known as javax.comm)
This API is not widely available under an OSI-approved license. There is a
replacement known as "librxtx-java" which provides the same functionality
in the "gnu.io" package. To use this package, you will have to edit the
JT Harness source code so that references to "javax.comm." are replaced
by references to "gnu.io.". These references are all in the
"com.sun.javatest.agent" package. These changes are just required to
compile JT Harness. The resulting classes are not required when running
jtreg itself.
Note: if you are building jtreg with GNU Make, and want to run all the self
tests for jtreg, you should make sure you use a patched version of JT Harness,
available on the JT Harness 4.1.3a development branch (or later). The patch
fixes a bug which is exhibited when the jtreg self tests are run. It does not
affect the use of jtreg to run the OpenJDK regression tests.
Some of the tests can be invoked with individual targets beginning
"-jtreg-test-", or collectively via the "jtreg-test" target. (The use of
"jtreg-test" rather than "test" is to protect against interactions with JUnit in
older versions of NetBeans.)
make/Defs.gmk
View file @
4aecb7d4
#
# Copyright (c) 1996, 201
7
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1996, 201
8
, 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
...
...
@@ -79,10 +79,12 @@ override BUILDDIR := $(call FullPath, $(BUILDDIR))
#----------------------------------------------------------------------
#
# Parameters to control what to build with
# explicit JDK versions, for use as needed
# Parameters to control what to build and test with.
#----- Java: see http://java.sun.com
#----- Java: http://openjdk.java.net/ http://jdk.java.net/
#
# Explicit JDK versions, for use as needed by tests, all optional for build.
# At a minimum, JDKHOME must be set, either directly or indirectly. (See below).
ifndef JDK15HOME
ifdef SLASHJAVA
...
...
@@ -117,111 +119,225 @@ ifndef JDK9HOME
JDK9HOME = $(SLASHJAVA)/re/jdk/9/promoted/latest/binaries/linux-i586
endif
endif
JDK9HOME := $(call FullPath,$(JDK19HOME))
JDK9HOME := $(call FullPath,$(JDK9HOME))
# The JDK used to build jtreg and to run most tests.
# It should be set to JDK 7 or later.
# If not set, it defaults to $(JDK18HOME), or to $(J2SEHOME) for backwards
# compatibility
ifndef JDKHOME
ifdef JDK18HOME
JDKHOME = $(JDK18HOME)
else
ifdef J2SEHOME
JDKHOME = $(J2SEHOME)
endif
endif
endif
# J2SE for most classes
J2SEHOME = $(JDK17HOME)
J2SEJAVA = $(J2SEHOME)/bin/java
J2SEJAVAC = $(J2SEHOME)/bin/javac
JAR = $(J2SEHOME)/bin/jar
# derived values
JDKJAVA = $(JDKHOME)/bin/java
JDKJAVAC = $(JDKHOME)/bin/javac
JAR = $(JDKHOME)/bin/jar
ifdef JDK15HOME
JDK15_BOOTCLASSPATH = -bootclasspath $(JDK15HOME)/jre/lib/rt.jar
endif
ifdef JDK17HOME
JDK17_BOOTCLASSPATH = -bootclasspath $(JDK17HOME)/jre/lib/rt.jar
endif
# for files needed to run othervm tests on oldest supported platforms
REGTEST_OLD_JAVAC = $(JDK17HOME)/bin/javac
REGTEST_OLD_JAVAC_OPTIONS = -source 1.2 -target 1.1 -Xlint:all,-options -Werror
REGTEST_OLD_JAVAC = $(JDKHOME)/bin/javac
REGTEST_OLD_JAVAC_OPTIONS = \
-source 1.2 -target 1.1 $(JDK15_BOOTCLASSPATH) -Xlint:all,-options -Werror
# for files needed to run agentvm tests (on platforms back to JDK 1.5)
REGTEST_AGENT_JAVAC = $(JDK17HOME)/bin/javac
REGTEST_AGENT_JAVAC_OPTIONS = -source 5 -target 5 -Xlint:all,-options -Werror
REGTEST_AGENT_JAVAC = $(JDKHOME)/bin/javac
REGTEST_AGENT_JAVAC_OPTIONS = \
-source 5 -target 5 $(JDK15_BOOTCLASSPATH) -Xlint:all,-options -Werror
# for files needed for jtreg tool
REGTEST_TOOL_JAVAC = $(J2SEHOME)/bin/javac
REGTEST_TOOL_JAVAC_OPTIONS = -source 7 -target 7 -Xlint:all,-options -Werror
REGTEST_TOOL_JAVAC = $(JDKHOME)/bin/javac
REGTEST_TOOL_JAVAC_OPTIONS = \
-source 7 -target 7 $(JDK17_BOOTCLASSPATH) -Xlint:all,-options -Werror
#----- JavaHelp
#
# JavaHelp, previously available at https://javahelp.dev.java.net/,
# is no longer supported or generally available.
# If you use JT Harness 5.0 or later, you do not need JavaHelp.
# If you use JT Harness 4.6 (in order to test on very old versions of JDK),
# you will need JavaHelp.
ifndef JAVAHELP_HOME
ifdef SLASHJAVA
JAVAHELP_HOME = $(SLASHJAVA)/re/jh/2.0_01/promoted/fcs/latest/binaries/jh2.0/javahelp
endif
endif
ifndef JAVAHELP_JAR
ifdef JAVAHELP_HOME
JAVAHELP_HOME := $(call FullPath,$(JAVAHELP_HOME))
JAVAHELP_JAR = $(JAVAHELP_HOME)/lib/jh.jar
endif
endif
JAVAHELP_JAR := $(call FullPath,$(JAVAHELP_JAR))
#----- JavaTest: see https://wiki.openjdk.java.net/display/CodeTools/JT+Harness
#----- JavaTest: https://wiki.openjdk.java.net/display/CodeTools/JT+Harness
#
# At a minimum, JAVATEST_JAR must be set, either directly or indirectly.
# If not set explicitly, it defaults to values derived from JAVATEST_HOME,
# JTHARNESS_HOME or SLASH_JAVA.
# Set JTHARNESS_LICENSE and JTHARNESS_COPYRIGHT to include license and
# copyright files in the product image. If not set explicitly, these
# default to values derived from JAVATEST_HOME, JTHARNESS_HOME or SLASH_JAVA.
ifndef JTHARNESS_HOME
ifdef SLASHJAVA
JTHARNESS_HOME = $(SLASHJAVA)/re/jtharness/
4.6/archive/MR1
/binaries
JTHARNESS_HOME = $(SLASHJAVA)/re/jtharness/
6.0/promoted/latest
/binaries
/
endif
endif
JTHARNESS_HOME := $(call FullPath,$(JTHARNESS_HOME))
ifndef JAVATEST_HOME
ifdef JTHARNESS_HOME
JAVATEST_HOME = $(JTHARNESS_HOME)
else
ifdef SLASHJAVA
JAVATEST_HOME = $(SLASHJAVA)/re/javatest/
4.6/archive
/binaries/javatest
JAVATEST_HOME = $(SLASHJAVA)/re/javatest/
6.0/promoted/latest
/binaries/javatest
/
endif
endif
endif
JAVATEST_HOME := $(call FullPath,$(JAVATEST_HOME))
ifndef JAVATEST_JAR
ifdef JAVATEST_HOME
JAVATEST_JAR = $(JAVATEST_HOME)/lib/javatest.jar
endif
endif
JAVATEST_JAR := $(call FullPath,$(JAVATEST_JAR))
ifndef JTHARNESS_LICENSE
JTHARNESS_LICENSE = $(wildcard $(JTHARNESS_HOME)/legal/license.txt)
endif
JTHARNESS_LICENSE := $(call FullPath,$(JTHARNESS_LICENSE))
#----- JCov 2.0
ifndef JTHARNESS_COPYRIGHT
JTHARNESS_COPYRIGHT = $(wildcard $(JTHARNESS_HOME)/legal/copyright.txt)
endif
JTHARNESS_COPYRIGHT := $(call FullPath,$(JTHARNESS_COPYRIGHT))
#----- JCov 3.0: https://wiki.openjdk.java.net/display/CodeTools/jcov
#
# JCov is optional.
# If provided, coverage-collection features in jtreg will be enabled.
#
# To include support for JCov, JCOV_JAR and JCOV_NETWORK_SAVER_JAR
# must be set. If not set explicitly, these default to values derived
# from JCOV_HOME or SLASH_JAVA.
# Set JCOV_LICENSE to include the license file in the product image.
# If not set explicitly, this defaults to a value derived from JCOV_HOME
# or SLASH_JAVA.
ifndef JCOV_HOME
ifdef SLASHJAVA
JCOV_HOME = $(SLASHJAVA)/re/jcov/
2
.0/promoted/latest/binaries/jcov_
2
.0/
JCOV_HOME = $(SLASHJAVA)/re/jcov/
3
.0/promoted/
fcs/
latest/binaries/jcov_
3
.0/
endif
endif
JCOV_HOME := $(call FullPath,$(JCOV_HOME))
ifndef JCOV_JAR
ifdef JCOV_HOME
JCOV_JAR = $(JCOV_HOME)/lib/jcov.jar
endif
endif
JCOV_JAR := $(call FullPath,$(JCOV_JAR))
ifndef JCOV_NETWORK_SAVER_JAR
ifdef JCOV_HOME
JCOV_NETWORK_SAVER_JAR = $(JCOV_HOME)/lib/jcov_network_saver.jar
endif
endif
JCOV_NETWORK_SAVER_JAR := $(call FullPath,$(JCOV_NETWORK_SAVER_JAR))
JCOV = $(JDK16HOME)/bin/java -jar $(JCOV_JAR)
ifndef JCOV_LICENSE
ifdef JCOV_HOME
JCOV_LICENSE = $(wildcard $(JCOV_HOME)/LICENSE)
endif
endif
JCOV_LICENSE := $(call FullPath,$(JCOV_LICENSE))
#----- AsmTools 6.0
JCOV = $(JDK16HOME)/bin/java -jar $(JCOV_JAR)
ifndef ASMTOOLS_JAR
ifdef ASMTOOLS_HOME
ASMTOOLS_JAR = $(ASMTOOLS_HOME)/lib/asmtools.jar
else
#----- AsmTools 7.0: https://wiki.openjdk.java.net/display/CodeTools/asmtools
#
# AsmTools is required, to support the execution of tests using
# *.jasm and *.jcod files.
#
# ASMTOOLS_JAR must be set, either directly or indirectly.
# If not set explicitly, it defaults to a value derived from
# ASMTOOLS_HOME or SLASHJAVA.
# Set ASMTOOLS_LICENSE to include the license file in the product image.
# If not set explicitly, this defaults to a value derived from
# ASMTOOLS_HOME or SLASH_JAVA.
ifndef ASMTOOLS_HOME
ifdef SLASHJAVA
ASMTOOLS_
JAR
= $(SLASHJAVA)/re/asmtools/
6
.0/promoted/latest/binaries/asmtools-
6
.0
/lib/asmtools.jar
ASMTOOLS_
HOME
= $(SLASHJAVA)/re/asmtools/
7
.0/
opensource/
promoted/latest/binaries/asmtools-
7
.0
endif
endif
ifndef ASMTOOLS_JAR
ASMTOOLS_JAR = $(ASMTOOLS_HOME)/lib/asmtools.jar
endif
ASMTOOLS_JAR := $(call FullPath,$(ASMTOOLS_JAR))
#----- JUnit 4.10: see http://www.junit.org/
ifndef ASMTOOLS_LICENSE
ASMTOOLS_LICENSE = $(wildcard $(ASMTOOLS_HOME)/LICENSE)
endif
ASMTOOLS_LICENSE := $(call FullPath,$(ASMTOOLS_LICENSE))
#----- JUnit 4.10: http://www.junit.org/
# https://sourceforge.net/projects/junit/files/junit/4.10/junit-4.10.jar/download
#
# JUnit is required, to support the execution of tests using JUnit
#
# JUNIT_JAR must be set, either directly or indirectly.
# If not set explicitly, it defaults to a value derived from
# JUNIT_HOME or SLASHJAVA.
# Set JUNIT_LICENSE to include the license file in the product image.
# If not set explicitly, this defaults to a value derived from
# JUNIT_HOME or SLASH_JAVA.
ifndef JUNIT_HOME
ifdef SLASHJAVA
JUNIT_HOME = $(SLASHJAVA)/devtools/share/junit/junit-4.10/
endif
endif
ifndef JUNIT_JAR
ifdef
SLASHJAVA
JUNIT_JAR = $(
SLASHJAVA)/devtools/share/junit/junit-4.10
/junit-4.10.jar
ifdef
JUNIT_HOME
JUNIT_JAR = $(
JUNIT_HOME)
/junit-4.10.jar
endif
endif
JUNIT_JAR := $(call FullPath,$(JUNIT_JAR))
ifndef JUNIT_LICENSE
ifdef JUNIT_HOME
JUNIT_LICENSE = $(wildcard $(JUNIT_HOME)/LICENSE.txt)
endif
endif
JUNIT_LICENSE := $(call FullPath,$(JUNIT_LICENSE))
#----- TestNG 6.9.5: see http://www.testng.org/
# http://testng.org/doc/download.html
#
# TestNG is required, to support the execution of tests using TestNG
#
# TESTNG_JAR must be set, either directly or indirectly.
# If not set explicitly, it defaults to a value derived from
# TESTNG_HOME or SLASHJAVA.
# Set TESTNG_LICENSE to include the license file in the product image.
# If not set explicitly, this defaults to a value derived from
# TESTNG_HOME or SLASH_JAVA.
ifndef TESTNG_HOME
ifdef SLASHJAVA
...
...
@@ -237,6 +353,11 @@ ifndef TESTNG_JAR
endif
TESTNG_JAR := $(call FullPath,$(TESTNG_JAR))
ifndef TESTNG_LICENSE
TESTNG_LICENSE = $(wildcard $(TESTNG_HOME)/LICENSE.txt)
endif
TESTNG_LICENSE := $(call FullPath,$(JUNIT_LICENSE))
# TestNG requires jcommander, which may or may not be bundled with TESTNG_JAR.
# If it is not, set JCOMMANDER_JAR to an appropriate version
ifndef JCOMMANDER_JAR
...
...
@@ -248,18 +369,27 @@ ifdef JCOMMANDER_JAR
JCOMMANDER_JAR := $(call FullPath,$(JCOMMANDER_JAR))
endif
#----- Ant: see http://ant.apache.org/
#----- Ant: http://ant.apache.org/
#
# Ant is required, to support the provision of a <jtreg> Ant task
#
# ANT_JAR must be set, either directly or indirectly.
# If not set explicitly, it defaults to a value derived from
# ANTHOME or SLASHJAVA. The jar file is just used when building
# jtreg, and is not included in the product image.
ifndef ANTHOME
ifdef SLASHJAVA
ANTHOME = $(SLASHJAVA)/devtools/share/ant/1.
7.0
ANTHOME = $(SLASHJAVA)/devtools/share/ant/1.
9.4
endif
endif
ANTHOME := $(call FullPath,$(ANTHOME))
ifndef ANT_JAR
ifdef ANTHOME
ANT_JAR = $(ANTHOME)/lib/ant.jar
endif
endif
ANT_JAR := $(call FullPath,$(ANT_JAR))
ifdef ANTHOME
ANT = $(ANTHOME)/bin/ant
...
...
@@ -277,6 +407,7 @@ FIND = /usr/bin/find
GREP := $(shell if [ -r /bin/grep ]; then echo /bin/grep ; else echo /usr/bin/grep ; fi )
LN = /bin/ln
MKDIR = /bin/mkdir
MV = /bin/mv
PERL = /usr/bin/perl
RM = /bin/rm -rf
SED := $(shell if [ -r /bin/sed ]; then echo /bin/sed ; else echo /usr/bin/sed ; fi )
...
...
make/Makefile
View file @
4aecb7d4
#
# Copyright (c) 1999, 201
7
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 201
8
, 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
...
...
@@ -43,6 +43,12 @@ include Rules.gmk
build
:
$(BUILDFILES)
test
:
$(INITIAL_TESTS) $(TESTS) $(FINAL_TESTS)
count
=
`
echo
$+
|
wc
-w
`
;
\
echo
"All (
$${
count
}
) selected tests completed successfully"
quick-test
:
$(INITIAL_TESTS)
count
=
`
echo
$+
|
wc
-w
`
;
\
echo
"All (
$${
count
}
) selected tests completed successfully"
images
:
$(VERBOSEZIPFILES)
...
...
@@ -64,6 +70,7 @@ endif
ifdef
JDK18HOME
@
echo
"JDK18HOME =
$(
JDK18HOME
)
"
endif
@
echo
"JDKHOME =
$(
JDKHOME
)
"
ifdef
JAVAHELP_HOME
@
echo
"JAVAHELP_HOME =
$(
JAVAHELP_HOME
)
"
endif
...
...
@@ -71,17 +78,20 @@ endif
ifneq
($(JTHARNESS_HOME), $(JAVATEST_HOME))
@
echo
"JTHARNESS_HOME =
$(
JTHARNESS_HOME
)
"
endif
ifdef
JCOV_JAR
@
echo
"JTHARNESS_LICENSE =
$(
JTHARNESS_LICENSE
)
"
@
echo
"JTHARNESS_COPYRIGHT =
$(
JTHARNESS_COPYRIGHT
)
"
@
echo
"JCOV_JAR =
$(
JCOV_JAR
)
"
endif
ifdef
ASMTOOLS_JAR
@
echo
"JCOV_LICENSE =
$(
JCOV_LICENSE
)
"
@
echo
"ASMTOOLS_JAR =
$(
ASMTOOLS_JAR
)
"
endif
@
echo
"ASMTOOLS_LICENSE =
$(
ASMTOOLS_LICENSE
)
"
@
echo
"ANTHOME =
$(
ANTHOME
)
"
@
echo
"ANT_JAR =
$(
ANT_JAR
)
"
@
echo
"JUNIT_JAR =
$(
JUNIT_JAR
)
"
@
echo
"JUNIT_LICENSE =
$(
JUNIT_LICENSE
)
"
@
echo
"TESTNG_HOME =
$(
TESTNG_HOME
)
"
@
echo
"TESTNG_JAR =
$(
TESTNG_JAR
)
"
@
echo
"TESTNG_LICENSE =
$(
TESTNG_LICENSE
)
"
@
echo
"JCOMMANDER_JAR =
$(
JCOMMANDER_JAR
)
"
#----------------------------------------------------------------------
...
...
make/Platform.gmk
View file @
4aecb7d4
...
...
@@ -59,7 +59,7 @@ endif
ifeq ($(UNAME_S), Darwin)
OS_NAME = macosx
OS_ARCH := $(shell $(UNAME) -m)
OS_VERSION := $(shell
$(UNAME) -r
)
OS_VERSION := $(shell
defaults read loginwindow SystemVersionStampAsString
)
endif
ifeq ($(OS_NAME),)
OS_NAME = windows
...
...
@@ -88,13 +88,13 @@ endif
OS_VERSION := $(shell $(ECHO) "$(OS_VERSION)" | $(CUT) -d'.' -f1,2)
# Name to use for x86_64 arch (historically amd64, but should change someday)
OS_ARCH_X64_NAME:=amd64
#
OS_ARCH_X64_NAME:=x64
#
OS_ARCH_X64_NAME:=amd64
OS_ARCH_X64_NAME:=x64
# Alternate arch names (in case this arch is known by a second name)
# PROBLEM_LISTS may use either name.
OS_ARCH2-amd64:=x64
#
OS_ARCH2-x64:=amd64
#
OS_ARCH2-amd64:=x64
OS_ARCH2-x64:=amd64
# Try and use the arch names consistently
OS_ARCH:=$(patsubst x64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
...
...
make/Rules.gmk
View file @
4aecb7d4
#
# Copyright (c) 1996, 201
6
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1996, 201
8
, 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
...
...
@@ -33,6 +33,16 @@ $(CLASSDIR)/%.properties: $(JAVADIR)/%.properties
if [ ! -d $(@D) ] ; then $(MKDIR) -p $(@D) ; fi
$(CP) $(@:$(CLASSDIR)/%=$(JAVADIR)/%) $@
$(CLASSDIR)/%.gif: $(JAVADIR)/%.gif
$(RM) -f $@
if [ ! -d $(@D) ] ; then $(MKDIR) -p $(@D) ; fi
$(CP) $(@:$(CLASSDIR)/%=$(JAVADIR)/%) $@
$(CLASSDIR)/%.png: $(JAVADIR)/%.png
$(RM) -f $@
if [ ! -d $(@D) ] ; then $(MKDIR) -p $(@D) ; fi
$(CP) $(@:$(CLASSDIR)/%=$(JAVADIR)/%) $@
#---------------------------------------------------------------------
$(CLASSDIR) $(BUILDDIR) $(BUILDDIR)/testClasses $(BUILDDIR)/testWork $(BUILDDIR)/testReport:
...
...
@@ -56,7 +66,7 @@ $(IMAGES_DIR)/%.jar: pkgsToFiles.sh
echo "$(@F:%.jar=%)-Version: $(BUILD_VERSION)" ; \
echo "$(@F:%.jar=%)-Milestone: $(BUILD_MILESTONE)" ; \
echo "$(@F:%.jar=%)-Build: $(BUILD_NUMBER)" ; \
echo "$(@F:%.jar=%)-BuildJavaVersion: `$(J
2SE
JAVA) -fullversion 2>&1 | awk '{print $$NF}' | \
echo "$(@F:%.jar=%)-BuildJavaVersion: `$(J
DK
JAVA) -fullversion 2>&1 | awk '{print $$NF}' | \
sed -e 's|^"\(.*\)"$$|Java(TM) 2 SDK, Version \1|'`" ; \
echo "$(@F:%.jar=%)-BuildDate: `/bin/date +'%B %d, %Y'`" ; \
) \
...
...
make/build-all.sh
0 → 100644
View file @
4aecb7d4
#!/bin/bash
#
# Copyright (c) 2017, 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
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
set
-e
set
-u
if
[
"$#"
-ne
1
]
;
then
echo
"Usage:
$0
/path/to/jdk/1.8/image"
>
&2
exit
1
fi
if
[
!
-d
$1
]
;
then
echo
"Error: '
$1
' is not a directory"
>
&2
exit
1
fi
if
[
!
-x
$1
/bin/java
]
;
then
echo
"Error: Could not find an executable binary at '
$1
/bin/java'"
>
&2
exit
1
fi
JAVA_VERSION
=
$(
$1
/bin/java
-version
2>&1 |
grep
"^.* version
\"
.*
\"
$"
|
sed
's/.*\"\(.*\)\".*/\1/'
)
if case
${
JAVA_VERSION
}
in
1.8
*
)
false
;;
*
)
true
;
esac
;
then
echo
"Error: Expected a path to JDK with version 1.8, got version
${
JAVA_VERSION
}
"
>
&2
exit
1
fi
export
JAVA_HOME
=
$1
export
PATH
=
"
$JAVA_HOME
:
$PATH
"
if
[
-n
`
which
sha1sum
`
]
;
then
SHASUM
=
sha1sum
;
elif
[
-n
`
which shasum
`
]
;
then
SHASUM
=
"shasum -a 1"
else
echo
"Error: can't find shasum or sha1sum"
>
&2
exit
1
fi
UNZIP
=
unzip
UNZIP_OPTS
=
"
${
UNZIP_OPTS
:-
-q
}
-u"
WGET
=
wget
WGET_OPTS
=
${
WGET_OPTS
:-
-q
}
ROOT
=
$(
hg root
)
BUILD_DIR
=
${
BUILD_DIR
:-${
ROOT
}
/build
}
if
[
"
${
SKIP_WGET
:-}
"
=
""
-a
-d
${
BUILD_DIR
}
]
;
then
echo
"Error: Build directory '
${
BUILD_DIR
}
' already exists"
>
&2
exit
1
fi
mkdir
-p
${
BUILD_DIR
}
WGet
()
{
if
[
"
${
SKIP_WGET
:-}
"
!=
""
-a
-r
$2
]
;
then
echo
"Skipping download of
$1
..."
else
${
WGET
}
${
WGET_OPTS
}
"
$1
"
-O
"
$2
"
fi
}
# DEPENDENCIES
##############
APACHE_ANT_URL
=
https://archive.apache.org/dist/ant/binaries
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
JCOV_VERSION
=
${
JCOV_VERSION
:-
jcov3
.0-b05
}
# jcov3.0, ASM 6.2
# ANT
#####
ANT_DIR
=
${
BUILD_DIR
}
/ant
mkdir
-p
${
ANT_DIR
}
ANT_VERSION
=
${
ANT_VERSION
:-
apache
-ant-1.9.4
}
ANT_ZIP
=
${
ANT_DIR
}
/
${
ANT_VERSION
}
.zip
WGet
${
APACHE_ANT_URL
}
/
${
ANT_VERSION
}
-bin
.zip
${
ANT_ZIP
}
echo
"ec57a35eb869a307abdfef8712f3688fff70887f
${
ANT_ZIP
}
"
|
${
SHASUM
}
--check
-
${
UNZIP
}
${
UNZIP_OPTS
}
-d
${
ANT_DIR
}
${
ANT_ZIP
}
ANT_JAR
=
${
ANT_DIR
}
/
${
ANT_VERSION
}
/lib/ant.jar
ANT
=
${
ANT_DIR
}
/
${
ANT_VERSION
}
/bin/ant
# ASMTOOLS
##########
ASMTOOLS_BUILD_DIR
=
${
BUILD_DIR
}
/asmtools
mkdir
-p
${
ASMTOOLS_BUILD_DIR
}
# Build asmtools
ASMTOOLS_SRC_ZIP
=
${
ASMTOOLS_BUILD_DIR
}
/source.zip
WGet
${
CODE_TOOLS_URL
}
/asmtools/archive/
${
ASMTOOLS_VERSION
}
.zip
${
ASMTOOLS_SRC_ZIP
}
${
UNZIP
}
${
UNZIP_OPTS
}
-d
${
ASMTOOLS_BUILD_DIR
}
${
ASMTOOLS_SRC_ZIP
}
if
[
"
${
ASMTOOLS_VERSION
}
"
=
"tip"
]
;
then
ASMTOOLS_VERSION
=
`
cd
${
ASMTOOLS_BUILD_DIR
}
;
ls
-d
asmtools-
*
|
sed
-e
's/asmtools-//'
`
fi
ASMTOOLS_SRC
=
${
ASMTOOLS_BUILD_DIR
}
/asmtools-
${
ASMTOOLS_VERSION
}
ASMTOOLS_DIST
=
${
ASMTOOLS_BUILD_DIR
}
/build
${
ANT
}
-DBUILD_DIR
=
${
ASMTOOLS_DIST
}
-f
${
ASMTOOLS_SRC
}
/build/build.xml
ASMTOOLS_JAR
=
${
ASMTOOLS_DIST
}
/binaries/lib/asmtools.jar
ASMTOOLS_LICENSE
=
${
ASMTOOLS_SRC
}
/LICENSE
# JAVATEST
##########
JTHARNESS_BUILD_DIR
=
${
BUILD_DIR
}
/jtharness
mkdir
-p
${
JTHARNESS_BUILD_DIR
}
# Build jtharness
JTHARNESS_SRC_ZIP
=
${
JTHARNESS_BUILD_DIR
}
/source.zip
WGet
${
CODE_TOOLS_URL
}
/jtharness/archive/
${
JTHARNESS_VERSION
}
.zip
${
JTHARNESS_SRC_ZIP
}
${
UNZIP
}
${
UNZIP_OPTS
}
-d
${
JTHARNESS_BUILD_DIR
}
${
JTHARNESS_SRC_ZIP
}
if
[
"
${
JTHARNESS_VERSION
}
"
=
"tip"
]
;
then
JTHARNESS_VERSION
=
`
cd
${
JTHARNESS_BUILD_DIR
}
;
ls
-d
jtharness-
*
|
sed
-e
's/jtharness-//'
`
fi
JTHARNESS_SRC
=
${
JTHARNESS_BUILD_DIR
}
/jtharness-
${
JTHARNESS_VERSION
}
JTHARNESS_DIST
=
${
JTHARNESS_BUILD_DIR
}
/build
${
ANT
}
-DBUILD_DIR
=
${
JTHARNESS_DIST
}
-f
${
JTHARNESS_SRC
}
/build/build.xml
JAVATEST_JAR
=
${
JTHARNESS_DIST
}
/binaries/lib/javatest.jar
JTHARNESS_LICENSE
=
${
JTHARNESS_SRC
}
/legal/license.txt
JTHARNESS_COPYRIGHT
=
${
JTHARNESS_SRC
}
/legal/copyright.txt
# JCOV
######
JCOV_BUILD_DIR
=
${
BUILD_DIR
}
/jcov
mkdir
-p
${
JCOV_BUILD_DIR
}
# Get jcov dependencies
JCOV_DEPS_DIR
=
${
JCOV_BUILD_DIR
}
/deps
mkdir
-p
${
JCOV_DEPS_DIR
}
ASM_JAR
=
${
JCOV_DEPS_DIR
}
/asm-6.2.jar
ASM_JAR_CHECKSUM
=
'1b6c4ff09ce03f3052429139c2a68e295cae6604'
WGet
${
MAVEN_REPO_URL
}
/org/ow2/asm/asm/6.2/asm-6.2.jar
${
ASM_JAR
}
echo
"
${
ASM_JAR_CHECKSUM
}
${
ASM_JAR
}
"
|
${
SHASUM
}
--check
-
ASM_TREE_JAR
=
${
JCOV_DEPS_DIR
}
/asm-tree-6.2.jar
ASM_TREE_JAR_CHECKSUM
=
'61570e046111559f38d4e0e580c005f75988c0a6'
WGet
${
MAVEN_REPO_URL
}
/org/ow2/asm/asm-tree/6.2/asm-tree-6.2.jar
${
ASM_TREE_JAR
}
echo
"
${
ASM_TREE_JAR_CHECKSUM
}
${
ASM_TREE_JAR
}
"
|
${
SHASUM
}
--check
-
ASM_UTIL_JAR
=
${
JCOV_DEPS_DIR
}
/asm-utils-6.2.jar
ASM_UTIL_JAR_CHECKSUM
=
'a9690730f92cc79eeadc20e400ebb41eccce10b1'
WGet
${
MAVEN_REPO_URL
}
/org/ow2/asm/asm-util/6.2/asm-util-6.2.jar
${
ASM_UTIL_JAR
}
echo
"
${
ASM_UTIL_JAR_CHECKSUM
}
${
ASM_UTIL_JAR
}
"
|
${
SHASUM
}
--check
-
# Build jcov
JCOV_SRC_ZIP
=
${
JCOV_BUILD_DIR
}
/source.zip
WGet
${
CODE_TOOLS_URL
}
/jcov/archive/
${
JCOV_VERSION
}
.zip
${
JCOV_SRC_ZIP
}
${
UNZIP
}
${
UNZIP_OPTS
}
-d
${
JCOV_BUILD_DIR
}
${
JCOV_SRC_ZIP
}
if
[
"
${
JCOV_VERSION
}
"
=
"tip"
]
;
then
JCOV_VERSION
=
`
cd
${
JCOV_BUILD_DIR
}
;
ls
-d
jcov-
*
|
sed
-e
's/jcov-//'
`
fi
JCOV_SRC
=
${
JCOV_BUILD_DIR
}
/jcov-
${
JCOV_VERSION
}
JCOV_DIST
=
${
JCOV_BUILD_DIR
}
/build
(
cd
${
JCOV_SRC
}
/build
${
ANT
}
-Dresult
.dir
=
${
JCOV_DIST
}
\
-Dasm
.jar
=
${
ASM_JAR
}
\
-Dasm
.checksum
=
${
ASM_JAR_CHECKSUM
}
\
-Dasm
.tree.jar
=
${
ASM_TREE_JAR
}
\
-Dasm
.tree.checksum
=
${
ASM_TREE_JAR_CHECKSUM
}
\
-Dasm
.util.jar
=
${
ASM_UTIL_JAR
}
\
-Dasm
.util.checksum
=
${
ASM_UTIL_JAR_CHECKSUM
}
\
-Djavatestjar
=
${
JAVATEST_JAR
}
\
-Dverify
.strict
=
\
-f
${
JCOV_SRC
}
/build/build.xml
)
JCOV_JAR
=
${
JCOV_DIST
}
/jcov_3.0/jcov.jar
JCOV_NETWORK_SAVER_JAR
=
${
JCOV_DIST
}
/jcov_3.0/jcov_network_saver.jar
JCOV_LICENSE
=
${
JCOV_SRC
}
/LICENSE
# JTREG
#######
# Get jtreg dependencies
JTREG_DEPS_DIR
=
${
BUILD_DIR
}
/deps
mkdir
-p
${
JTREG_DEPS_DIR
}
## JUnit
JUNIT_DEPS_DIR
=
${
JTREG_DEPS_DIR
}
/junit
mkdir
-p
${
JUNIT_DEPS_DIR
}
JUNIT_JAR
=
${
JUNIT_DEPS_DIR
}
/junit-4.10.jar
WGet
${
MAVEN_REPO_URL
}
/junit/junit/4.10/junit-4.10.jar
${
JUNIT_JAR
}
echo
"e4f1766ce7404a08f45d859fb9c226fc9e41a861
${
JUNIT_JAR
}
"
|
${
SHASUM
}
--check
-
${
UNZIP
}
${
UNZIP_OPTS
}
${
JUNIT_JAR
}
LICENSE.txt
-d
${
JUNIT_DEPS_DIR
}
JUNIT_LICENSE
=
${
JUNIT_DEPS_DIR
}
/LICENSE.txt
## TestNG
TESTNG_DEPS_DIR
=
${
JTREG_DEPS_DIR
}
/testng
mkdir
-p
${
TESTNG_DEPS_DIR
}
TESTNG_JAR
=
${
TESTNG_DEPS_DIR
}
/testng-6.9.5.jar
WGet
${
MAVEN_REPO_URL
}
/org/testng/testng/6.9.5/testng-6.9.5.jar
${
TESTNG_JAR
}
echo
"5d12ea207fc47c3f341a3f8ecc88a3eac396a777
${
TESTNG_JAR
}
"
|
${
SHASUM
}
--check
-
TESTNG_LICENSE
=
${
TESTNG_DEPS_DIR
}
/LICENSE.txt
WGet https://raw.githubusercontent.com/cbeust/testng/testng-6.9.5/LICENSE.txt
${
TESTNG_LICENSE
}
JCOMMANDER_JAR
=
${
TESTNG_DEPS_DIR
}
/jcommander-1.72.jar
WGet
${
MAVEN_REPO_URL
}
/com/beust/jcommander/1.72/jcommander-1.72.jar
${
JCOMMANDER_JAR
}
echo
"6375e521c1e11d6563d4f25a07ce124ccf8cd171
${
JCOMMANDER_JAR
}
"
|
${
SHASUM
}
--check
-
## Set version and build numbers to the latest tagged version by default
if
[
-z
${
BUILD_NUMBER
:-}
]
;
then
BUILD_NUMBER
=
`
hg tags |
grep
jtreg |
head
-1
|
sed
's/jtreg\([0-9]\.[0-9]\)-\(b[0-9]*\).*/\2/'
`
fi
if
[
-z
${
BUILD_VERSION
:-}
]
;
then
BUILD_VERSION
=
`
hg tags |
grep
jtreg |
head
-1
|
sed
's/jtreg\([0-9]\.[0-9]\)-\(b[0-9]*\).*/\1/'
`
fi
# Build jtreg
cd
${
ROOT
}
/make
make
JUNIT_JAR
=
${
JUNIT_JAR
}
\
JUNIT_LICENSE
=
${
JUNIT_LICENSE
}
\
TESTNG_JAR
=
${
TESTNG_JAR
}
\
TESTNG_LICENSE
=
${
TESTNG_LICENSE
}
\
JCOMMANDER_JAR
=
${
JCOMMANDER_JAR
}
\
ANT
=
${
ANT
}
\
ANT_JAR
=
${
ANT_JAR
}
\
JCOV_JAR
=
${
JCOV_JAR
}
\
JCOV_LICENSE
=
${
JCOV_LICENSE
}
\
JCOV_NETWORK_SAVER_JAR
=
${
JCOV_NETWORK_SAVER_JAR
}
\
JAVATEST_JAR
=
${
JAVATEST_JAR
}
\
JTHARNESS_LICENSE
=
${
JTHARNESS_LICENSE
}
\
JTHARNESS_COPYRIGHT
=
${
JTHARNESS_COPYRIGHT
}
\
ASMTOOLS_JAR
=
${
ASMTOOLS_JAR
}
\
ASMTOOLS_LICENSE
=
${
ASMTOOLS_LICENSE
}
\
BUILD_VERSION
=
${
BUILD_VERSION
}
\
BUILD_MILESTONE
=
${
BUILD_MILESTONE
:
=dev
}
\
BUILD_NUMBER
=
${
BUILD_NUMBER
}
\
JDKHOME
=
$JAVA_HOME
\
${
MAKE_ARGS
:-}
make/jtreg.gmk
View file @
4aecb7d4
#
# Copyright (c) 1999, 201
7
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 201
8
, 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
...
...
@@ -29,7 +29,7 @@
### The following files are required to run othervm tests
REGTEST-OTHERVM-CLASSES = AppletWrapper GetSystemProperty MainWrapper
R
Status StringArray
REGTEST-OTHERVM-CLASSES = AppletWrapper GetSystemProperty MainWrapper
A
Status StringArray
JAVAFILES.com.sun.javatest.regtest-othervm = \
$(REGTEST-OTHERVM-CLASSES:%=$(JAVADIR)/com/sun/javatest/regtest/agent/%.java)
...
...
@@ -87,15 +87,11 @@ RESOURCES.com.sun.javatest.regtest = \
$(CLASSDIR)/com/sun/javatest/regtest/i18n.properties \
$(CLASSDIR)/com/sun/javatest/regtest/config/i18n.properties \
$(CLASSDIR)/com/sun/javatest/regtest/report/i18n.properties \
$(CLASSDIR)/com/sun/javatest/regtest/tool/i18n.properties
$(CLASSDIR)/com/sun/javatest/regtest/tool/i18n.properties \
$(CLASSDIR)/com/sun/javatest/regtest/tool/jtlogo.png
TARGETS.com.sun.javatest.regtest += $(RESOURCES.com.sun.javatest.regtest)
RESOURCES.com.sun.javatest.regtest.agent = \
$(CLASSDIR)/com/sun/javatest/regtest/agent/i18n.properties
TARGETS.com.sun.javatest.regtest += $(RESOURCES.com.sun.javatest.regtest.agent)
#----------------------------------------------------------------------
#
# Misc. doc files
...
...
@@ -138,7 +134,7 @@ $(JTREG_LICENSE): $(TOPDIR)/LICENSE
$(BUILDDIR)/jtreg-usage.txt: \
$(BUILDDIR)/classes.com.sun.javatest.regtest.ok \
$(BUILDDIR)/classes/com/sun/javatest/regtest/tool/i18n.properties
$(J
2SE
JAVA) -cp "$(CLASSDIR)$(PS)$(JAVATEST_JAR)" \
$(J
DK
JAVA) -cp "$(CLASSDIR)$(PS)$(JAVATEST_JAR)" \
-Dprogram=jtreg com.sun.javatest.regtest.Main -help all > $@
TARGETS.ZIP.jtreg += $(JTREG_DOCS)
...
...
@@ -159,7 +155,7 @@ endif
$(JTREG_IMAGEDIR)/doc/api/index.html: \
$(JAVAFILES.com.sun.javatest.regtest-tools) \
$(JAVATEST_SRCFILES)
$(J
2SE
HOME)/bin/javadoc -d $(@D) \
$(J
DK
HOME)/bin/javadoc -d $(@D) \
-encoding iso-8859-1 \
-sourcepath "$(JAVADIR)$(PS)$(JAVATEST_SRCDIR)" \
-classpath "$(ANT_JAR)$(PS)$(JAVATEST_JAR)$(PS)$(JUNIT_JAR)$(PS)$(TESTNG_JAR)" \
...
...
@@ -169,7 +165,7 @@ $(JTREG_IMAGEDIR)/doc/api/index.html: \
$(JTREG_IMAGEDIR)/doc/devapi/index.html: \
$(JAVAFILES.com.sun.javatest.regtest-tools) \
$(JAVATEST_SRCFILES)
$(J
2SE
HOME)/bin/javadoc -d $(@D) \
$(J
DK
HOME)/bin/javadoc -d $(@D) \
-encoding iso-8859-1 \
-sourcepath "$(JAVADIR)$(PS)$(JAVATEST_SRCDIR)" \
-classpath "$(ANT_JAR)$(PS)$(JAVATEST_JAR)$(PS)$(JUNIT_JAR)$(PS)$(TESTNG_JAR)" \
...
...
@@ -217,40 +213,48 @@ TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/jtreg.jar
# import JavaTest or JT Harness
TARGETS.com.sun.javatest.regtest += $(RESOURCES.com.sun.javatest.regtest)
ifdef JTHARNESS_HOME
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/jtharness/copyright.txt
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/jtharness/license.txt
endif
$(JTREG_IMAGEDIR)/legal/jtharness/copyright.txt \
$(JTREG_IMAGEDIR)/legal/jtharness/license.txt: \
$(JTREG_IMAGEDIR)/legal/jtharness/%: $(JTHARNESS_HOME)/legal/%
$(JTREG_IMAGEDIR)/lib/javatest.jar: $(call PosixPath,$(JAVATEST_JAR))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(CP) $< $@
$(JTREG_IMAGEDIR)/lib/javatest.jar: $(call PosixPath,$(JAVATEST_JAR))
TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/javatest.jar
$(JTREG_IMAGEDIR)/legal/jtharness/license.txt: $(call PosixPath,$(JTHARNESS_LICENSE))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(CP) $
(JAVATEST_JAR)
$@
$(CP) $
<
$@
TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/javatest.jar
ifdef JTHARNESS_LICENSE
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/jtharness/license.txt
endif
$(JTREG_IMAGEDIR)/legal/jtharness/copyright.txt: $(call PosixPath,$(JTHARNESS_COPYRIGHT))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef JTHARNESS_COPYRIGHT
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/jtharness/copyright.txt
endif
#----------------------------------------------------------------------
#
# import JavaHelp (required for JavaTest/JT Harness 4.6), if available;
# remove any (probably out-of-date) signatures
ifdef JAVAHELP_JAR
$(IMAGES_DIR)/%/jh.jar: $(call PosixPath,$(JAVAHELP_JAR))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(ECHO) JAVAHELP_HOME $(JAVAHELP_HOME)
$(ECHO) JAVAHELP_JAR $(JAVAHELP_JAR)
$(CP) $(JAVAHELP_JAR) $@
$(ZIP) -d $@ 'META-INF/*.SF' 'META-INF/*.RSA' 'META-INF/*.DSA'
-
$(ZIP) -d $@ 'META-INF/*.SF' 'META-INF/*.RSA' 'META-INF/*.DSA'
TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/jh.jar
ifdef JAVAHELP_JAR
JTREG_IMAGE_JAVAHELP_JAR = $(JTREG_IMAGEDIR)/lib/jh.jar
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/lib/jh.jar
endif
#----------------------------------------------------------------------
...
...
@@ -260,21 +264,22 @@ endif
$(JTREG_IMAGEDIR)/lib/junit.jar: $(call PosixPath,$(JUNIT_JAR))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(CP) $
(JUNIT_JAR)
$@
$(CP) $
<
$@
TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/junit.jar
#----------------------------------------------------------------------
#
# import TestNG
ifdef TESTNG_HOME
ifdef JUNIT_LICENSE
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/junit/LICENSE
endif
$(JTREG_IMAGEDIR)/legal/testng/LICENSE.txt: $(call PosixPath,$(TESTNG_HOME)/LICENSE.txt)
$(JTREG_IMAGEDIR)/legal/junit/LICENSE: $(call PosixPath,$(JUNIT_LICENSE))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(C
AT
) $
(TESTNG_HOME)/LICENSE.txt >>
$@
$(C
P
) $
<
$@
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/testng/LICENSE.txt
#----------------------------------------------------------------------
#
# import TestNG
$(JTREG_IMAGEDIR)/lib/testng.jar: $(call PosixPath,$(TESTNG_JAR))
$(RM) $@
...
...
@@ -288,60 +293,76 @@ $(JTREG_IMAGEDIR)/lib/testng.jar: $(call PosixPath,$(TESTNG_JAR))
TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/testng.jar
ifdef JCOMMANDER_JAR
$(JTREG_IMAGEDIR)/lib/jcommander.jar: $(call PosixPath,$(JCOMMANDER_JAR))
$(RM) $@
$(MKDIR) -p $(@D)
$(CP) $(JCOMMANDER_JAR) $@
ifdef JCOMMANDER_JAR
TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/jcommander.jar
endif
$(JTREG_IMAGEDIR)/legal/testng/LICENSE: $(call PosixPath,$(TESTNG_LICENSE))
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef TESTNG_LICENSE
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/testng/LICENSE
endif
#----------------------------------------------------------------------
#
# import JCov
ifdef JCOV_JAR
$(JTREG_IMAGEDIR)/lib/jcov.jar: $(call PosixPath,$(JCOV_JAR))
$(RM) $@
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef JCOV_JAR
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/lib/jcov.jar
endif # JCOV_JAR
ifdef JCOV_NETWORK_SAVER_JAR
endif
$(JTREG_IMAGEDIR)/lib/jcov_network_saver.jar: $(call PosixPath,$(JCOV_NETWORK_SAVER_JAR))
$(RM) $@
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef JCOV_NETWORK_SAVER_JAR
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/lib/jcov_network_saver.jar
endif
endif #JCOV_NETWORK_SAVER_JAR
$(JTREG_IMAGEDIR)/legal/jcov/LICENSE: $(call PosixPath,$(JCOV_LICENSE))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef JCOV_LICENSE
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/jcov/LICENSE
endif
#----------------------------------------------------------------------
#
# import AsmTools
ifdef ASMTOOLS_JAR
$(JTREG_IMAGEDIR)/lib/asmtools.jar: $(call PosixPath,$(ASMTOOLS_JAR))
$(RM) $@
$(MKDIR) -p $(@D)
$(CP) $< $@
TARGETS.ZIP.jtreg += \
$(JTREG_IMAGEDIR)/lib/asmtools.jar \
ifdef ASMTOOLS_JAR
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/lib/asmtools.jar
$(JTREG_IMAGEDIR)/lib/jtreg.jar: $(JTREG_IMAGEDIR)/lib/asmtools.jar
endif
endif #ASMTOOLS_JAR
$(JTREG_IMAGEDIR)/legal/asmtools/LICENSE: $(call PosixPath,$(ASMTOOLS_LICENSE))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef ASMTOOLS_LICENSE
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/asmtools/LICENSE
endif
#----------------------------------------------------------------------
#
...
...
plugins/idea/.idea/misc.xml
View file @
4aecb7d4
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"EntryPointsManager"
>
<entry_points
version=
"2.0"
/>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_8"
default=
"false"
assert-keyword=
"true"
jdk-15=
"true"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_8"
default=
"false"
project-jdk-name=
"IDEA JDK"
project-jdk-type=
"IDEA JDK"
>
<output
url=
"file://$PROJECT_DIR$/build"
/>
</component>
</project>
\ No newline at end of file
plugins/idea/resources/META-INF/plugin.xml
View file @
4aecb7d4
<!--
~ Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
~ Copyright (c) 2016,
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
...
...
@@ -23,20 +23,20 @@
~ questions.
-->
<idea-plugin
version=
"2"
>
<idea-plugin>
<id>
jtreg
</id>
<name>
jtreg Test Support
</name>
<version>
1.
5
</version>
<version>
1.
6
</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
NPE in testng import check
Fixed
misc issues with plugin build against newer versions of IntelliJ IDE
]]>
</change-notes>
<idea-version
since-build=
"1
45
.0"
/>
<idea-version
since-build=
"1
62
.0"
/>
<depends>
AntSupport
</depends>
<depends>
TestNG-J
</depends>
...
...
plugins/idea/src/com/oracle/plugin/jtreg/components/JTRegFileManagerListener.java
View file @
4aecb7d4
/*
* Copyright (c) 201
6
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 201
7
, 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
...
...
@@ -29,11 +29,11 @@ import com.intellij.openapi.application.ApplicationManager;
import
com.intellij.openapi.application.ModalityState
;
import
com.intellij.openapi.diagnostic.Logger
;
import
com.intellij.openapi.editor.Document
;
import
com.intellij.openapi.editor.event.DocumentAdapter
;
import
com.intellij.openapi.editor.event.DocumentEvent
;
import
com.intellij.openapi.editor.event.DocumentListener
;
import
com.intellij.openapi.fileEditor.FileDocumentManager
;
import
com.intellij.openapi.fileEditor.FileEditorManager
;
import
com.intellij.openapi.fileEditor.FileEditorManager
Adapt
er
;
import
com.intellij.openapi.fileEditor.FileEditorManager
Listen
er
;
import
com.intellij.openapi.module.Module
;
import
com.intellij.openapi.module.ModuleUtilCore
;
import
com.intellij.openapi.project.DumbService
;
...
...
@@ -53,7 +53,7 @@ import java.util.stream.Stream;
* model is updated, so that the test source is displayed without errors. Changes in the headers will be picked up
* and reflected in the root model.
*/
public
class
JTRegFileManagerListener
ext
en
d
s
FileEditorManager
Adapt
er
{
public
class
JTRegFileManagerListener
implem
en
t
s
FileEditorManager
Listen
er
{
public
static
final
Logger
LOG
=
Logger
.
getInstance
(
JTRegFileManagerListener
.
class
);
...
...
@@ -66,7 +66,7 @@ public class JTRegFileManagerListener extends FileEditorManagerAdapter {
VirtualFile
contentRoot
;
List
<
VirtualFile
>
roots
=
new
ArrayList
<>();
Document
document
;
Document
Adapt
er
listener
=
new
Document
Adapt
er
()
{
Document
Listen
er
listener
=
new
Document
Listen
er
()
{
@Override
public
void
documentChanged
(
DocumentEvent
e
)
{
alarm
.
cancelAllRequests
();
...
...
plugins/idea/src/com/oracle/plugin/jtreg/configuration/JTRegConfiguration.java
View file @
4aecb7d4
/*
* Copyright (c) 201
6
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 201
7
, 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
...
...
@@ -29,6 +29,7 @@ import com.intellij.diagnostic.logging.LogConfigurationPanel;
import
com.intellij.execution.*
;
import
com.intellij.execution.configurations.*
;
import
com.intellij.execution.runners.ExecutionEnvironment
;
import
com.intellij.execution.testframework.TestSearchScope
;
import
com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties
;
import
com.intellij.execution.ui.DefaultJreSelector
;
import
com.intellij.openapi.module.Module
;
...
...
@@ -44,7 +45,9 @@ import com.intellij.openapi.util.InvalidDataException;
import
com.intellij.openapi.util.WriteExternalException
;
import
com.intellij.openapi.vfs.LocalFileSystem
;
import
com.intellij.openapi.vfs.VirtualFile
;
import
com.intellij.psi.PsiClass
;
import
com.intellij.psi.PsiElement
;
import
com.intellij.psi.PsiMethod
;
import
com.intellij.refactoring.listeners.RefactoringElementListener
;
import
com.intellij.util.xmlb.XmlSerializer
;
import
org.jdom.Element
;
...
...
@@ -56,6 +59,7 @@ import com.oracle.plugin.jtreg.service.JTRegService;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -273,4 +277,24 @@ public class JTRegConfiguration extends JavaTestConfigurationBase {
@Override
public
void
setVMParameters
(
String
s
)
{
}
public
void
bePatternConfiguration
(
List
<
PsiClass
>
list
,
PsiMethod
psiMethod
)
{
//do nothing
}
public
void
beMethodConfiguration
(
Location
<
PsiMethod
>
location
)
{
//do nothing
}
public
void
beClassConfiguration
(
PsiClass
psiClass
)
{
//do nothing
}
public
boolean
isConfiguredByElement
(
PsiElement
psiElement
)
{
return
false
;
}
public
TestSearchScope
getTestSearchScope
()
{
return
null
;
}
}
plugins/idea/src/com/oracle/plugin/jtreg/service/ui/JTRegServiceConfigurable.form
View file @
4aecb7d4
...
...
@@ -66,7 +66,7 @@
</grid>
</constraints>
<properties>
<text
value=
"
Path
"
/>
<text
value=
"
JTReg Home
"
/>
</properties>
</component>
<grid
id=
"8bdf0"
binding=
"myListPane"
custom-create=
"true"
layout-manager=
"GridLayoutManager"
row-count=
"1"
column-count=
"1"
same-size-horizontally=
"false"
same-size-vertically=
"false"
hgap=
"-1"
vgap=
"-1"
>
...
...
plugins/idea/src/com/oracle/plugin/jtreg/service/ui/JTRegServiceConfigurable.java
View file @
4aecb7d4
/*
* Copyright (c) 201
6
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 201
7
, 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
...
...
@@ -157,7 +157,7 @@ public class JTRegServiceConfigurable implements SearchableConfigurable {
workDir
=
new
TextFieldWithBrowseButton
();
workDir
.
addBrowseFolderListener
(
"Directory with Strategies"
,
null
,
project
,
FileChooserDescriptorFactory
.
createSingleFolderDescriptor
());
myModel
=
new
CollectionListModel
<>();
JBList
myList
=
new
JBList
(
myModel
);
JBList
<
AntBuildTarget
>
myList
=
new
JBList
<>
(
myModel
);
myList
.
getEmptyText
().
setText
(
ExecutionBundle
.
message
(
"before.launch.panel.empty"
));
myList
.
setSelectionMode
(
ListSelectionModel
.
SINGLE_SELECTION
);
myList
.
setCellRenderer
(
new
MyListCellRenderer
());
...
...
src/share/classes/com/sun/javatest/diff/HTMLReporter.java
View file @
4aecb7d4
...
...
@@ -170,8 +170,8 @@ public class HTMLReporter extends Reporter {
out
.
endTag
(
TD
);
out
.
startTag
(
TD
);
out
.
write
(
table
.
getColumnName
(
i
));
writeIndexTableInfoValues
(
table
.
getColumnName
(
i
));
out
.
endTag
(
TD
);
writeIndexTableInfoValues
(
table
.
getColumnName
(
i
));
// out.startTag(TD);
// out.write("??");
// out.endTag(TD);
...
...
@@ -321,8 +321,7 @@ public class HTMLReporter extends Reporter {
private
MultiMap
<
String
,
TestResult
>
table
;
private
int
size
;
private
static
final
String
DOCTYPE
=
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd\">"
;
private
static
final
String
DOCTYPE
=
"<!DOCTYPE HTML>"
;
// HTML tags
private
static
final
String
THEAD
=
"thead"
;
...
...
src/share/classes/com/sun/javatest/diff/SuperDiff.java
View file @
4aecb7d4
...
...
@@ -172,15 +172,17 @@ class SuperDiff extends Diff {
out
.
startTag
(
TD
);
if
(
info
!=
null
)
out
.
write
(
monthDayFormat
.
format
(
info
.
date
));
out
.
endTag
(
T
H
);
out
.
endTag
(
T
D
);
}
void
writeMainIndex
(
String
title
)
throws
IOException
{
startReport
(
title
);
if
(
baseTitle
!=
null
)
{
out
.
startTag
(
H1
);
out
.
write
(
baseTitle
);
out
.
endTag
(
H1
);
}
writeMainIndexList
(
i18n
.
getString
(
"super.platforms"
),
platformIndex
);
writeMainIndexList
(
i18n
.
getString
(
"super.history"
),
historyIndex
);
...
...
src/share/classes/com/sun/javatest/regtest/
agent/
RStatus.java
→
src/share/classes/com/sun/javatest/regtest/RStatus.java
View file @
4aecb7d4
/*
* Copyright (c) 2013, 201
5
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 201
7
, 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 @@
* questions.
*/
package
com.sun.javatest.regtest
.agent
;
package
com.sun.javatest.regtest
;
import
com.sun.javatest.Status
;
...
...
src/share/classes/com/sun/javatest/regtest/agent/AStatus.java
0 → 100644
View file @
4aecb7d4
/*
* Copyright (c) 1996, 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
com.sun.javatest.regtest.agent
;
/**
* A class to embody the result of a test: a status-code and a related message.
*
* This is a reduced copy of com.sun.javatest.Status, sufficient to the needs
* of returning test results from a test VM. In particular, it implements the
* same protocol to transfer results across process boundaries, meaning the
* encoding of the status type and reason.
*/
public
class
AStatus
{
/**
* Create a Status to indicate the successful outcome of a test.
* @param reason A short string describing why the test passed.
* @return a Status to indicate the successful outcome of a test.
*/
public
static
AStatus
passed
(
String
reason
)
{
return
new
AStatus
(
PASSED
,
reason
);
}
/**
* Create a Status to indicate the unsuccessful outcome of a test:
* i.e. the test completed, but the test determined that what was being tested
* did not pass the test.
* @param reason A short string describing why the test failed.
* @return a Status to indicate the unsuccessful outcome of a test.
*/
public
static
AStatus
failed
(
String
reason
)
{
return
new
AStatus
(
FAILED
,
reason
);
}
/**
* Create a Status to indicate that an error occurred while trying to run a test:
* i.e. the test did not complete for some reason, and so it could not determine
* whether what was being tested passed or failed.
* @param reason A short string describing the error that occurred.
* @return a Status to indicate the error outcome of a test.
*/
public
static
AStatus
error
(
String
reason
)
{
return
new
AStatus
(
ERROR
,
reason
);
}
/**
* Check if the type code of the status is PASSED.
* @return true if the type code is PASSED.
* @see #passed
* @see #getType
* @see #PASSED
*/
public
boolean
isPassed
()
{
return
(
type
==
PASSED
);
}
/**
* Check if the type code of the status is FAILED.
* @return true if the type code is FAILED.
* @see #failed
* @see #getType
* @see #FAILED
*/
public
boolean
isFailed
()
{
return
(
type
==
FAILED
);
}
/**
* Check if the type code of the status is ERROR.
* @return true if the type code is ERROR.
* @see #error
* @see #getType
* @see #ERROR
*/
public
boolean
isError
()
{
return
(
type
==
ERROR
);
}
/**
* Check if the type code of the status is NOT_RUN.
* @return true if the type code is ERROR.
* @see #getType
* @see #NOT_RUN
*/
public
boolean
isNotRun
()
{
return
(
type
==
NOT_RUN
);
}
/**
* A return code indicating that the test was executed and was successful.
* @see #passed
* @see #getType
*/
public
static
final
int
PASSED
=
0
;
/**
* A return code indicating that the test was executed but the test
* reported that it failed.
* @see #failed
* @see #getType
*/
public
static
final
int
FAILED
=
1
;
/**
* A return code indicating that the test was not run because some error
* occurred before the test could even be attempted. This is generally
* a more serious error than FAILED.
* @see #getType
*/
public
static
final
int
ERROR
=
2
;
/**
* A return code indicating that the test has not yet been run in this context.
* (More specifically, no status file has been recorded for this test in the
* current work directory.) This is for the internal use of the harness only.
* @see #getType
*/
public
static
final
int
NOT_RUN
=
3
;
/**
* Number of states which are predefined as "constants".
*/
public
static
final
int
NUM_STATES
=
4
;
/**
* Get the type code indicating the type of this Status object.
* @return the type code indicating the type of this Status object.
* @see #PASSED
* @see #FAILED
* @see #ERROR
*/
public
int
getType
()
{
return
type
;
}
/**
* Get the message given when the status was created.
* @return the string given when this Status object was created.
*/
public
String
getReason
()
{
return
reason
;
}
/**
* Convert a Status to a string.
* @see #parse
*/
public
String
toString
()
{
if
(
reason
==
null
||
reason
.
length
()
==
0
)
return
texts
[
type
];
else
return
texts
[
type
]
+
" "
+
reason
;
}
/**
* Convenience exit() function for the main() of tests to exit in such a
* way that the status passes up across process boundaries without losing
* information (ie exit codes don't give the associated text of the status
* and return codes when exceptions are thrown could cause unintended
* results). <p>
*
* An identifying marker is written to the error stream, which the script
* running the test watches for as the last output before returning,
* followed by the type and reason
*
* The method does not return. It calls System.exit with a value
* dependent on the type.
*/
public
void
exit
()
{
if
(
System
.
err
!=
null
)
{
System
.
err
.
print
(
EXIT_PREFIX
);
System
.
err
.
print
(
texts
[
type
]);
System
.
err
.
println
(
encode
(
reason
));
System
.
err
.
flush
();
}
System
.
exit
(
exitCodes
[
type
]);
}
/**
* Create a Status object. See {@link #passed}, {@link #failed}, {@link #error}
* etc. for more convenient factory methods to create Status objects.
* @param type The type code for the Status object.
* @param reason A short string to store in the status. Unprintable
* characters (i.e. outside the range 040C to 177C) in the string are
* replaced by a space. All whitespace runs are reduced to a single
* whitespace.
* @throws IllegalArgumentException if the specified type is invalid.
*/
public
AStatus
(
int
type
,
String
reason
)
throws
IllegalArgumentException
{
if
(
type
<
0
||
type
>=
NUM_STATES
)
throw
new
IllegalArgumentException
(
String
.
valueOf
(
type
));
this
.
type
=
type
;
this
.
reason
=
normalize
(
reason
);
}
//-----internal routines----------------------------------------------------
// equivalent to msg.trim().replaceAll("\\s+", " ");
private
static
String
normalize
(
String
msg
)
{
boolean
ok
=
true
;
boolean
prevIsWhite
=
false
;
for
(
int
i
=
0
;
ok
&&
i
<
msg
.
length
();
i
++)
{
char
ch
=
msg
.
charAt
(
i
);
if
(
Character
.
isWhitespace
(
ch
))
{
if
(
prevIsWhite
||
ch
!=
' '
||
i
==
0
)
{
ok
=
false
;
break
;
}
prevIsWhite
=
true
;
}
else
{
prevIsWhite
=
false
;
}
}
if
(
prevIsWhite
)
{
ok
=
false
;
}
if
(
ok
)
{
return
msg
;
}
StringBuilder
sb
=
new
StringBuilder
();
boolean
needWhite
=
false
;
for
(
int
i
=
0
;
i
<
msg
.
length
();
i
++)
{
char
ch
=
msg
.
charAt
(
i
);
if
(
Character
.
isWhitespace
(
ch
))
{
if
(
sb
.
length
()
>
0
)
{
needWhite
=
true
;
}
}
else
{
if
(
needWhite
)
{
sb
.
append
(
' '
);
}
sb
.
append
(
ch
);
needWhite
=
false
;
}
}
return
sb
.
toString
();
}
private
static
final
boolean
isPrintable
(
char
c
)
{
return
(
32
<=
c
&&
c
<
127
);
}
//----------Data members----------------------------------------------------
private
final
int
type
;
private
final
String
reason
;
/**
* A string used to prefix the status when it is written to System.err
* by {@link #exit}.
*/
public
static
final
String
EXIT_PREFIX
=
"STATUS:"
;
private
static
final
String
[]
texts
=
{
// correspond to PASSED, FAILED, ERROR, NOT_RUN
"Passed."
,
"Failed."
,
"Error."
,
"Not run."
};
/**
* Exit codes used by Status.exit corresponding to
* PASSED, FAILED, ERROR, NOT_RUN.
* The only values that should normally be returned from a test
* are the first three; the other value is provided for completeness.
* <font size=-1> Note: The assignment is historical and cannot easily be changed. </font>
*/
public
static
final
int
[]
exitCodes
=
{
95
,
97
,
98
,
99
};
/**
* Encodes strings containing non-ascii characters, where all characters
* are replaced with with their Unicode code. Encoded string will have
* the certain prefix and suffix to be distinguished from non-encode one.
* Strings of ASCII chars only are encoded into themselves.<br>
* Example:
* <pre>
* System.out.println(Status.encode("X \u01AB")); //<Encoded>58 20 1AB </Encoded>
* System.out.println(Status.encode("Abc1")); // Abc1
* </pre>
* @param str - string to encode
* @return Encoded string or the same string if none non-ascii chars were found
*
* @see #decode(java.lang.String)
*/
public
static
String
encode
(
String
str
)
{
if
(
str
==
null
)
{
return
null
;
}
boolean
isAscii
=
true
;
for
(
int
i
=
0
;
i
<
str
.
length
();
i
++)
{
if
(!
isPrintable
(
str
.
charAt
(
i
)))
{
isAscii
=
false
;
break
;
}
}
if
(
isAscii
)
{
return
str
;
// no need to decode;
}
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
ENC_PREFFIX
);
for
(
int
i
=
0
;
i
<
str
.
length
();
i
++)
{
sb
.
append
(
encodeChar
(
str
.
charAt
(
i
)));
sb
.
append
(
ENC_SEPARATOR
);
}
sb
.
append
(
ENC_SUFFFIX
);
return
sb
.
toString
();
}
/**
* Decodes string encoded by encode(String) method.
* @param str - string to decode
* @return Decoded string or the same string if encoded prefix/suffix
* were found
*
* @see #encode(java.lang.String)
*/
public
static
String
decode
(
String
str
)
{
if
(
str
==
null
)
{
return
null
;
}
int
ind
=
str
.
indexOf
(
ENC_PREFFIX
);
if
(
ind
<
0
||
!
str
.
endsWith
(
ENC_SUFFFIX
))
{
return
str
;
// not encoded
}
// identify encoded part
String
encoded
=
str
.
substring
(
ind
+
ENC_PREFFIX
.
length
(),
str
.
length
()
-
ENC_SUFFFIX
.
length
());
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
str
.
substring
(
0
,
ind
));
// emulate StringTokenizer(encoded, ENC_SEPARATOR) to find tokens
int
begin
=
0
;
int
end
=
encoded
.
indexOf
(
ENC_SEPARATOR
);
while
(
end
>=
0
)
{
sb
.
append
(
decodeChar
(
encoded
.
substring
(
begin
,
end
)));
begin
=
end
+
ENC_SEPARATOR
.
length
();
end
=
encoded
.
indexOf
(
ENC_SEPARATOR
,
begin
);
}
sb
.
append
(
encoded
.
substring
(
begin
));
return
sb
.
toString
();
}
private
static
String
encodeChar
(
char
c
)
{
return
Integer
.
toString
((
int
)
c
,
16
);
}
private
static
char
decodeChar
(
String
s
)
{
return
(
char
)
Integer
.
parseInt
(
s
,
16
);
}
/**
* Prefix signaling that string is encoded
*/
private
static
final
String
ENC_PREFFIX
=
"<EncodeD>"
;
/**
* Suffix signaling that string is encoded
*/
private
static
final
String
ENC_SUFFFIX
=
"</EncodeD>"
;
/**
* Separator of encoded chars
*/
private
static
final
String
ENC_SEPARATOR
=
" "
;
}
src/share/classes/com/sun/javatest/regtest/agent/ActionHelper.java
View file @
4aecb7d4
/*
* Copyright (c) 1998, 201
5
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 201
8
, 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,10 +26,11 @@
package
com.sun.javatest.regtest.agent
;
import
java.io.
ByteArray
OutputStream
;
import
java.io.OutputStream
;
import
java.io.PrintStream
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.io.Writer
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.security.Provider
;
...
...
@@ -39,11 +40,9 @@ import java.util.HashMap;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.Properties
;
import
com.sun.javatest.Status
;
import
com.sun.javatest.TestResult
;
import
static
com
.
sun
.
javatest
.
regtest
.
agent
.
R
Status
.
error
;
import
static
com
.
sun
.
javatest
.
regtest
.
agent
.
R
Status
.
passed
;
import
static
com
.
sun
.
javatest
.
regtest
.
agent
.
A
Status
.
error
;
import
static
com
.
sun
.
javatest
.
regtest
.
agent
.
A
Status
.
passed
;
public
class
ActionHelper
{
...
...
@@ -80,8 +79,8 @@ public class ActionHelper {
securityProviders
=
Security
.
getProviders
();
}
Status
restore
(
String
testName
,
Status
status
)
{
Status
cleanupStatus
=
null
;
A
Status
restore
(
String
testName
,
A
Status
status
)
{
A
Status
cleanupStatus
=
null
;
// Reset security manager, if necessary
// Do this first, to ensure we reset permissions
...
...
@@ -107,7 +106,7 @@ public class ActionHelper {
stdErr
.
println
(
"*** "
+
e
.
getMessage
());
stdErr
.
println
(
"***"
);
stdErr
.
println
();
cleanupStatus
=
error
(
SAME
VM_CANT_RESET_SECMGR
+
": "
+
e
);
cleanupStatus
=
error
(
AGENT
VM_CANT_RESET_SECMGR
+
": "
+
e
);
}
try
{
...
...
@@ -127,7 +126,7 @@ public class ActionHelper {
});
}
}
catch
(
SecurityException
e
)
{
cleanupStatus
=
error
(
SAME
VM_CANT_RESET_SECPROVS
+
": "
+
e
);
cleanupStatus
=
error
(
AGENT
VM_CANT_RESET_SECPROVS
+
": "
+
e
);
}
// Reset system properties, if necessary
...
...
@@ -151,12 +150,12 @@ public class ActionHelper {
}
}
catch
(
SecurityException
e
)
{
if
(
cleanupStatus
==
null
)
{
cleanupStatus
=
error
(
SAME
VM_CANT_RESET_PROPS
+
": "
+
e
);
cleanupStatus
=
error
(
AGENT
VM_CANT_RESET_PROPS
+
": "
+
e
);
}
}
// Reset output streams
Status
stat
=
redirectOutput
(
stdOut
,
stdErr
);
A
Status
stat
=
redirectOutput
(
stdOut
,
stdErr
);
if
(
cleanupStatus
==
null
&&
!
stat
.
isPassed
())
{
cleanupStatus
=
stat
;
}
...
...
@@ -218,7 +217,7 @@ public class ActionHelper {
* the output from an action of a test.
*/
public
interface
OutputHandler
{
public
enum
OutputKind
{
enum
OutputKind
{
LOG
(
""
),
STDOUT
(
"System.out"
),
STDERR
(
"System.err"
),
...
...
@@ -226,46 +225,14 @@ public class ActionHelper {
DIRECT_LOG
(
"direct.log"
);
OutputKind
(
String
name
)
{
this
.
name
=
name
;
}
public
final
String
name
;
};
PrintWriter
createOutput
(
OutputKind
kind
);
void
createOutput
(
OutputKind
kind
,
String
output
);
}
protected
static
OutputHandler
getOutputHandler
(
final
TestResult
.
Section
section
)
{
return
new
OutputHandler
()
{
@Override
public
PrintWriter
createOutput
(
OutputKind
kind
)
{
if
(
kind
==
OutputKind
.
LOG
)
return
section
.
getMessageWriter
();
else
return
section
.
createOutput
(
kind
.
name
);
PrintStream
getPrintStream
(
OutputKind
kind
,
boolean
autoFlush
);
PrintWriter
getPrintWriter
(
OutputKind
kind
,
boolean
autoFlush
);
}
@Override
public
void
createOutput
(
OutputKind
kind
,
String
output
)
{
PrintWriter
pw
=
createOutput
(
kind
);
try
{
pw
.
write
(
output
);
}
finally
{
pw
.
close
();
}
}
};
}
//----------in memory streams-----------------------------------------------
public
static
class
PrintByteArrayOutputStream
extends
PrintStream
{
public
PrintByteArrayOutputStream
()
{
super
(
new
ByteArrayOutputStream
());
s
=
(
ByteArrayOutputStream
)
out
;
}
public
String
getOutput
()
{
return
s
.
toString
();
}
private
final
ByteArrayOutputStream
s
;
}
public
static
class
PrintStringWriter
extends
PrintWriter
{
public
PrintStringWriter
()
{
...
...
@@ -283,7 +250,7 @@ public class ActionHelper {
//----------redirect streams------------------------------------------------
// if we wanted to allow more concurrency, we could try and acquire a lock here
protected
static
Status
redirectOutput
(
PrintStream
out
,
PrintStream
err
)
{
protected
static
A
Status
redirectOutput
(
PrintStream
out
,
PrintStream
err
)
{
synchronized
(
System
.
class
)
{
SecurityManager
sc
=
System
.
getSecurityManager
();
if
(
sc
instanceof
RegressionSecurityManager
)
{
...
...
@@ -304,7 +271,7 @@ public class ActionHelper {
UNEXPECT_SYS_EXIT
=
"Unexpected exit from test"
,
SAME
VM_CANT_RESET_SECMGR
=
"Cannot reset security manager"
,
SAME
VM_CANT_RESET_SECPROVS
=
"Cannot reset security providers"
,
SAME
VM_CANT_RESET_PROPS
=
"Cannot reset system properties"
;
AGENT
VM_CANT_RESET_SECMGR
=
"Cannot reset security manager"
,
AGENT
VM_CANT_RESET_SECPROVS
=
"Cannot reset security providers"
,
AGENT
VM_CANT_RESET_PROPS
=
"Cannot reset system properties"
;
}
Prev
1
2
3
4
5
…
10
Next