On Fri, 14 Oct 2022 15:50:30 GMT, Bill Huang <bhu...@openjdk.org> wrote:
>> test/jdk/java/security/Policy/Root/Root.java line 48: >> >>> 46: private static final Path TARGET = Paths.get(ROOT, ".java.policy"); >>> 47: public static void main(String[] args) throws Exception { >>> 48: Files.copy(SOURCE, TARGET, StandardCopyOption.REPLACE_EXISTING); >> >> Could you please use the testng framework for initial setup of test. > > This is a @driver test that copies the Root.policy file to the home directory > before running the RootTest in a new JVM. The reason is that upon the start > of the new JVM it loads the default system-wide policy file and the default > user policy file which is the Root.policy we just copied. With the testng > framework, there is no way to load the custom user policy file without > reinstalling the security manager in the test, that said, it doesn't match > what the manual test does. Discussed with Mahendra offline, testng framework `@BeforeTest` performs test setup in the client JVM before test starts in the other JVM. We can use testng framework in this case to handle the policy file operations. ------------- PR: https://git.openjdk.org/jdk/pull/10637