-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
7903373: Add ability to customize test execution using main wrapper plugin #136
Conversation
src/share/classes/com/sun/javatest/regtest/agent/TestThreadFactory.java
Outdated
Show resolved
Hide resolved
src/share/classes/com/sun/javatest/regtest/agent/TestThreadFactory.java
Outdated
Show resolved
Hide resolved
@@ -171,6 +171,12 @@ help.main.ignore.error.desc=(Default.) Execute the actions up to the @ignore tag | |||
then give an "Error" result. | |||
help.main.ignore.run.desc=Run the test, as though the @ignore tag were not present. | |||
help.main.l.desc=List the tests that would be executed instead of executing them. | |||
help.main.ttf.arg=<classname> | |||
help.main.ttf.desc=Specifies the class to create thread factory for test execution. \ | |||
The class should implement a j.u.c.TestFactory interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change "a" to "the" and spell out j.u.c
in full
@lmesnik this pull request can not be integrated into git checkout loom
git fetch https://git.openjdk.org/jtreg master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
static ThreadFactory loadThreadFactory(String className, String path) { | ||
ClassLoader loader = ClassLoader.getSystemClassLoader(); | ||
if (path != null) { | ||
SearchPath classpath = new SearchPath(path); | ||
List<URL> urls = new ArrayList<>(); | ||
for (Path f : classpath.asList()) { | ||
try { | ||
urls.add(f.toUri().toURL()); | ||
} catch (MalformedURLException e) { | ||
} | ||
} | ||
loader = new URLClassLoader(urls.toArray(new URL[urls.size()]), loader); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the othervm
case, this code will presumably just be called once, but in the agentvm
case, won't it be called once per test, and since the class loader is never closed, (see URLCLassLoader.close) won't that lead to a leak of any resources that might be involved ... especially any zip/jar files that might be opened?
Is it not worth trying to cache and reuse the loader?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the code to close the classloader. The jtreg doesn't have now any embedded implementations so path never could be null, I suppose.
@lmesnik This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@jonathan-gibbons) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
/sponsor |
Going to push as commit 5b9e661. |
@jonathan-gibbons @lmesnik Pushed as commit 5b9e661. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The fix adds support of a plugin that customizes test execution.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jtreg pull/136/head:pull/136
$ git checkout pull/136
Update a local copy of the PR:
$ git checkout pull/136
$ git pull https://git.openjdk.org/jtreg pull/136/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 136
View PR using the GUI difftool:
$ git pr show -t 136
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jtreg/pull/136.diff