Skip to content
Commits on Source (7)
/build/
/webrev
.DS_Store
/.idea/
repo: 9f51ef22f00a3d5b681472cacf3ce15868073103
node: ec37d2900cd42987270f98423a60eb6297bdc37b
node: deee95d5d8ff6406b77c0d5b9297736eb7c98c6d
branch: default
tag: jtreg4.2-b14
tag: jtreg4.2-b16
......@@ -27,3 +27,4 @@ cce0ac75e87864ed365a420fb836a4430421ab0f jtreg4.2-b08
a13ec77e7adcc4c9ed434e664abc350abaacc045 jtreg4.2-b11
652902f7fb0ed0b4f307d61a799caf50a6e609be jtreg4.2-b12
7a38f21e077821a5015792e85b3793c90c81b866 jtreg4.2-b13
ec37d2900cd42987270f98423a60eb6297bdc37b jtreg4.2-b14
jtreg (4.2-b16-1) unstable; urgency=medium
* Team upload.
* New upstream release
- Refreshed the patches
* Track the new releases from GitHub
* Standards-Version updated to 4.4.1
-- Emmanuel Bourg <ebourg@apache.org> Sun, 12 Jan 2020 00:31:57 +0100
jtreg (4.2-b14-1) unstable; urgency=medium
* Team upload.
......
......@@ -13,7 +13,7 @@ Build-Depends:
libjtharness-java,
libxalan2-java,
testng
Standards-Version: 4.3.0
Standards-Version: 4.4.1
Vcs-Git: https://salsa.debian.org/java-team/jtreg.git
Vcs-Browser: https://salsa.debian.org/java-team/jtreg
Homepage: http://openjdk.java.net/jtreg
......
......@@ -14,7 +14,7 @@ Forwarded: no
SearchPath classpath = paths.get(PathKind.CLASSPATH);
--- a/src/share/classes/com/sun/javatest/regtest/exec/RegressionScript.java
+++ b/src/share/classes/com/sun/javatest/regtest/exec/RegressionScript.java
@@ -771,16 +771,20 @@
@@ -781,16 +781,20 @@
File md = workDir.getFile("modules");
if (needJUnit)
install(params.getJUnitPath(), md);
......@@ -37,7 +37,7 @@ Forwarded: no
}
// Extras:
@@ -872,8 +876,10 @@
@@ -882,8 +886,10 @@
File md = workDir.getFile("modules");
if (needJUnit)
install(params.getJUnitPath(), md);
......@@ -49,7 +49,7 @@ Forwarded: no
mp.append(md);
}
} else {
@@ -881,8 +887,10 @@
@@ -891,8 +897,10 @@
if (needJUnit)
fp.append(params.getJUnitPath());
......
version=3
https://adopt-openjdk.ci.cloudbees.com/job/jtreg/lastSuccessfulBuild/artifact/jtreg-([\d\.]+(?:-b[0-9]+)?).tar.gz debian debian/orig-tar.sh
version=4
https://github.com/openjdk/jtreg/tags .*/jtreg([\d\.]+(?:-b[0-9]+)?).tar.gz debian debian/orig-tar.sh
#
# Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -23,7 +23,6 @@
# questions.
#
#---------------------------------------------------------------------
#
# Copy resources (*.properties) into classes directory from source tree
......@@ -71,9 +70,10 @@ $(IMAGES_DIR)/%.jar: pkgsToFiles.sh
echo "$(@F:%.jar=%)-BuildDate: `/bin/date +'%B %d, %Y'`" ; \
) \
> $(@:$(IMAGES_DIR)/%.jar=$(BUILDDIR)/jarData/%/manifest.txt)
sh pkgsToFiles.sh $(CLASSDIR) $($(@F:%.jar=PKGS.JAR.%)) > $(@:$(IMAGES_DIR)/%.jar=$(BUILDDIR)/jarData/%/includes.txt)
$(JAR) -cmf $(@:$(IMAGES_DIR)/%.jar=$(BUILDDIR)/jarData/%/manifest.txt) $@ \
$(JAR_COPYRIGHT) \
`sh pkgsToFiles.sh $(CLASSDIR) $($(@F:%.jar=PKGS.JAR.%))` \
@$(@:$(IMAGES_DIR)/%.jar=$(BUILDDIR)/jarData/%/includes.txt) \
$(patsubst $(CLASSDIR)/%,-C $(CLASSDIR) %,$(sort $(FILES.JAR.$(@F:%.jar=%)))) \
$(JAR_EXTRAS)
$(CHMOD) a-w $@
......
#!/bin/bash
#
# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -50,12 +50,51 @@ if case ${JAVA_VERSION} in 1.8*) false ;; *) true; esac; then
exit 1
fi
case `uname` in CYGWIN*) CYGWIN=1 ;; *) CYGWIN=0 ;; esac
native_path() {
if [ $CYGWIN == 1 ]; then echo `cygpath -w $1`; else echo $1; fi
}
mixed_path() {
if [ $CYGWIN == 1 ]; then echo `cygpath -m $1`; else echo $1; fi
}
get_scm_type() {
if [ -d .hg ]; then
echo "HG"
elif [ -d .git ]; then
echo "GIT"
else
echo "Error: unrecognized repository, it must be Git or Mercurial" >&2
exit 1
fi
}
SCM_TYPE=`get_scm_type`
get_root() {
case $SCM_TYPE in
HG) hg root ;;
GIT) git rev-parse --show-toplevel ;;
*) echo "Error: unknown SCM" >&2 ; exit 1 ;;
esac
}
get_tag_info() {
case $SCM_TYPE in
HG) hg tags | grep jtreg | head -1 ;;
GIT) git tag | grep jtreg | tail -1 ;;
*) echo "Error: unknown SCM" >&2 ; exit 1 ;;
esac
}
export JAVA_HOME=$1
export PATH="$JAVA_HOME:$PATH"
if [ -n `which sha1sum` ]; then
if [ -n "`which sha1sum`" ]; then
SHASUM=sha1sum;
elif [ -n `which shasum` ]; then
elif [ -n "`which shasum`" ]; then
SHASUM="shasum -a 1"
else
echo "Error: can't find shasum or sha1sum" >&2
......@@ -67,7 +106,9 @@ UNZIP_OPTS="${UNZIP_OPTS:--q} -u"
WGET=wget
WGET_OPTS=${WGET_OPTS:--q}
ROOT=$(hg root)
ROOT=`get_root`
BUILD_DIR=${BUILD_DIR:-${ROOT}/build}
if [ "${SKIP_WGET:-}" = "" -a -d ${BUILD_DIR} ]; then
......@@ -129,7 +170,7 @@ 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
${ANT} -DBUILD_DIR=`native_path ${ASMTOOLS_DIST}` -f `native_path ${ASMTOOLS_SRC}/build/build.xml`
ASMTOOLS_JAR=${ASMTOOLS_DIST}/binaries/lib/asmtools.jar
ASMTOOLS_LICENSE=${ASMTOOLS_SRC}/LICENSE
......@@ -150,7 +191,7 @@ 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
${ANT} -DBUILD_DIR=`native_path ${JTHARNESS_DIST}` -f `native_path ${JTHARNESS_SRC}/build/build.xml`
JAVATEST_JAR=${JTHARNESS_DIST}/binaries/lib/javatest.jar
JTHARNESS_LICENSE=${JTHARNESS_SRC}/legal/license.txt
......@@ -169,17 +210,17 @@ 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 -
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 -
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 -
echo "${ASM_UTIL_JAR_CHECKSUM} ${ASM_UTIL_JAR}" | ${SHASUM} --check -
# Build jcov
JCOV_SRC_ZIP=${JCOV_BUILD_DIR}/source.zip
......@@ -193,16 +234,16 @@ 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} \
${ANT} -Dresult.dir=`native_path ${JCOV_DIST}` \
-Dasm.jar=`native_path ${ASM_JAR}` \
-Dasm.checksum=${ASM_JAR_CHECKSUM} \
-Dasm.tree.jar=`native_path ${ASM_TREE_JAR}` \
-Dasm.tree.checksum=${ASM_TREE_JAR_CHECKSUM} \
-Dasm.util.jar=${ASM_UTIL_JAR} \
-Dasm.util.jar=`native_path ${ASM_UTIL_JAR}` \
-Dasm.util.checksum=${ASM_UTIL_JAR_CHECKSUM} \
-Djavatestjar=${JAVATEST_JAR} \
-Dverify.strict= \
-f ${JCOV_SRC}/build/build.xml
-Djavatestjar=`native_path ${JAVATEST_JAR}` \
-Dverify.strict= \
-f `native_path ${JCOV_SRC}/build/build.xml`
)
JCOV_JAR=${JCOV_DIST}/jcov_3.0/jcov.jar
......@@ -244,26 +285,27 @@ echo "6375e521c1e11d6563d4f25a07ce124ccf8cd171 ${JCOMMANDER_JAR}" | ${SHASUM} -
## Set version and build numbers to the latest tagged version by default
TAG_INFO=`get_tag_info`
if [ -z ${BUILD_NUMBER:-} ]; then
BUILD_NUMBER=`hg tags | grep jtreg | head -1 | sed 's/jtreg\([0-9]\.[0-9]\)-\(b[0-9]*\).*/\2/'`
BUILD_NUMBER=`echo $TAG_INFO | 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/'`
BUILD_VERSION=`echo $TAG_INFO | sed 's/jtreg\([0-9]\.[0-9]\)-\(b[0-9]*\).*/\1/'`
fi
# Build jtreg
cd ${ROOT}/make
make JUNIT_JAR=${JUNIT_JAR} \
make JUNIT_JAR=`mixed_path ${JUNIT_JAR}` \
JUNIT_LICENSE=${JUNIT_LICENSE} \
TESTNG_JAR=${TESTNG_JAR} \
TESTNG_JAR=`mixed_path ${TESTNG_JAR}` \
TESTNG_LICENSE=${TESTNG_LICENSE} \
JCOMMANDER_JAR=${JCOMMANDER_JAR} \
ANT=${ANT} \
ANT_JAR=${ANT_JAR} \
ANT_JAR=`mixed_path ${ANT_JAR}` \
JCOV_JAR=${JCOV_JAR} \
JCOV_LICENSE=${JCOV_LICENSE} \
JCOV_NETWORK_SAVER_JAR=${JCOV_NETWORK_SAVER_JAR} \
JAVATEST_JAR=${JAVATEST_JAR} \
JAVATEST_JAR=`mixed_path ${JAVATEST_JAR}` \
JTHARNESS_LICENSE=${JTHARNESS_LICENSE} \
JTHARNESS_COPYRIGHT=${JTHARNESS_COPYRIGHT} \
ASMTOOLS_JAR=${ASMTOOLS_JAR} \
......@@ -273,4 +315,3 @@ make JUNIT_JAR=${JUNIT_JAR} \
BUILD_NUMBER=${BUILD_NUMBER} \
JDKHOME=$JAVA_HOME \
${MAKE_ARGS:-}
......@@ -26,15 +26,14 @@
<idea-plugin>
<id>jtreg</id>
<name>jtreg Test Support</name>
<version>1.9</version>
<version>1.10</version>
<description><![CDATA[
Allows execution of tests developed using the <a href="http://openjdk.java.net/jtreg/">jtreg</a> framework.
]]></description>
<change-notes><![CDATA[
<ul>
<li>Add support for IntelliJ IDE2018.3</li>
<li>Allow support for external library resolution</li>
<li>Add support for IntelliJ IDE2019.3</li>
</ul>
]]>
</change-notes>
......
......@@ -41,7 +41,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Alarm;
import com.intellij.util.containers.hash.HashMap;
import com.oracle.plugin.jtreg.util.JTRegUtils;
import org.jetbrains.annotations.NotNull;
......
......@@ -38,6 +38,7 @@ import com.intellij.execution.runners.ProgramRunner;
import com.intellij.execution.testframework.SearchForTestsTask;
import com.intellij.execution.testframework.TestSearchScope;
import com.intellij.execution.ui.DefaultJreSelector;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.projectRoots.JdkUtil;
import com.intellij.openapi.projectRoots.ProjectJdkTable;
import com.intellij.openapi.projectRoots.Sdk;
......@@ -150,7 +151,6 @@ class JTRegConfigurationRunnableState extends JavaTestFrameworkRunnableState<JTR
return javaParameters;
}
@Override
protected void configureRTClasspath(JavaParameters javaParameters) {
JTRegService jtregSettings = JTRegService.getInstance(getConfiguration().getProject());
javaParameters.getClassPath().add(jtregSettings.getJTRegDir() + "/lib/jtreg.jar");
......@@ -160,6 +160,10 @@ class JTRegConfigurationRunnableState extends JavaTestFrameworkRunnableState<JTR
javaParameters.getClassPath().add(jtregSettings.getJTRegDir() + "/lib/asmtools.jar");
}
protected void configureRTClasspath(JavaParameters javaParameters, Module module) throws CantRunException {
configureRTClasspath(javaParameters);
}
@Override
protected List<String> getNamedParams(String parameters) {
return Stream.of(parameters.split(" ")).collect(Collectors.toList());
......
......@@ -64,7 +64,7 @@
case "`uname -s`" in
CYGWIN* ) cygwin=1 ;;
Linux ) if grep -q Microsoft /proc/version ; then wsl=1 ; fi ;;
Linux ) if grep -qi Microsoft /proc/version ; then wsl=1 ; fi ;;
esac
......
......@@ -475,7 +475,7 @@ public class RegressionParameters
return matchListFilter;
}
TestFilter matchListFilter = UNSET;
private TestFilter matchListFilter = UNSET;
/**
* {@inheritDoc}
......@@ -545,6 +545,34 @@ public class RegressionParameters
private static KeywordsTestFilter UNSET_KEYWORDS_FILTER = new KeywordsTestFilter(UNSET);
@Override
public TestFilter getPriorStatusFilter() {
if (priorStatusFilter == UNSET) {
final TestFilter psf = super.getPriorStatusFilter();
if (psf == null) {
priorStatusFilter = null;
} else {
priorStatusFilter = new CachingTestFilter(
"jtregPriorStatusFilter",
"Select tests which match a specified status",
"Test did not match a specified status") {
@Override
protected String getCacheKey(TestDescription td) {
return td.getRootRelativeURL();
}
@Override
public boolean getCacheableValue(TestDescription td) throws Fault {
return psf.accepts(td);
}
};
}
}
return priorStatusFilter;
}
private CachingTestFilter priorStatusFilter = UNSET;
//---------------------------------------------------------------------
// The following (load and save) are an interim consequence of not using proper
......
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -200,37 +200,49 @@ public class RegressionTestFinder extends TagTestFinder
}
try {
cs.init(new BufferedReader(new FileReader(file)));
LineCounterBufferedReader r = new LineCounterBufferedReader(new FileReader(file));
cs.init(r);
if (super_fastScan)
cs.setFastScan(true);
String comment = cs.readComment();
int commentLine = r.lineNumber;
while (comment != null) {
@SuppressWarnings({"unchecked", "cast"}) // temporary, to cover transition generifying TestFinder
Map<String,String> tagValues = (Map<String,String>) parseComment(comment, file);
// Look ahead to see if there are more comments
comment = cs.readComment();
String nextComment = cs.readComment();
int nextCommentLine = r.lineNumber;
if (!tagValues.isEmpty()) {
if (tagValues.get("id") == null) {
// if there are more comments to come, or if there have already
// been additional comments, set an explicit id for each set of tags
if ((nextComment != null && nextComment.trim().startsWith("@test")) || testDescNumber != 0) {
String test = tagValues.get("test");
Matcher m;
String id = (test != null
&& (m = Pattern.compile("id=(?<id>[A-Za-z0-9-_]+)\\b.*").matcher(test)).matches())
? m.group("id")
: "id" + testDescNumber;
tagValues.put("id", id);
}
testDescNumber++;
}
if (tagValues.isEmpty())
continue;
// The "test" marker can now be removed so that we don't waste
// space unnecessarily. We need to do the remove *after* the
// isEmpty() check because of the potential to interfere with
// defaults based on file extension. (i.e. The TD /* @test */
// still needs to evaluate to a valid test description.)
tagValues.remove("test");
if (tagValues.get("id") == null) {
// if there are more comments to come, or if there have already
// been additional comments, set an explicit id for each set of tags
if ((comment != null && comment.trim().startsWith("@test")) || testDescNumber != 0)
tagValues.put("id", "id" + (new Integer(testDescNumber)).toString());
testDescNumber++;
foundTestDescription(tagValues, file, commentLine);
}
// The "test" marker can now be removed so that we don't waste
// space unnecessarily. We need to do the remove *after* the
// isEmpty() check because of the potential to interfere with
// defaults based on file extension. (i.e. The TD /* @test */
// still needs to evaluate to a valid test description.)
tagValues.remove("test");
foundTestDescription(tagValues, file, /*line*/0);
comment = nextComment;
commentLine = nextCommentLine;
}
}
catch (FileNotFoundException e) {
......@@ -248,6 +260,43 @@ public class RegressionTestFinder extends TagTestFinder
}
}
private class LineCounterBufferedReader extends BufferedReader {
int lineNumber;
LineCounterBufferedReader(FileReader r) {
super(r);
lineNumber = 1;
}
@Override
public int read() throws IOException {
int ch = super.read();
checkNewline(ch);
return ch;
}
@Override
public String readLine() throws IOException {
String line = super.readLine();
lineNumber++;
return line;
}
@Override
public int read(char[] buf, int offset, int length) throws IOException {
int n = super.read(buf, offset, length);
for (int i = offset; i < offset + n; i++) {
checkNewline(buf[i]);
}
return n;
}
private void checkNewline(int ch) {
if (ch == '\n') {
lineNumber++;
}
}
}
protected void scanTestNGFile(File tngRoot, File file) throws TestSuite.Fault {
Map<String,String> tagValues;
if (isTestNGTest(file)) {
......@@ -771,7 +820,7 @@ public class RegressionTestFinder extends TagTestFinder
/**
* Verify that the provided set of keys are allowed for the current
* test-suite. The set of keys is stored in the system property
* <code>env.regtest.key</code>.
* {@code env.regtest.key}.
*
* @param tagValues The map of all of the current tag values.
* @param value The value of the entry currently being processed.
......
......@@ -280,7 +280,7 @@ public class TestProperties {
}
private int getInt(String propertyName, int defaultValue) {
String v = properties.getProperty("maxOutputSize");
String v = properties.getProperty(propertyName);
try {
if (v != null) {
return Integer.parseInt(v.trim());
......
#
# Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......
/*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -355,6 +355,12 @@ public class CompileAction extends Action {
status = jcod(jcodArgs);
if (status.isPassed() && runJavac) {
javacArgs = getJavacCommandArgs(javacArgs);
for (String arg: javacArgs) {
if (arg.startsWith("-J")) {
othervmOverrideReasons.add("JVM options specified for compiler");
break;
}
}
if (explicitAnnotationProcessingRequested(javacArgs)
&& !getExtraModuleConfigOptions(Modules.Phase.DYNAMIC).isEmpty()) {
othervmOverrideReasons.add("additional runtime exports needed for annotation processing");
......@@ -554,8 +560,13 @@ public class CompileAction extends Action {
File argFile = getArgFile();
try (BufferedWriter w = new BufferedWriter(new FileWriter(argFile))) {
for (String arg: javacArgs) {
w.write(arg);
w.newLine();
if (arg.startsWith("-J")) {
// remove -J for now; it will be added back later
javacVMOpts.add(arg.substring(2));
} else {
w.write(arg);
w.newLine();
}
}
} catch (IOException e) {
return error(COMPILE_CANT_WRITE_ARGS);
......
......@@ -299,8 +299,10 @@ public class RegressionScript extends Script {
}
if (errmsg != null) {
msgPW.println(errmsg);
msgPW.println("Test result (overridden): " + status);
status = error("failed to clean up files after test");
msgPW.println("WARNING: failed to clean up files after test");
if (!agents.isEmpty()) {
msgPW.println("WARNING: closing agent(s)");
}
closeAgents();
}
}
......@@ -379,6 +381,7 @@ public class RegressionScript extends Script {
populateActionTable();
Expr.Context exprContext = params.getExprContext();
Map<String,String> testProps = getTestProperties();
for (String runCmd : runCmds) {
// e.g. reason compile/fail/ref=Foo.ref -debug Foo.java
// where "reason" indicates why the action should run
......@@ -406,7 +409,7 @@ public class RegressionScript extends Script {
continue;
}
Action action = (Action) (c.getDeclaredConstructor().newInstance());
action.init(opts, processArgs(args, exprContext), getReason(tokens), this);
action.init(opts, processArgs(args, exprContext, testProps), getReason(tokens), this);
actionList.add(action);
} catch (IllegalAccessException e) {
if (stopOnError)
......@@ -421,7 +424,8 @@ public class RegressionScript extends Script {
}
private List<String> processArgs(List<String> args, Expr.Context c) throws TestSuite.Fault, Expr.Fault {
private List<String> processArgs(List<String> args, Expr.Context c, Map<String,String> testProps)
throws TestSuite.Fault, Expr.Fault, ParseException {
if (!testSuite.getAllowSmartActionArgs(td))
return args;
......@@ -434,21 +438,27 @@ public class RegressionScript extends Script {
}
List<String> newArgs = new ArrayList<>();
for (String arg : args) {
newArgs.add(evalNames(arg, c));
newArgs.add(evalNames(arg, c, testProps));
}
return newArgs;
}
private static final Pattern namePattern = Pattern.compile("\\$\\{([A-Za-z0-9._]+)\\}");
private static String evalNames(String arg, Expr.Context c) throws Expr.Fault {
private static String evalNames(String arg, Expr.Context c, Map<String,String> testProps)
throws Expr.Fault, ParseException {
Matcher m = namePattern.matcher(arg);
StringBuffer sb = null;
while (m.find()) {
if (sb == null) {
sb = new StringBuffer();
}
m.appendReplacement(sb, c.get(m.group(1)));
String name = m.group(1);
String value = testProps.containsKey(name) ? testProps.get(name) : c.get(name);
if ("null".equals(value)) {
throw new ParseException("unset property " + name);
}
m.appendReplacement(sb, value);
}
if (sb == null) {
return arg;
......@@ -1077,7 +1087,7 @@ public class RegressionScript extends Script {
// Get the standard properties to be set for tests
Map<String, String> getTestProperties() throws TestClassException {
Map<String, String> getTestProperties() {
Map<String, String> p = new LinkedHashMap<>();
// The following will be added to javac.class.path on the test JVM
switch (getExecMode()) {
......
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -230,27 +230,44 @@ abstract class ScratchDirectory {
return ok;
}
boolean delete(File f, Set<File> cantDelete, PrintWriter log) {
if (f.delete()) {
private boolean delete(File f, Set<File> cantDelete, PrintWriter log) {
// optimistically assume the enclosing directory is writable
if (f.delete() && !f.exists()) {
cantDelete.remove(f);
return true;
} else {
// // See CODETOOLS-7901369
// // The following needs JDK 1.6, and/or convert jtreg to use nio.file.Path
// if (!f.canWrite()) {
// if (f.setWritable(true) && f.delete()) {
// cantDelete.remove(f);
// return true;
// }
// }
if (verboseScratchDir) {
log.println("warning: failed to delete "
+ (f.isDirectory() ? "directory " : "")
+ f);
}
cantDelete.add(f);
return false;
}
// retry if the enclosing directory was not writable and can be made writable
File dir = f.getParentFile();
if (dir != null && !dir.canWrite() && setWritable(dir, log)) {
return delete(f, cantDelete, log);
}
if (verboseScratchDir) {
log.println("warning: failed to delete "
+ (f.isDirectory() ? "directory " : "")
+ f);
}
cantDelete.add(f);
return false;
}
private boolean setWritable(File dir, PrintWriter log) {
// optimistically assume the enclosing directory is writable
if (dir.setWritable(true)) {
return true;
}
// retry if the enclosing directory was not writable and can be made writable
File parent = dir.getParentFile();
if (parent != null && !parent.canWrite() && setWritable(parent, log)) {
return setWritable(dir, log);
}
if (verboseScratchDir) {
log.println("warning: failed to set directory writable: " + dir);
}
return false;
}
// </editor-fold>
......