Import Upstream version 6.2+1

This commit is contained in:
luoyaoming 2024-05-07 16:06:14 +08:00
parent fec4754979
commit 9d1b6ae4b3
45 changed files with 210 additions and 8483 deletions

View File

@ -2,38 +2,41 @@ name: Build and Test JTReg
on: on:
push: push:
branches-ignore: branches:
- master - master
pull_request:
branches:
- '*'
jobs: jobs:
linux-x64: linux-x64:
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
steps: steps:
- name: Checkout the source - name: 'Check out repository'
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
path: jtreg fetch-depth: 1
fetch-depth: 0
- name: build - name: 'Build JTReg'
working-directory: jtreg shell: bash
shell: bash run: |
run: bash make/build.sh --jdk ${JAVA_HOME_8_X64} java --version
bash make/build.sh --jdk ${JAVA_HOME_11_X64}
- name: upload artifact - name: 'Run initial tests (goal: quick-test)'
uses: actions/upload-artifact@v2 shell: bash
with: env:
name: jtreg MAKE_ARGS: quick-test
path: jtreg/build/images/jtreg HEADLESS: 1
run: |
- name: test bash make/build.sh --jdk ${JAVA_HOME_11_X64} --skip-download
working-directory: jtreg
shell: bash
run:
MAKE_ARGS=test
HEADLESS=1
JDK8HOME=${JAVA_HOME_8_X64}
bash make/build.sh --jdk ${JAVA_HOME_8_X64} --skip-download
- name: 'Run all tests (goal: test)'
shell: bash
env:
MAKE_ARGS: test
HEADLESS: 1
run: |
bash make/build.sh --jdk ${JAVA_HOME_11_X64} --skip-download

5
debian/changelog vendored
View File

@ -1,5 +0,0 @@
jtreg6 (6.1+2-ok1) yangtze; urgency=medium
* Build for openkylin.
-- sufang <sufang@kylinos.cn> Tue, 04 Apr 2023 14:01:40 +0800

4
debian/clean vendored
View File

@ -1,4 +0,0 @@
dist/
build/
jtdiff.1
jtreg.1

1
debian/compat vendored
View File

@ -1 +0,0 @@
11

38
debian/control vendored
View File

@ -1,38 +0,0 @@
Source: jtreg6
Section: java
Priority: optional
Maintainer: OpenKylin Developers <packaging@lists.openkylin.top>
Build-Depends:
ant,
debhelper (>= 11),
default-jdk,
help2man,
javahelp2,
javahelper,
libjtharness-java (>= 6.0),
libxalan2-java,
libhamcrest-java,
testng
Standards-Version: 4.6.0
Vcs-Git: https://gitee.com/openkylin/jtreg6.git
Vcs-Browser: https://gitee.com/openkylin/jtreg6
Homepage: https://openjdk.java.net/jtreg
Rules-Requires-Root: no
Package: jtreg6
Architecture: all
Depends:
${java:Depends},
${misc:Depends},
javahelp2,
libjtharness-java (>= 6.0),
libhamcrest-java,
libxalan2-java
Recommends: testng
Conflicts: jtreg
Description: Regression Test Harness for the OpenJDK platform
jtreg is the test harness used by the OpenJDK test framework.
This framework is intended primarily for regression tests.
It can also be used for unit tests, functional tests, and even simple product
tests -- in other words, just about any type of test except a conformance test,
which belong in a TCK.

7953
debian/copyright vendored

File diff suppressed because it is too large Load Diff

3
debian/docs vendored
View File

@ -1,3 +0,0 @@
README.md
COPYRIGHT
CONTRIBUTORS

View File

@ -1,5 +0,0 @@
dist/jtreg/lib/jtreg.jar /usr/share/java
dist/jtreg/doc/jtreg/tag-spec.html /usr/share/doc/jtreg
dist/jtreg/doc/jtreg/usage.txt /usr/share/doc/jtreg
dist/jtreg/bin/jtdiff /usr/share/jtreg/bin
dist/jtreg/bin/jtreg /usr/share/jtreg/bin

18
debian/jtreg6.links vendored
View File

@ -1,18 +0,0 @@
usr/share/jtreg/bin/jtreg /usr/bin/jtreg
usr/share/jtreg/bin/jtdiff /usr/bin/jtdiff
usr/share/java/hamcrest-core.jar /usr/share/jtreg/lib/hamcrest-core.jar
usr/share/java/javatest.jar /usr/share/jtreg/lib/javatest.jar
usr/share/java/jcommander.jar /usr/share/jtreg/lib/jcommander.jar
usr/share/java/jh.jar /usr/share/jtreg/lib/jh.jar
usr/share/java/jtreg.jar /usr/share/jtreg/lib/jtreg.jar
usr/share/java/junit4.jar /usr/share/jtreg/lib/junit.jar
usr/share/java/testng.jar /usr/share/jtreg/lib/testng.jar
usr/share/java/hamcrest-core.jar /usr/share/jtreg/share/java/hamcrest-core.jar
usr/share/java/javatest.jar /usr/share/jtreg/share/java/javatest.jar
usr/share/java/jcommander.jar /usr/share/jtreg/share/java/jcommander.jar
usr/share/java/jh.jar /usr/share/jtreg/share/java/jh.jar
usr/share/java/jtreg.jar /usr/share/jtreg/share/java/jtreg.jar
usr/share/java/junit4.jar /usr/share/jtreg/share/java/junit.jar
usr/share/java/testng.jar /usr/share/jtreg/share/java/testng.jar

View File

@ -1,2 +0,0 @@
jtreg.1
jtdiff.1

20
debian/orig-tar.sh vendored
View File

@ -1,20 +0,0 @@
#!/bin/sh -e
# called by uscan with '--upstream-version' <version> <file>
VERSION=$2
DIR=jtreg-${VERSION}
TAR=../jtreg_${VERSION}.orig.tar.gz
rm -f $3
wget http://hg.openjdk.java.net/code-tools/jtreg/archive/jtreg$VERSION.tar.gz
mv jtreg$VERSION.tar.gz $TAR
# move to directory 'tarballs'
if [ -r .svn/deb-layout ]; then
. .svn/deb-layout
mv $TAR $origDir
echo "moved $TAR to $origDir"
fi
exit 0

View File

@ -1 +0,0 @@
# You must remove unused comment lines for the released package.

30
debian/rules vendored
View File

@ -1,30 +0,0 @@
#!/usr/bin/make -f
JAVA_HOME = /usr/lib/jvm/default-java
# version string has the form 6.1+N-D, the Debian release is not passed into the build
VERSION := $(shell dpkg-parsechangelog --show-field Version | sed 's/+.*//')
BUILD_NUMBER := $(shell dpkg-parsechangelog --show-field Version | sed 's/.*+\([0-9]*\).*/\1/')
DATE := $(shell dpkg-parsechangelog --show-field Date)
%:
dh $@ --with javahelper
override_dh_auto_build:
ant -f make/build.xml \
-Dant.jar=/usr/share/java/ant.jar \
-Djtreg.build.resources=/usr/share/java \
-Djh.jar=/usr/share/java/jh.jar \
-Djhall.jar=/usr/share/java/jhall.jar \
-Djunit.jar=/usr/share/java/junit4.jar \
-Dtestng.jar=/usr/share/java/testng.jar \
-Djavatest.jar=/usr/share/java/javatest.jar \
-Dbuild.date.time='$(DATE)' \
-Dbuild.version=$(VERSION) \
-Dbuild.milestone=src \
-Dbuild.number=$(BUILD_NUMBER)
dh_auto_build
# Generate the manpages
JT_HOME=./dist/jtreg/lib/ help2man --name="Regression Test Harness" --help-option="-help all" dist/jtreg/bin/jtdiff > jtdiff.1
JT_HOME=./dist/jtreg/lib/ help2man --name="Regression Test Harness" --help-option="-help all" dist/jtreg/bin/jtreg > jtreg.1

View File

@ -1 +0,0 @@
3.0 (native)

2
debian/watch vendored
View File

@ -1,2 +0,0 @@
version=4
https://github.com/openjdk/jtreg/tags .*/jtreg([\d\.]+(?:-b[0-9]+)?).tar.gz debian debian/orig-tar.sh

View File

@ -39,7 +39,7 @@ LD_LIBRARY_PATH=
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# #
# Support for Cygwin and MSYS2 (which may identify as MSYS, MINGW32 or MINGW64 (the default)) # Support for Cygwin
SYSTEM_UNAME := $(shell uname) SYSTEM_UNAME := $(shell uname)
@ -53,15 +53,9 @@ endif
ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME))) ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME)))
USING_CYGWIN = true USING_CYGWIN = true
USING_CYGWIN_OR_USING_MSYS = true
endif endif
ifneq (,$(findstring MSYS,$(SYSTEM_UNAME))$(findstring MINGW,$(SYSTEM_UNAME))) ifdef USING_CYGWIN
USING_MSYS = true
USING_CYGWIN_OR_USING_MSYS = true
endif
ifdef USING_CYGWIN_OR_USING_MSYS
define FullPath define FullPath
$(shell cygpath -a -m $1 2> $(DEV_NULL)) $(shell cygpath -a -m $1 2> $(DEV_NULL))
endef endef

View File

@ -87,13 +87,13 @@ setup_shasum() {
native_path() { native_path() {
check_arguments "${FUNCNAME}" 1 $# check_arguments "${FUNCNAME}" 1 $#
if [ $CYGWIN_OR_MSYS -eq 1 ]; then echo $(cygpath -w $1); else echo "$1"; fi if [ $CYGWIN -eq 1 ]; then echo $(cygpath -w $1); else echo "$1"; fi
} }
mixed_path() { mixed_path() {
check_arguments "${FUNCNAME}" 1 $# check_arguments "${FUNCNAME}" 1 $#
if [ $CYGWIN_OR_MSYS -eq 1 ]; then echo $(cygpath -m $1); else echo "$1"; fi if [ $CYGWIN -eq 1 ]; then echo $(cygpath -m $1); else echo "$1"; fi
} }
## ##
@ -331,8 +331,4 @@ export ANT_ARCHIVE_URL_BASE="${ANT_ARCHIVE_URL_BASE:-https://archive.apache.org/
setup_shasum setup_shasum
## case $(uname) in CYGWIN*) CYGWIN=1 ;; *) CYGWIN=0 ;; esac
# Support for Cygwin and MSYS2 (which may identify as MSYS, MINGW32 or MINGW64 (the default))
#
case $(uname) in CYGWIN*|MSYS*|MINGW*) CYGWIN_OR_MSYS=1 ;; *) CYGWIN_OR_MSYS=0 ;; esac
info "CYGWIN_OR_MSYS=$CYGWIN_OR_MSYS"

View File

@ -23,7 +23,7 @@
# questions. # questions.
# #
JTREG_VERSION=6.1 JTREG_VERSION=6.2
DEFAULT_ANT_VERSION=1.10.8 DEFAULT_ANT_VERSION=1.10.8
DEFAULT_ANT_ARCHIVE_CHECKSUM=dbe187ce2963f9df8a67de8aaff3b0a437d06978 DEFAULT_ANT_ARCHIVE_CHECKSUM=dbe187ce2963f9df8a67de8aaff3b0a437d06978

View File

@ -926,7 +926,7 @@ make ANT="${ANT}" \
JCOV_JAR="${JCOV_JAR}" \ JCOV_JAR="${JCOV_JAR}" \
JCOV_LICENSE="${JCOV_LICENSE}" \ JCOV_LICENSE="${JCOV_LICENSE}" \
JCOV_NETWORK_SAVER_JAR="${JCOV_NETWORK_SAVER_JAR}" \ JCOV_NETWORK_SAVER_JAR="${JCOV_NETWORK_SAVER_JAR}" \
JDKHOME="$(mixed_path ${JAVA_HOME})" \ JDKHOME="${JAVA_HOME}" \
JTHARNESS_COPYRIGHT="${JTHARNESS_COPYRIGHT}" \ JTHARNESS_COPYRIGHT="${JTHARNESS_COPYRIGHT}" \
JTHARNESS_LICENSE="${JTHARNESS_LICENSE}" \ JTHARNESS_LICENSE="${JTHARNESS_LICENSE}" \
JUNIT_JAR="$(mixed_path "${JUNIT_JAR}")" \ JUNIT_JAR="$(mixed_path "${JUNIT_JAR}")" \

View File

@ -172,7 +172,7 @@
<target name="-compile-jtreg.classes"> <target name="-compile-jtreg.classes">
<mkdir dir="${build.classes.dir}"/> <mkdir dir="${build.classes.dir}"/>
<javac encoding="iso-8859-1" release="8" <javac encoding="iso-8859-1" source="1.8" target="1.8"
debug="true" debuglevel="source,lines" debug="true" debuglevel="source,lines"
srcdir="${src.classes.dir}" srcdir="${src.classes.dir}"
destdir="${build.classes.dir}" destdir="${build.classes.dir}"

View File

@ -1,7 +1,7 @@
jtregHome = /path/to/jtreg jtregHome = /path/to/jtreg
minBuild = 211 minBuild = 211
pluginVersion = 1.13 pluginVersion = 1.14
javaLevel = 11 javaLevel = 11
notes = <ul>\ notes = <ul>\
<li>Fix compatibility with 2021.2</li>\ <li>Fix debugging support for 2021.3</li>\
</ul> </ul>

Binary file not shown.

View File

@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
plugins/idea/gradlew vendored
View File

@ -1,185 +0,0 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

View File

@ -1,89 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -124,7 +124,7 @@ class JTRegConfigurationRunnableState extends JavaTestFrameworkRunnableState<JTR
if (getEnvironment().getRunner() instanceof JTRegDebuggerRunner) { if (getEnvironment().getRunner() instanceof JTRegDebuggerRunner) {
JTRegDebuggerRunner runner = (JTRegDebuggerRunner) getEnvironment().getRunner(); JTRegDebuggerRunner runner = (JTRegDebuggerRunner) getEnvironment().getRunner();
javaParameters.getProgramParametersList().add("-debug:-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=127.0.0.1:" + runner.address); javaParameters.getProgramParametersList().add("-debug:-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=127.0.0.1:" + runner.address());
boolean hasMode = false; boolean hasMode = false;
for (String s : new String[] { "-ovm", "-othervm", "-avm", "-agentvm" }) { for (String s : new String[] { "-ovm", "-othervm", "-avm", "-agentvm" }) {
if (javaParameters.getProgramParametersList().hasParameter(s)) { if (javaParameters.getProgramParametersList().hasParameter(s)) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2021 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -36,7 +36,6 @@ import com.intellij.execution.ui.RunContentDescriptor;
import com.oracle.plugin.jtreg.configuration.JTRegConfiguration; import com.oracle.plugin.jtreg.configuration.JTRegConfiguration;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import com.oracle.plugin.jtreg.configuration.JTRegConfiguration;
/** /**
* A custom debugger executor that publicize port choices to external clients. * A custom debugger executor that publicize port choices to external clients.
@ -52,13 +51,22 @@ public class JTRegDebuggerRunner extends GenericDebuggerRunner {
return profile instanceof JTRegConfiguration; return profile instanceof JTRegConfiguration;
} }
public String address; private String address;
public String address() {
return address;
}
@Override
public void execute(@NotNull ExecutionEnvironment environment) throws ExecutionException {
address = DebuggerUtils.getInstance().findAvailableDebugAddress(true);
super.execute(environment);
}
@Nullable @Nullable
@Override @Override
protected RunContentDescriptor createContentDescriptor(@NotNull final RunProfileState state, protected RunContentDescriptor createContentDescriptor(@NotNull final RunProfileState state,
@NotNull final ExecutionEnvironment environment) throws ExecutionException { @NotNull final ExecutionEnvironment environment) throws ExecutionException {
address = DebuggerUtils.getInstance().findAvailableDebugAddress(true);
RemoteConnection connection = new RemoteConnection(true, "127.0.0.1", address, true); RemoteConnection connection = new RemoteConnection(true, "127.0.0.1", address, true);
return attachVirtualMachine(state, environment, connection, true); return attachVirtualMachine(state, environment, connection, true);
} }

View File

@ -37,10 +37,6 @@
# #
# jtdiff also provides an Ant task for direct invocation from Ant. # jtdiff also provides an Ant task for direct invocation from Ant.
if [ -z "${JT_HOME}" ]; then
JT_HOME="/usr/share/jtreg"
fi
# Determine jtdiff/JavaTest installation directory # Determine jtdiff/JavaTest installation directory
if [ -n "$JT_HOME" ]; then if [ -n "$JT_HOME" ]; then
if [ ! -r $JT_HOME/lib/jtreg.jar ];then if [ ! -r $JT_HOME/lib/jtreg.jar ];then
@ -100,7 +96,7 @@ if [ -n "$JT_JAVA" ]; then
elif [ -n "$JAVA_HOME" ]; then elif [ -n "$JAVA_HOME" ]; then
JT_JAVA="$JAVA_HOME/bin/java" JT_JAVA="$JAVA_HOME/bin/java"
else else
JT_JAVA=/usr/lib/jvm/default-java/bin/java JT_JAVA=java
fi fi
# Verify java version (1.)5 or newer used to run jtdiff # Verify java version (1.)5 or newer used to run jtdiff

View File

@ -70,10 +70,6 @@ esac
# Determine jtreg installation directory # Determine jtreg installation directory
JTREG_HOME=${JTREG_HOME:-$JT_HOME} # allow for old version of name JTREG_HOME=${JTREG_HOME:-$JT_HOME} # allow for old version of name
if [ -z "${JTREG_HOME}" ]; then
JTREG_HOME="/usr/share/jtreg"
fi
if [ -n "$JTREG_HOME" ]; then if [ -n "$JTREG_HOME" ]; then
if [ ! -r $JTREG_HOME/lib/jtreg.jar ];then if [ ! -r $JTREG_HOME/lib/jtreg.jar ];then
echo "Invalid JTREG_HOME=$JTREG_HOME. Cannot find or read $JTREG_HOME/lib/jtreg.jar" echo "Invalid JTREG_HOME=$JTREG_HOME. Cannot find or read $JTREG_HOME/lib/jtreg.jar"
@ -129,7 +125,7 @@ elif [ -n "$JAVA_HOME" ]; then
elif [ -n "$jdk" ]; then elif [ -n "$jdk" ]; then
JTREG_JAVA="$jdk/bin/java" JTREG_JAVA="$jdk/bin/java"
else else
JTREG_JAVA=/usr/lib/jvm/default-java/bin/java JTREG_JAVA=java
fi fi
# Fixup JTREG_JAVA, JTREG_HOME as needed, if using Cygwin or WSL # Fixup JTREG_JAVA, JTREG_HOME as needed, if using Cygwin or WSL

View File

@ -41,6 +41,7 @@ import java.util.Properties;
import static com.sun.javatest.regtest.agent.AStatus.error; import static com.sun.javatest.regtest.agent.AStatus.error;
import static com.sun.javatest.regtest.agent.AStatus.passed; import static com.sun.javatest.regtest.agent.AStatus.passed;
@SuppressWarnings("removal") // Security Manager and related APIs
public class ActionHelper { public class ActionHelper {
// <editor-fold defaultstate="collapsed" desc=" Save State "> // <editor-fold defaultstate="collapsed" desc=" Save State ">

View File

@ -56,6 +56,7 @@ import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@SuppressWarnings("removal") // Security Manager and related APIs
public class AgentServer implements ActionHelper.OutputHandler { public class AgentServer implements ActionHelper.OutputHandler {
/** /**

View File

@ -65,6 +65,7 @@ import java.util.Hashtable;
* *
* @author Iris A Garcia * @author Iris A Garcia
*/ */
// @SuppressWarnings("removal") // Applet and related APIs
public class AppletWrapper public class AppletWrapper
{ {
public static void main(String [] args) { public static void main(String [] args) {
@ -530,6 +531,7 @@ class CheckboxPanel extends Panel
/** /**
* This is the panel which contains the test applet. * This is the panel which contains the test applet.
*/ */
// @SuppressWarnings("removal") // Applet and related APIs
class AppletPanel extends Panel class AppletPanel extends Panel
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -42,6 +42,7 @@ import java.util.PropertyPermission;
* by JDK1.0.2. * by JDK1.0.2.
*/ */
@SuppressWarnings("removal") // Security Manager and related APIs
public class JavaTestSecurityManager extends SecurityManager public class JavaTestSecurityManager extends SecurityManager
{ {
/** /**

View File

@ -28,6 +28,7 @@ package com.sun.javatest.regtest.agent;
import java.security.Permission; import java.security.Permission;
import java.util.PropertyPermission; import java.util.PropertyPermission;
@SuppressWarnings("removal") // Security Manager and related APIs
public class RegressionSecurityManager extends JavaTestSecurityManager { public class RegressionSecurityManager extends JavaTestSecurityManager {
/** /**
* Try to install a copy of this security manager, up to but not including JDK 18. * Try to install a copy of this security manager, up to but not including JDK 18.

View File

@ -627,8 +627,11 @@ public class JDK {
int rc = p.waitFor(); int rc = p.waitFor();
if (rc != 0) { if (rc != 0) {
String msg = "failed to get JDK properties for " for (String line : lines) {
+ getJavaProg() + " " + StringUtils.join(vmOpts, " ") + "; exit code " + rc; logger.accept(line);
}
String msg = String.format("failed to get JDK properties:%ncmd: \"%s\"%ncwd: \"%s\"%nexit code: %d",
StringUtils.join(cmdArgs, "\" "), scratchDir, rc);
logger.accept(msg); logger.accept(msg);
throw new Fault(msg); throw new Fault(msg);
} }

View File

@ -28,6 +28,7 @@ package com.sun.javatest.regtest.config;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -967,8 +968,17 @@ public class RegressionParameters
if (jtClsDir.getName().equals("javatest.jar")) { if (jtClsDir.getName().equals("javatest.jar")) {
File installDir = jtClsDir.getParentFile(); File installDir = jtClsDir.getParentFile();
// append jtreg.jar to the path // append jtreg.jar or exploded directory to the search path
javaTestClassPath.append(new File(installDir, "jtreg.jar")); File jtreg = new File(installDir, "jtreg.jar");
if (jtreg.exists()) {
javaTestClassPath.append(jtreg);
} else try {
// use code source location of this class instead
URL location = getClass().getProtectionDomain().getCodeSource().getLocation();
javaTestClassPath.append(new File(location.toURI()));
} catch (Exception e) { // including NullPointerException and URISyntaxException
throw new RuntimeException("Computation of Java test class-path failed", e);
}
} }
} }
return javaTestClassPath; return javaTestClassPath;

View File

@ -295,7 +295,7 @@ public class TestManager {
TestResultTable trt = wd.getTestResultTable(); TestResultTable trt = wd.getTestResultTable();
if (trt.validatePath(path)) { if (trt.validatePath(path)) {
// bypass check when fragment syntax used // bypass check when fragment syntax used
if (path.matches("(?i).*#[a-z0-9]+")) if (path.matches(".*#[A-Za-z0-9-_]+"))
return true; return true;
File rootDir = wd.getTestSuite().getRootDir(); File rootDir = wd.getTestSuite().getRootDir();
File f = new File(rootDir, path); File f = new File(rootDir, path);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -638,7 +638,7 @@ public class AppletAction extends Action
//----------member variables---------------- -------------------------------- //----------member variables---------------- --------------------------------
private String manual = "unset"; private String manual = "unset"; // or "novalue", "done", "yesno"
private boolean reverseStatus = false; private boolean reverseStatus = false;
private boolean othervm = false; private boolean othervm = false;
private int timeout = -1; private int timeout = -1;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -575,7 +575,6 @@ public class MainAction extends Action
.append(jdk.getJDKClassPath()) .append(jdk.getJDKClassPath())
.append(script.getJUnitPath()) .append(script.getJUnitPath())
.append(script.getTestNGPath()) .append(script.getTestNGPath())
.append(new SearchPath("/usr/share/java/jcommander.jar"))
.asList(); .asList();
Version v = script.getRequiredVersion(); Version v = script.getRequiredVersion();
@ -788,5 +787,5 @@ public class MainAction extends Action
protected Set<String> othervmOverrideReasons = new LinkedHashSet<>(); protected Set<String> othervmOverrideReasons = new LinkedHashSet<>();
protected boolean nativeCode = false; protected boolean nativeCode = false;
private int timeout = -1; private int timeout = -1;
private String manual = "unset"; private String manual = "unset"; // or "novalue"
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -492,7 +492,7 @@ public class RegressionScript extends Script {
/** /**
* Get the timeout to be used for a test. Since the timeout for regression * Get the timeout to be used for a test. Since the timeout for regression
* tests is on a per action basis rather than on a per test basis, this * tests is on a per-action basis rather than on a per-test basis, this
* method should always return zero which indicates that there is no * method should always return zero which indicates that there is no
* timeout. * timeout.
* *
@ -504,22 +504,22 @@ public class RegressionScript extends Script {
} }
/** /**
* Get the timeout to be used for an action. The timeout will be scaled by * Returns the timeout to be used for an action.
* the timeoutFactor as necessary. The default timeout for any action as
* per the tag-spec is 120 seconds scaled by a value found in the
* environment ("javatestTimeoutFactor").
* The timeout factor is available as both an integer (for backward
* compatibility) and a floating point number
* *
* @param time The initial timeout which may need to be scaled according * If no debug options have been set, the result will be the given value,
* to the provided timeoutFactor. If the initial timeout is * or a default value if the given value is negative, scaled by the timeout factor.
* less than zero, then the default timeout will be returned. *
* @return The timeout in seconds. * If debug options have been set, the result will be 0, meaning "no timeout".
*
* @param time the value of the timeout specified in the action,
* or -1 if no value was specified
* @return the timeout, in seconds
*/ */
protected int getActionTimeout(int time) { protected int getActionTimeout(int time) {
if (time < 0) final int DEFAULT_ACTION_TIMEOUT = 120; // seconds
time = 120; return isTimeoutsEnabled()
return (int) (time * getTimeoutFactor()); ? (int) ((time < 0 ? DEFAULT_ACTION_TIMEOUT : time) * getTimeoutFactor())
: 0;
} }
protected float getTimeoutFactor() { protected float getTimeoutFactor() {
@ -527,7 +527,9 @@ public class RegressionScript extends Script {
// not synchronized, so in worst case may be set more than once // not synchronized, so in worst case may be set more than once
float value = 1; // default float value = 1; // default
try { try {
// use [1] to get the floating point timeout factor // The timeout factor is available as both an integer (for backward compatibility)
// and a floating point number.
// Use [1] to get the floating point timeout factor
String f = (regEnv == null ? null : regEnv.lookup("javatestTimeoutFactor")[1]); String f = (regEnv == null ? null : regEnv.lookup("javatestTimeoutFactor")[1]);
if (f != null) if (f != null)
value = Float.parseFloat(f); value = Float.parseFloat(f);
@ -541,6 +543,16 @@ public class RegressionScript extends Script {
private static float cacheJavaTestTimeoutFactor = -1; private static float cacheJavaTestTimeoutFactor = -1;
/**
* Returns whether timeouts are (generally) enabled.
*
* @return {@code true} if timeouts are enabled, and {@code false} otherwise
*/
protected boolean isTimeoutsEnabled() {
// for now, timeouts are always enabled, unless debug options have been specified for the test
return getTestDebugOptions().isEmpty();
}
/** /**
* Set an alarm that will interrupt the calling thread after a specified * Set an alarm that will interrupt the calling thread after a specified
* delay (in milliseconds), and repeatedly thereafter until canceled. The * delay (in milliseconds), and repeatedly thereafter until canceled. The
@ -817,20 +829,16 @@ public class RegressionScript extends Script {
File md = workDir.getFile("modules"); File md = workDir.getFile("modules");
if (needJUnit) if (needJUnit)
install(params.getJUnitPath(), md); install(params.getJUnitPath(), md);
if (needTestNG) { if (needTestNG)
install(params.getTestNGPath(), md); install(params.getTestNGPath(), md);
install(new SearchPath("/usr/share/java/jcommander.jar"), md);
}
mp.append(md); mp.append(md);
} }
} else { } else {
if (needJUnit) if (needJUnit)
cp.append(params.getJUnitPath()); cp.append(params.getJUnitPath());
if (needTestNG) { if (needTestNG)
cp.append(params.getTestNGPath()); cp.append(params.getTestNGPath());
cp.append(new SearchPath("/usr/share/java/jcommander.jar"));
}
} }
// Extras: // Extras:
@ -922,10 +930,8 @@ public class RegressionScript extends Script {
File md = workDir.getFile("modules"); File md = workDir.getFile("modules");
if (needJUnit) if (needJUnit)
install(params.getJUnitPath(), md); install(params.getJUnitPath(), md);
if (needTestNG) { if (needTestNG)
install(params.getTestNGPath(), md); install(params.getTestNGPath(), md);
install(new SearchPath("/usr/share/java/jcommander.jar"), md);
}
mp.append(md); mp.append(md);
} }
} else { } else {
@ -933,10 +939,8 @@ public class RegressionScript extends Script {
if (needJUnit) if (needJUnit)
fp.append(params.getJUnitPath()); fp.append(params.getJUnitPath());
if (needTestNG) { if (needTestNG)
fp.append(params.getTestNGPath()); fp.append(params.getTestNGPath());
fp.append(new SearchPath("/usr/share/java/jcommander.jar"));
}
} }
// Extras: // Extras:

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -416,5 +416,5 @@ public class ShellAction extends Action
private boolean reverseStatus = false; private boolean reverseStatus = false;
private int timeout = -1; private int timeout = -1;
private String manual = "unset"; private String manual = "unset"; // or "novalue"
} }

View File

@ -131,6 +131,7 @@ import static com.sun.javatest.regtest.tool.Option.ArgType.*;
/** /**
* Main entry point to be used to access jtreg. * Main entry point to be used to access jtreg.
*/ */
@SuppressWarnings("removal") // Security Manager and related APIs
public class Tool { public class Tool {
/** /**
@ -994,7 +995,7 @@ public class Tool {
? Pattern.compile("(|[^A-Za-z]|.{2,}):[A-Za-z0-9_,]+") ? Pattern.compile("(|[^A-Za-z]|.{2,}):[A-Za-z0-9_,]+")
: Pattern.compile(".*:[A-Za-z0-9_,]+"); : Pattern.compile(".*:[A-Za-z0-9_,]+");
Pattern fileIdPtn = Pattern.compile("(?i).*#[a-z0-9]+"); Pattern fileIdPtn = Pattern.compile(".*#[A-Za-z0-9-_]+");
} }
); );
@ -1995,13 +1996,24 @@ public class Tool {
try { try {
// work around bug CODETOOLS-7900214 -- force the sections to be reloaded // work around bug CODETOOLS-7900214 -- force the sections to be reloaded
tr.getProperty("sections"); tr.getProperty("sections");
String section, stream;
int sep = showStream.indexOf("/");
if (sep == -1) {
section = null;
stream = showStream;
} else {
section = showStream.substring(0, sep);
stream = showStream.substring(sep + 1);
}
for (int i = 0; i < tr.getSectionCount(); i++) { for (int i = 0; i < tr.getSectionCount(); i++) {
TestResult.Section s = tr.getSection(i); TestResult.Section s = tr.getSection(i);
String text = s.getOutput(showStream); if (section == null || section.equals(s.getTitle())) {
// need to handle internal newlines properly String text = s.getOutput(stream);
if (text != null) { // need to handle internal newlines properly
out.println("### Section " + s.getTitle()); if (text != null) {
out.println(text); out.println("### Section " + s.getTitle());
out.println(text);
}
} }
} }
ok = true; ok = true;

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ help.cmd.introHead=For brief details about a topic, use "-help <term> ...". \
available for the following topics.\n available for the following topics.\n
help.cmd.fullHead= help.cmd.fullHead=
help.cmd.summaryHead=Information is available for the following topics: help.cmd.summaryHead=Information is available for the following topics:
help.copyright.txt=Copyright (c) 1999, 2021, Oracle and/or its affiliates. \ help.copyright.txt=Copyright (c) 1999, 2022, Oracle and/or its affiliates. \
All rights reserved.\nUse is subject to license terms. All rights reserved.\nUse is subject to license terms.
help.cmd.noEntriesFound=No entries were found that matched your query. help.cmd.noEntriesFound=No entries were found that matched your query.
@ -157,6 +157,7 @@ help.jdk.vmoptions.arg=<option>...
help.jdk.debug.desc=Use this to specify VM options to attach a debugger \ help.jdk.debug.desc=Use this to specify VM options to attach a debugger \
to a VM running a test. It is similar to -vmoptions except that it is not used \ to a VM running a test. It is similar to -vmoptions except that it is not used \
when starting VMs used to query the properties of that VM. \ when starting VMs used to query the properties of that VM. \
Any timeout for a test is automatically disabled when this option is used. \
See also -javaoptions and -vmoptions. See also -javaoptions and -vmoptions.
help.jdk.debug.arg=<option>... help.jdk.debug.arg=<option>...
help.jdk.agentlib.desc=Load native agent library help.jdk.agentlib.desc=Load native agent library
@ -242,9 +243,14 @@ help.main.startHttpd.desc=Start the http server to view test results
help.main.showGroups.desc=Show the expansion (to files and directories) of the \ help.main.showGroups.desc=Show the expansion (to files and directories) of the \
groups given on the command line. To see the expansion of all the groups \ groups given on the command line. To see the expansion of all the groups \
in a test suite, specify the name of the test suite. in a test suite, specify the name of the test suite.
help.main.show.desc=Show information from a section in the results file for a test. \ help.main.show.desc=Show the contents of a stream in a specific section or in all \
For example, -show:rerun sections of the results file for a test. \
help.main.show.arg=<section-name> The content is shown as originally written to the stream: \
that is, without the escape encoding used in the .jtr file. \
If no section name is given, the output for the named stream in all sections \
is shown.\n\
For example, -show:rerun -show:main/System.out
help.main.show.arg=[<section-name>/]<stream-name>
help.main.w.desc=Location for .class files, .jtr files, etc. "./JTwork" is default help.main.w.desc=Location for .class files, .jtr files, etc. "./JTwork" is default
help.main.w.arg=<directory> help.main.w.arg=<directory>

View File

@ -24,7 +24,7 @@ The following sections provide the recommended system requirements for running
jtreg. jtreg.
- Java platform - Java platform
A platform equivalent to JDK 1.7.0 or later is required. A platform equivalent to JDK 1.8.0 or later is required.
- Memory - Memory
It is recommended that you run jtreg on a computer having at least 256M of It is recommended that you run jtreg on a computer having at least 256M of

View File

@ -327,10 +327,10 @@ file called `Hello.jtr`. These files reside in the
work directory which contains a directory hierarchy that work directory which contains a directory hierarchy that
parallels the test source structure. parallels the test source structure.
Blocks of text within a .jtr file use `\` to escape certain characters Blocks of text within a .jtr file use `\` to [escape](#jtr-encoding) certain characters
(including `\` itself). This needs to be taken into account if you (including `\` itself). This needs to be taken into account if you
view the contents of the file directly. If you use the GUI, or use view the contents of the file directly. If you use the GUI, or use
the jtreg `-show` option, the escapes are automatically taken into acocunt. the jtreg `-show` option, the escapes are automatically taken into account.
### What's the difference between the "fail" and "error" return status? ### What's the difference between the "fail" and "error" return status?
@ -818,6 +818,9 @@ using the `-timeoutHandler` and `-timeoutHanderDir` options. The default
timeout handler will try and call `jstack` to generate stack traces of all timeout handler will try and call `jstack` to generate stack traces of all
the Java threads running in the JVM being used for the action. the Java threads running in the JVM being used for the action.
Test timeouts are automatically disabled when a test is being debugged,
as indicated by the use of the `-debug` option.
For all timeout-related options, use `jtreg -help timeout`. For all timeout-related options, use `jtreg -help timeout`.
### How do I run only tests which were written for a specific bugid? ### How do I run only tests which were written for a specific bugid?
@ -838,10 +841,11 @@ You have several alternatives.
1. Use the `-verbose:all` option, or the related result-sensitive 1. Use the `-verbose:all` option, or the related result-sensitive
options `-verbose:pass`, `-verbose:fail`, `-verbose:error`. options `-verbose:pass`, `-verbose:fail`, `-verbose:error`.
2. Use the JavaTest harness GUI. 2. Use the JavaTest (JT Harness) harness GUI.
3. View the test's `.jtr` file. 3. View the test's `.jtr` file.
4. Use the `-show` option. For example, _Note: some characters in the file may be [encoded](#jtr-encoding)._
* `jtreg -show:System.out` _test-name_ 4. Use the `-show` option to display the unencoded content of a stream. For example,
* `jtreg -w` _work-dir_ `-show:System.out` _test-name_
### How do I see what groups are defined in my test suite? ### How do I see what groups are defined in my test suite?
@ -857,6 +861,47 @@ Use the `-listtests` option.
$ jtreg -listtests test/langtools/jdk/javadoc/doclet $ jtreg -listtests test/langtools/jdk/javadoc/doclet
### Why are there extra `\` characters in the output from a test in a .jtr file? {#jtr-encoding}
By design, the contents of a `.jtr` file, including any output from tests, is represented in a way
that can be read back in again by `jtreg` and related tools. To that end, characters that are not
standard ASCII characters (printable characters, and `CR`, `LF`, `SP`, `HT`) are encoded with escape sequences..
Characters outside that set are represented by `\uXXXX`, and `\` itself as written as `\\`.
Anyone viewing the contents of a `.jtr` directly, such as in a plain-text editor, or using
command-line tools like `grep` need to be aware of that encoding and take it into account.
To view the unencoded output from a test that has been recorded in a `.jtr` file,
use the `jtreg` `-show:name` option.
$ jtreg -w:/path/to/work-dir -show:System.out /path/to/test
The `-show` option can also be used to see the `rerun` script that is provided in the `.jtr` file,
and which may also contain escape sequences. This script allows you to [rerun the test stand-alone](#rerun),
without the use of the `jtreg` infrastructure.
### What names can I use with the `-show` option
All recent versions of `jtreg` accept the name of an output stream as the name.
$ jtreg ... -show:stream-name ...
The name of each output stream appears after a series of dashes and before a colon `:`
in the `.jtr` file. For example, here is a heading for a stream named `System.out`:
----------System.out:(1/501)----------
More recent versions (6.2 onwards) support an optional section name as well.
See the command-line help for specific details in the version you are using.
$ jtreg ... -show:section-name/stream-name
The name of all the sections appear in the `testresult` part of the `.jtr` file,
and individually after `#section:` at the beginning of each section. For example,
sections=script_messages build compile build main
#section:compile
### Can I verify the correctness of test descriptions without actually running the tests? ### Can I verify the correctness of test descriptions without actually running the tests?
Yes! The `-check` option to `jtreg` will find Yes! The `-check` option to `jtreg` will find
@ -874,7 +919,7 @@ The following sample output illustrates use of this option.
Results written to /u/iag/jtw/JTwork Results written to /u/iag/jtw/JTwork
Error: some tests failed or other problems occurred Error: some tests failed or other problems occurred
### I'd like to run my test standalone, without using jtreg: how do I do that? ### I'd like to run my test standalone, without using jtreg: how do I do that? {#rerun}
All tests are generally designed so that they can be run without using jtreg. All tests are generally designed so that they can be run without using jtreg.
Tests either have a `main` method, or can be run using a framework like TestNG or JUnit. Tests either have a `main` method, or can be run using a framework like TestNG or JUnit.
@ -1253,6 +1298,17 @@ The discarded output will be replaced with a message like the following:
set the system property javatest.maxOutputSize to a higher set the system property javatest.maxOutputSize to a higher
value. The current value is 100000. value. The current value is 100000.
### How do I set `javatest.maxOutputSize`? {#how-to-set-javatest.maxOutputSize}
See the [previous entry](#how-much-output).
TL;DR: If you're trying to set `javatest.maxOutputSize`, it may be because you have seen a
message in the middle of some very long output in a `.jtr` file. You can either
set the default value with a system property for the JVM running jtreg (_not_ the JVM(s)
used to run tests), or you can override the default value for some or all tests with the
`maxOutputSize` property in the `TEST.ROOT` or `TEST.properties` configuration files.
### How much time can a test take? {#how-much-time} ### How much time can a test take? {#how-much-time}
jtreg limits the amount of time that may be used to execute each action of the jtreg limits the amount of time that may be used to execute each action of the
@ -1749,7 +1805,7 @@ You can use `@run driver` to run a class that provides more complex logic, if ne
### My test uses "preview features": how do I specify the necessary options? ### My test uses "preview features": how do I specify the necessary options?
Tests that use preview features must use the `--enable-option` to compile Tests that use preview features must use the `--enable-preview` to compile
and run the code. In addition, to compile the code you must also specify the and run the code. In addition, to compile the code you must also specify the
appropriate source level. appropriate source level.