From david.holmes at oracle.com Sat Mar 10 04:16:09 2018 From: david.holmes at oracle.com (David Holmes) Date: Sat, 10 Mar 2018 14:16:09 +1000 Subject: Running with a security manager? Message-ID: I want to run a test with a default security manager present. So I added it to the @run: @run main/othervm -Djava.security.manager TestReflectionAPI But this breaks jtreg: Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "/export/users/dh198349/valhalla/repos/valhalla-exp/open/test/hotspot/jtreg/JTwork/runtime/Nestmates/reflectionAPI/TestReflectionAPI.d/main.2.jta" "read") at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) at java.base/java.security.AccessController.checkPermission(AccessController.java:895) at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:335) at java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:674) at java.base/java.io.FileInputStream.(FileInputStream.java:147) at java.base/java.io.FileInputStream.(FileInputStream.java:113) at java.base/java.io.FileReader.(FileReader.java:58) at com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:46) So I presume I need some kind of policy file that gives jtreg necessary permissions while trying to leave the actual test code with the normal default permissions. How do I do that? Thanks, David From jini at zeus.net.au Sat Mar 10 05:55:32 2018 From: jini at zeus.net.au (Peter) Date: Sat, 10 Mar 2018 15:55:32 +1000 Subject: Running with a security manager? In-Reply-To: References: Message-ID: <5AA37354.4080200@zeus.net.au> @run main/othervm/policy=policy/secure=java.lang.SecurityManager TestReflectionAPI Then create a policy file named policy. Cheers, Peter. On 10/03/2018 2:16 PM, David Holmes wrote: > I want to run a test with a default security manager present. So I > added it to the @run: > > @run main/othervm -Djava.security.manager TestReflectionAPI > > But this breaks jtreg: > > Exception in thread "main" java.security.AccessControlException: > access denied ("java.io.FilePermission" > "/export/users/dh198349/valhalla/repos/valhalla-exp/open/test/hotspot/jtreg/JTwork/runtime/Nestmates/reflectionAPI/TestReflectionAPI.d/main.2.jta" > "read") > at > java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) > at > java.base/java.security.AccessController.checkPermission(AccessController.java:895) > at > java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:335) > at > java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:674) > at java.base/java.io.FileInputStream.(FileInputStream.java:147) > at java.base/java.io.FileInputStream.(FileInputStream.java:113) > at java.base/java.io.FileReader.(FileReader.java:58) > at > com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:46) > > So I presume I need some kind of policy file that gives jtreg > necessary permissions while trying to leave the actual test code with > the normal default permissions. > > How do I do that? > > Thanks, > David > From jini at zeus.net.au Sat Mar 10 06:03:41 2018 From: jini at zeus.net.au (Peter) Date: Sat, 10 Mar 2018 16:03:41 +1000 Subject: Running with a security manager? In-Reply-To: References: Message-ID: <5AA3753D.4070600@zeus.net.au> This security manager creates a policy file, which you can then edit: https://github.com/pfirmstone/JGDMS/blob/trunk/JGDMS/tools/security-policy-debug/src/main/java/org/apache/river/tool/SecurityPolicyWriter.java Regards, Peter. On 10/03/2018 2:16 PM, David Holmes wrote: > I want to run a test with a default security manager present. So I > added it to the @run: > > @run main/othervm -Djava.security.manager TestReflectionAPI > > But this breaks jtreg: > > Exception in thread "main" java.security.AccessControlException: > access denied ("java.io.FilePermission" > "/export/users/dh198349/valhalla/repos/valhalla-exp/open/test/hotspot/jtreg/JTwork/runtime/Nestmates/reflectionAPI/TestReflectionAPI.d/main.2.jta" > "read") > at > java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) > at > java.base/java.security.AccessController.checkPermission(AccessController.java:895) > at > java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:335) > at > java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:674) > at java.base/java.io.FileInputStream.(FileInputStream.java:147) > at java.base/java.io.FileInputStream.(FileInputStream.java:113) > at java.base/java.io.FileReader.(FileReader.java:58) > at > com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:46) > > So I presume I need some kind of policy file that gives jtreg > necessary permissions while trying to leave the actual test code with > the normal default permissions. > > How do I do that? > > Thanks, > David > From mandy.chung at oracle.com Sat Mar 10 06:37:12 2018 From: mandy.chung at oracle.com (mandy chung) Date: Fri, 9 Mar 2018 22:37:12 -0800 Subject: Running with a security manager? In-Reply-To: References: Message-ID: <2457bca2-d89a-f86f-bf54-3b3cd638a34b@oracle.com> If you need to grant permission, you can do this: * @run main/othervm/java.security.policy= TestReflectionAPI If no policy needed, you can set security manager (System::setSecurityManager) at the beginning of the test and run in othervm mode: * @run main/othervm TestReflectionAPI Mandy On 3/9/18 8:16 PM, David Holmes wrote: > I want to run a test with a default security manager present. So I > added it to the @run: > > @run main/othervm -Djava.security.manager TestReflectionAPI > > But this breaks jtreg: > > Exception in thread "main" java.security.AccessControlException: > access denied ("java.io.FilePermission" > "/export/users/dh198349/valhalla/repos/valhalla-exp/open/test/hotspot/jtreg/JTwork/runtime/Nestmates/reflectionAPI/TestReflectionAPI.d/main.2.jta" > "read") > ????at > java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) > ????at > java.base/java.security.AccessController.checkPermission(AccessController.java:895) > ????at > java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:335) > ????at > java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:674) > ????at java.base/java.io.FileInputStream.(FileInputStream.java:147) > ????at java.base/java.io.FileInputStream.(FileInputStream.java:113) > ????at java.base/java.io.FileReader.(FileReader.java:58) > ????at > com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:46) > > So I presume I need some kind of policy file that gives jtreg > necessary permissions while trying to leave the actual test code with > the normal default permissions. > > How do I do that? > > Thanks, > David -------------- next part -------------- An HTML attachment was scrubbed... URL: From weijun.wang at oracle.com Sat Mar 10 08:10:57 2018 From: weijun.wang at oracle.com (Weijun Wang) Date: Sat, 10 Mar 2018 16:10:57 +0800 Subject: Running with a security manager? In-Reply-To: <2457bca2-d89a-f86f-bf54-3b3cd638a34b@oracle.com> References: <2457bca2-d89a-f86f-bf54-3b3cd638a34b@oracle.com> Message-ID: <7543FFCE-5FEE-46BE-824A-97F000F3ED14@oracle.com> Or you can set policy to an empty file (maybe with a comment line). Unfortunately both secure and policy must have an argument. --Max > On Mar 10, 2018, at 2:37 PM, mandy chung wrote: > > If you need to grant permission, you can do this: > > * @run main/othervm/java.security.policy= TestReflectionAPI > > If no policy needed, you can set security manager (System::setSecurityManager) at the beginning of the test and run in othervm mode: > * @run main/othervm TestReflectionAPI > > Mandy > > On 3/9/18 8:16 PM, David Holmes wrote: >> I want to run a test with a default security manager present. So I added it to the @run: >> >> @run main/othervm -Djava.security.manager TestReflectionAPI >> >> But this breaks jtreg: >> >> Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "/export/users/dh198349/valhalla/repos/valhalla-exp/open/test/hotspot/jtreg/JTwork/runtime/Nestmates/reflectionAPI/TestReflectionAPI.d/main.2.jta" "read") >> at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) >> at java.base/java.security.AccessController.checkPermission(AccessController.java:895) >> at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:335) >> at java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:674) >> at java.base/java.io.FileInputStream.(FileInputStream.java:147) >> at java.base/java.io.FileInputStream.(FileInputStream.java:113) >> at java.base/java.io.FileReader.(FileReader.java:58) >> at com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:46) >> >> So I presume I need some kind of policy file that gives jtreg necessary permissions while trying to leave the actual test code with the normal default permissions. >> >> How do I do that? >> >> Thanks, >> David > From david.holmes at oracle.com Sat Mar 10 11:03:05 2018 From: david.holmes at oracle.com (David Holmes) Date: Sat, 10 Mar 2018 21:03:05 +1000 Subject: Running with a security manager? In-Reply-To: <7543FFCE-5FEE-46BE-824A-97F000F3ED14@oracle.com> References: <2457bca2-d89a-f86f-bf54-3b3cd638a34b@oracle.com> <7543FFCE-5FEE-46BE-824A-97F000F3ED14@oracle.com> Message-ID: Thanks for all the responses. On 10/03/2018 6:10 PM, Weijun Wang wrote: > Or you can set policy to an empty file (maybe with a comment line). Unfortunately both secure and policy must have an argument. Right. My issue is what policy do I have to set to make jtreg itself work, regardless of what the test may or may not need? This seems to be a problem to me - I don't know what permissions jtreg requires be added to any policy. Mandy's suggestion of just setting the security manager within the test may be the way to go. Thanks, David > --Max > >> On Mar 10, 2018, at 2:37 PM, mandy chung wrote: >> >> If you need to grant permission, you can do this: >> >> * @run main/othervm/java.security.policy= TestReflectionAPI >> >> If no policy needed, you can set security manager (System::setSecurityManager) at the beginning of the test and run in othervm mode: >> * @run main/othervm TestReflectionAPI >> >> Mandy >> >> On 3/9/18 8:16 PM, David Holmes wrote: >>> I want to run a test with a default security manager present. So I added it to the @run: >>> >>> @run main/othervm -Djava.security.manager TestReflectionAPI >>> >>> But this breaks jtreg: >>> >>> Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "/export/users/dh198349/valhalla/repos/valhalla-exp/open/test/hotspot/jtreg/JTwork/runtime/Nestmates/reflectionAPI/TestReflectionAPI.d/main.2.jta" "read") >>> at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) >>> at java.base/java.security.AccessController.checkPermission(AccessController.java:895) >>> at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:335) >>> at java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:674) >>> at java.base/java.io.FileInputStream.(FileInputStream.java:147) >>> at java.base/java.io.FileInputStream.(FileInputStream.java:113) >>> at java.base/java.io.FileReader.(FileReader.java:58) >>> at com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:46) >>> >>> So I presume I need some kind of policy file that gives jtreg necessary permissions while trying to leave the actual test code with the normal default permissions. >>> >>> How do I do that? >>> >>> Thanks, >>> David >> > From david.holmes at oracle.com Sat Mar 10 11:06:54 2018 From: david.holmes at oracle.com (David Holmes) Date: Sat, 10 Mar 2018 21:06:54 +1000 Subject: Running with a security manager? In-Reply-To: References: <2457bca2-d89a-f86f-bf54-3b3cd638a34b@oracle.com> <7543FFCE-5FEE-46BE-824A-97F000F3ED14@oracle.com> Message-ID: <8fafb2a2-fa66-d237-ed1a-6bf8a7a7350e@oracle.com> On 10/03/2018 9:03 PM, David Holmes wrote: > Thanks for all the responses. > > On 10/03/2018 6:10 PM, Weijun Wang wrote: >> Or you can set policy to an empty file (maybe with a comment line). >> Unfortunately both secure and policy must have an argument. > > Right. My issue is what policy do I have to set to make jtreg itself > work, regardless of what the test may or may not need? This seems to be > a problem to me - I don't know what permissions jtreg requires be added > to any policy. > > Mandy's suggestion of just setting the security manager within the test > may be the way to go. No that requires I have a security manager to pass in. I just want to enable the default security manager! This should not be that hard to do! :( David > Thanks, > David > >> --Max >> >>> On Mar 10, 2018, at 2:37 PM, mandy chung wrote: >>> >>> If you need to grant permission, you can do this: >>> >>> * @run main/othervm/java.security.policy= TestReflectionAPI >>> >>> If no policy needed, you can set security manager >>> (System::setSecurityManager) at the beginning of the test and run in >>> othervm mode: >>> * @run main/othervm TestReflectionAPI >>> >>> Mandy >>> >>> On 3/9/18 8:16 PM, David Holmes wrote: >>>> I want to run a test with a default security manager present. So I >>>> added it to the @run: >>>> >>>> @run main/othervm -Djava.security.manager TestReflectionAPI >>>> >>>> But this breaks jtreg: >>>> >>>> Exception in thread "main" java.security.AccessControlException: >>>> access denied ("java.io.FilePermission" >>>> "/export/users/dh198349/valhalla/repos/valhalla-exp/open/test/hotspot/jtreg/JTwork/runtime/Nestmates/reflectionAPI/TestReflectionAPI.d/main.2.jta" >>>> "read") >>>> ???? at >>>> java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) >>>> >>>> ???? at >>>> java.base/java.security.AccessController.checkPermission(AccessController.java:895) >>>> >>>> ???? at >>>> java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:335) >>>> >>>> ???? at >>>> java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:674) >>>> ???? at >>>> java.base/java.io.FileInputStream.(FileInputStream.java:147) >>>> ???? at >>>> java.base/java.io.FileInputStream.(FileInputStream.java:113) >>>> ???? at java.base/java.io.FileReader.(FileReader.java:58) >>>> ???? at >>>> com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:46) >>>> >>>> So I presume I need some kind of policy file that gives jtreg >>>> necessary permissions while trying to leave the actual test code >>>> with the normal default permissions. >>>> >>>> How do I do that? >>>> >>>> Thanks, >>>> David >>> >> From weijun.wang at oracle.com Sat Mar 10 12:43:35 2018 From: weijun.wang at oracle.com (Weijun Wang) Date: Sat, 10 Mar 2018 20:43:35 +0800 Subject: Running with a security manager? In-Reply-To: <8fafb2a2-fa66-d237-ed1a-6bf8a7a7350e@oracle.com> References: <2457bca2-d89a-f86f-bf54-3b3cd638a34b@oracle.com> <7543FFCE-5FEE-46BE-824A-97F000F3ED14@oracle.com> <8fafb2a2-fa66-d237-ed1a-6bf8a7a7350e@oracle.com> Message-ID: If you set policy or secure in the @run line then jtreg will automatically add necessary permissions to your existing policy file to make it running. --Max > On Mar 10, 2018, at 7:06 PM, David Holmes wrote: > > On 10/03/2018 9:03 PM, David Holmes wrote: >> Thanks for all the responses. >> On 10/03/2018 6:10 PM, Weijun Wang wrote: >>> Or you can set policy to an empty file (maybe with a comment line). Unfortunately both secure and policy must have an argument. >> Right. My issue is what policy do I have to set to make jtreg itself work, regardless of what the test may or may not need? This seems to be a problem to me - I don't know what permissions jtreg requires be added to any policy. >> Mandy's suggestion of just setting the security manager within the test may be the way to go. > > No that requires I have a security manager to pass in. I just want to enable the default security manager! This should not be that hard to do! :( > > David > >> Thanks, >> David >>> --Max >>> >>>> On Mar 10, 2018, at 2:37 PM, mandy chung wrote: >>>> >>>> If you need to grant permission, you can do this: >>>> >>>> * @run main/othervm/java.security.policy= TestReflectionAPI >>>> >>>> If no policy needed, you can set security manager (System::setSecurityManager) at the beginning of the test and run in othervm mode: >>>> * @run main/othervm TestReflectionAPI >>>> >>>> Mandy >>>> >>>> On 3/9/18 8:16 PM, David Holmes wrote: >>>>> I want to run a test with a default security manager present. So I added it to the @run: >>>>> >>>>> @run main/othervm -Djava.security.manager TestReflectionAPI >>>>> >>>>> But this breaks jtreg: >>>>> >>>>> Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "/export/users/dh198349/valhalla/repos/valhalla-exp/open/test/hotspot/jtreg/JTwork/runtime/Nestmates/reflectionAPI/TestReflectionAPI.d/main.2.jta" "read") >>>>> at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) >>>>> at java.base/java.security.AccessController.checkPermission(AccessController.java:895) >>>>> at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:335) >>>>> at java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:674) >>>>> at java.base/java.io.FileInputStream.(FileInputStream.java:147) >>>>> at java.base/java.io.FileInputStream.(FileInputStream.java:113) >>>>> at java.base/java.io.FileReader.(FileReader.java:58) >>>>> at com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:46) >>>>> >>>>> So I presume I need some kind of policy file that gives jtreg necessary permissions while trying to leave the actual test code with the normal default permissions. >>>>> >>>>> How do I do that? >>>>> >>>>> Thanks, >>>>> David >>>> >>> From david.holmes at oracle.com Sun Mar 11 22:44:21 2018 From: david.holmes at oracle.com (David Holmes) Date: Mon, 12 Mar 2018 08:44:21 +1000 Subject: Running with a security manager? In-Reply-To: References: <2457bca2-d89a-f86f-bf54-3b3cd638a34b@oracle.com> <7543FFCE-5FEE-46BE-824A-97F000F3ED14@oracle.com> <8fafb2a2-fa66-d237-ed1a-6bf8a7a7350e@oracle.com> Message-ID: <4544b8d7-4ea1-7380-1728-6f91043acc52@oracle.com> On 10/03/2018 10:43 PM, Weijun Wang wrote: > If you set policy or secure in the @run line then jtreg will automatically add necessary permissions to your existing policy file to make it running. I tried this for secure (which still fails) and then checked the jtreg code - it only does that for policy: if (policyFN != null) { // add permission to read JTwork/classes by adding a grant entry newPolicyFN = addGrantEntry(policyFN); javaProps.put("java.security.policy", overrideSysPolicy ? "=" + newPolicyFN : newPolicyFN); } if (secureCN != null) { javaProps.put("java.security.manager", secureCN); } else if (policyFN != null) { javaProps.put("java.security.manager", "default"); } So I simply defined an empty policy file and set /policy=empty.policy and that appeared to achieve what I wanted. But on further study of the options code is seems the above replaces the system policy, which isn't really what I wanted. There an undocumented /java.security.policy option which allows for overriding the system policy or combining with them. If you specify: /java.security.policy=my.policy then overrideSysPolicy remains false and the policies presumably combine. Whereas if you specify: /java.security.policy==my.policy then overrideSysPolicy is set true and my.policy will be the only policy. This mirrors the behaviour of the java.security.policy property. I use the former so that my empty policy, augmented with the permissions jtreg added for itself, is then combined with the system default policy. Thanks, David > --Max > >> On Mar 10, 2018, at 7:06 PM, David Holmes wrote: >> >> On 10/03/2018 9:03 PM, David Holmes wrote: >>> Thanks for all the responses. >>> On 10/03/2018 6:10 PM, Weijun Wang wrote: >>>> Or you can set policy to an empty file (maybe with a comment line). Unfortunately both secure and policy must have an argument. >>> Right. My issue is what policy do I have to set to make jtreg itself work, regardless of what the test may or may not need? This seems to be a problem to me - I don't know what permissions jtreg requires be added to any policy. >>> Mandy's suggestion of just setting the security manager within the test may be the way to go. >> >> No that requires I have a security manager to pass in. I just want to enable the default security manager! This should not be that hard to do! :( >> >> David >> >>> Thanks, >>> David >>>> --Max >>>> >>>>> On Mar 10, 2018, at 2:37 PM, mandy chung wrote: >>>>> >>>>> If you need to grant permission, you can do this: >>>>> >>>>> * @run main/othervm/java.security.policy= TestReflectionAPI >>>>> >>>>> If no policy needed, you can set security manager (System::setSecurityManager) at the beginning of the test and run in othervm mode: >>>>> * @run main/othervm TestReflectionAPI >>>>> >>>>> Mandy >>>>> >>>>> On 3/9/18 8:16 PM, David Holmes wrote: >>>>>> I want to run a test with a default security manager present. So I added it to the @run: >>>>>> >>>>>> @run main/othervm -Djava.security.manager TestReflectionAPI >>>>>> >>>>>> But this breaks jtreg: >>>>>> >>>>>> Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "/export/users/dh198349/valhalla/repos/valhalla-exp/open/test/hotspot/jtreg/JTwork/runtime/Nestmates/reflectionAPI/TestReflectionAPI.d/main.2.jta" "read") >>>>>> at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) >>>>>> at java.base/java.security.AccessController.checkPermission(AccessController.java:895) >>>>>> at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:335) >>>>>> at java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:674) >>>>>> at java.base/java.io.FileInputStream.(FileInputStream.java:147) >>>>>> at java.base/java.io.FileInputStream.(FileInputStream.java:113) >>>>>> at java.base/java.io.FileReader.(FileReader.java:58) >>>>>> at com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:46) >>>>>> >>>>>> So I presume I need some kind of policy file that gives jtreg necessary permissions while trying to leave the actual test code with the normal default permissions. >>>>>> >>>>>> How do I do that? >>>>>> >>>>>> Thanks, >>>>>> David >>>>> >>>> > From thomas.stuefe at gmail.com Tue Mar 13 11:35:04 2018 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Tue, 13 Mar 2018 12:35:04 +0100 Subject: How do I pass javatest.maxOutputSize to jtreg tests? Message-ID: Hi, I attempt to analyse a jtreg test which unfortunately does not work as a stand alone test class. I activate logging with -javaoptions:-Xlog:gc+metaspace+freelist=trace and I see my logging, but it it truncated: 418 [0.743s][trace][gc,metaspace,freelist] Free chunk total 0 count 0 419 [0.743s][trace][gc,metaspace,freelist 420 421 ... 422 Output overflow: 423 JT Harness has limited the test output to the text to that 424 at the beginning and the end, so that you can see how the 425 test began, and how it completed. 426 427 If you need to see more of the output from the test, 428 set the system property javatest.maxOutputSize to a higher 429 value. The current value is 100000 430 ... 431 432 00007c2aea400 top 0x00000007c2aea430 end 0x00000007c2aeac00 size 256 433 [203.798s][trace][gc,metaspace,freelist] Free chunk total 16247552 count 41237 4 So, I attempt to set -Djavatest.maxOutputSize to a higher value but whatever form I do it in it does not change the output. Variants I tested are: jtreg ... -javaoptions:-Xlog:gc+metaspace+freelist=trace -javaoptions:-Djavatest.maxOutputSize=2000000 ... jtreg ... "-javaoptions:-Xlog:gc+metaspace+freelist=trace -Djavatest.maxOutputSize=2000000" ... jtreg ... -javaoptions:-Xlog:gc+metaspace+freelist=trace -Djavatest.maxOutputSize=2000000 ... What am I doing wrong? Thanks! Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.holmes at oracle.com Tue Mar 13 13:21:01 2018 From: david.holmes at oracle.com (David Holmes) Date: Tue, 13 Mar 2018 23:21:01 +1000 Subject: How do I pass javatest.maxOutputSize to jtreg tests? In-Reply-To: References: Message-ID: <830ae79a-040c-2c4a-9e56-d86b49fa918e@oracle.com> Hi Thomas, On 13/03/2018 9:35 PM, Thomas St?fe wrote: > Hi, > > I attempt to analyse a jtreg test which unfortunately does not work as a > stand alone test class. I activate logging with > > -javaoptions:-Xlog:gc+metaspace+freelist=trace > > and I see my logging, but it it truncated: > > 418 [0.743s][trace][gc,metaspace,freelist] Free chunk total 0? count 0 > 419 [0.743s][trace][gc,metaspace,freelist > 420 > 421 ... > 422 Output overflow: > 423 JT Harness has limited the test output to the text to that > 424 at the beginning and the end, so that you can see how the > 425 test began, and how it completed. > 426 > 427 If you need to see more of the output from the test, > 428 set the system property javatest.maxOutputSize to a higher > 429 value. The current value is 100000 > 430 ... > 431 > 432 00007c2aea400 top 0x00000007c2aea430 end 0x00000007c2aeac00 size 256 > 433 [203.798s][trace][gc,metaspace,freelist] Free chunk total 16247552 > count 41237 > 4 > > So, I attempt to set -Djavatest.maxOutputSize to a higher value but > whatever form I do it in it does not change the output. Variants I > tested are: > > jtreg ... -javaoptions:-Xlog:gc+metaspace+freelist=trace > -javaoptions:-Djavatest.maxOutputSize=2000000 ... > > jtreg ... ?"-javaoptions:-Xlog:gc+metaspace+freelist=trace > -Djavatest.maxOutputSize=2000000" ... > > jtreg ... -javaoptions:-Xlog:gc+metaspace+freelist=trace > -Djavatest.maxOutputSize=2000000 ... > > What am I doing wrong? Try passing directly to jtreg: jtreg -Djavatest.maxOutputSize=2000000 ... David > Thanks! Thomas > > From thomas.stuefe at gmail.com Tue Mar 13 13:26:06 2018 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Tue, 13 Mar 2018 14:26:06 +0100 Subject: How do I pass javatest.maxOutputSize to jtreg tests? In-Reply-To: <830ae79a-040c-2c4a-9e56-d86b49fa918e@oracle.com> References: <830ae79a-040c-2c4a-9e56-d86b49fa918e@oracle.com> Message-ID: Thanks David. I think I tried that but it did not work. I will retry. ..Thomas On Tue, Mar 13, 2018 at 2:21 PM, David Holmes wrote: > Hi Thomas, > > > On 13/03/2018 9:35 PM, Thomas St?fe wrote: > >> Hi, >> >> I attempt to analyse a jtreg test which unfortunately does not work as a >> stand alone test class. I activate logging with >> >> -javaoptions:-Xlog:gc+metaspace+freelist=trace >> >> and I see my logging, but it it truncated: >> >> 418 [0.743s][trace][gc,metaspace,freelist] Free chunk total 0 count 0 >> 419 [0.743s][trace][gc,metaspace,freelist >> 420 >> 421 ... >> 422 Output overflow: >> 423 JT Harness has limited the test output to the text to that >> 424 at the beginning and the end, so that you can see how the >> 425 test began, and how it completed. >> 426 >> 427 If you need to see more of the output from the test, >> 428 set the system property javatest.maxOutputSize to a higher >> 429 value. The current value is 100000 >> 430 ... >> 431 >> 432 00007c2aea400 top 0x00000007c2aea430 end 0x00000007c2aeac00 size 256 >> 433 [203.798s][trace][gc,metaspace,freelist] Free chunk total 16247552 >> count 41237 >> 4 >> >> So, I attempt to set -Djavatest.maxOutputSize to a higher value but >> whatever form I do it in it does not change the output. Variants I tested >> are: >> >> jtreg ... -javaoptions:-Xlog:gc+metaspace+freelist=trace >> -javaoptions:-Djavatest.maxOutputSize=2000000 ... >> >> jtreg ... "-javaoptions:-Xlog:gc+metaspace+freelist=trace >> -Djavatest.maxOutputSize=2000000" ... >> >> jtreg ... -javaoptions:-Xlog:gc+metaspace+freelist=trace >> -Djavatest.maxOutputSize=2000000 ... >> >> What am I doing wrong? >> > > Try passing directly to jtreg: > > jtreg -Djavatest.maxOutputSize=2000000 ... > > David > > Thanks! Thomas >> >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonathan.gibbons at oracle.com Tue Mar 13 15:24:46 2018 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Tue, 13 Mar 2018 08:24:46 -0700 Subject: How do I pass javatest.maxOutputSize to jtreg tests? In-Reply-To: <830ae79a-040c-2c4a-9e56-d86b49fa918e@oracle.com> References: <830ae79a-040c-2c4a-9e56-d86b49fa918e@oracle.com> Message-ID: <7de9aed3-4d89-8291-9557-5906481a6637@oracle.com> On 3/13/18 6:21 AM, David Holmes wrote: > Hi Thomas, > > On 13/03/2018 9:35 PM, Thomas St?fe wrote: >> Hi, >> >> I attempt to analyse a jtreg test which unfortunately does not work >> as a stand alone test class. I activate logging with >> >> -javaoptions:-Xlog:gc+metaspace+freelist=trace >> >> and I see my logging, but it it truncated: >> >> 418 [0.743s][trace][gc,metaspace,freelist] Free chunk total 0 count 0 >> 419 [0.743s][trace][gc,metaspace,freelist >> 420 >> 421 ... >> 422 Output overflow: >> 423 JT Harness has limited the test output to the text to that >> 424 at the beginning and the end, so that you can see how the >> 425 test began, and how it completed. >> 426 >> 427 If you need to see more of the output from the test, >> 428 set the system property javatest.maxOutputSize to a higher >> 429 value. The current value is 100000 >> 430 ... >> 431 >> 432 00007c2aea400 top 0x00000007c2aea430 end 0x00000007c2aeac00 size 256 >> 433 [203.798s][trace][gc,metaspace,freelist] Free chunk total >> 16247552? count 41237 >> 4 >> >> So, I attempt to set -Djavatest.maxOutputSize to a higher value but >> whatever form I do it in it does not change the output. Variants I >> tested are: >> >> jtreg ... -javaoptions:-Xlog:gc+metaspace+freelist=trace >> -javaoptions:-Djavatest.maxOutputSize=2000000 ... >> >> jtreg ... ?"-javaoptions:-Xlog:gc+metaspace+freelist=trace >> -Djavatest.maxOutputSize=2000000" ... >> >> jtreg ... -javaoptions:-Xlog:gc+metaspace+freelist=trace >> -Djavatest.maxOutputSize=2000000 ... >> >> What am I doing wrong? > > Try passing directly to jtreg: > > jtreg -Djavatest.maxOutputSize=2000000 ... > > David > >> Thanks! Thomas >> >> David, Thomas, To pass the option directly to jtreg, you need -J-Djavatest.maxOutputSize=2000000 -- Jon From thomas.stuefe at gmail.com Tue Mar 13 17:13:07 2018 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Tue, 13 Mar 2018 18:13:07 +0100 Subject: How do I pass javatest.maxOutputSize to jtreg tests? In-Reply-To: <7de9aed3-4d89-8291-9557-5906481a6637@oracle.com> References: <830ae79a-040c-2c4a-9e56-d86b49fa918e@oracle.com> <7de9aed3-4d89-8291-9557-5906481a6637@oracle.com> Message-ID: Thank you Jonathan! On Tue, Mar 13, 2018 at 4:24 PM, Jonathan Gibbons < jonathan.gibbons at oracle.com> wrote: > > > On 3/13/18 6:21 AM, David Holmes wrote: > >> Hi Thomas, >> >> On 13/03/2018 9:35 PM, Thomas St?fe wrote: >> >>> Hi, >>> >>> I attempt to analyse a jtreg test which unfortunately does not work as a >>> stand alone test class. I activate logging with >>> >>> -javaoptions:-Xlog:gc+metaspace+freelist=trace >>> >>> and I see my logging, but it it truncated: >>> >>> 418 [0.743s][trace][gc,metaspace,freelist] Free chunk total 0 count 0 >>> 419 [0.743s][trace][gc,metaspace,freelist >>> 420 >>> 421 ... >>> 422 Output overflow: >>> 423 JT Harness has limited the test output to the text to that >>> 424 at the beginning and the end, so that you can see how the >>> 425 test began, and how it completed. >>> 426 >>> 427 If you need to see more of the output from the test, >>> 428 set the system property javatest.maxOutputSize to a higher >>> 429 value. The current value is 100000 >>> 430 ... >>> 431 >>> 432 00007c2aea400 top 0x00000007c2aea430 end 0x00000007c2aeac00 size 256 >>> 433 [203.798s][trace][gc,metaspace,freelist] Free chunk total 16247552 >>> count 41237 >>> 4 >>> >>> So, I attempt to set -Djavatest.maxOutputSize to a higher value but >>> whatever form I do it in it does not change the output. Variants I tested >>> are: >>> >>> jtreg ... -javaoptions:-Xlog:gc+metaspace+freelist=trace >>> -javaoptions:-Djavatest.maxOutputSize=2000000 ... >>> >>> jtreg ... "-javaoptions:-Xlog:gc+metaspace+freelist=trace >>> -Djavatest.maxOutputSize=2000000" ... >>> >>> jtreg ... -javaoptions:-Xlog:gc+metaspace+freelist=trace >>> -Djavatest.maxOutputSize=2000000 ... >>> >>> What am I doing wrong? >>> >> >> Try passing directly to jtreg: >> >> jtreg -Djavatest.maxOutputSize=2000000 ... >> >> David >> >> Thanks! Thomas >>> >>> >>> > David, Thomas, > > To pass the option directly to jtreg, you need > -J-Djavatest.maxOutputSize=2000000 > > -- Jon > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.holmes at oracle.com Thu Mar 15 05:09:49 2018 From: david.holmes at oracle.com (David Holmes) Date: Thu, 15 Mar 2018 15:09:49 +1000 Subject: Organising compiled class files Message-ID: <00c1e65e-b260-6452-8203-175d191e7e80@oracle.com> I'm working on class redefinition tests which require me to have multiple versions of the same-named class but different actual contents. At the moment this is done via shell script that invokes javac and then moves the generated .class files to the desired location. This seems a bit kludgy. Given a layout: redefTest/RedefTest.java redefTest/ver1/Foo.java redeftest/ver2/Foo.java is there a way to have jtreg compile all the source files such that the directory structure is replicated for the .class files? redefTest/RedefTest.d/RedefTest.class redefTest/RedefTest.d/ver1/Foo.class redefTest/RedefTest.d/ver2/Foo.class Otherwise what suggestions do people have? Can ClassfileInstaller help here? Or should I just stick with the shell script? Thanks, David From weijun.wang at oracle.com Thu Mar 15 08:41:47 2018 From: weijun.wang at oracle.com (Weijun Wang) Date: Thu, 15 Mar 2018 16:41:47 +0800 Subject: Organising compiled class files In-Reply-To: <00c1e65e-b260-6452-8203-175d191e7e80@oracle.com> References: <00c1e65e-b260-6452-8203-175d191e7e80@oracle.com> Message-ID: <572EC264-7CFF-4C07-BBBA-9041763AFF05@oracle.com> Do CompilerUtils and InMemoryJavaCompiler in jdk.test.lib.compiler work for you? --Max > On Mar 15, 2018, at 1:09 PM, David Holmes wrote: > > I'm working on class redefinition tests which require me to have multiple versions of the same-named class but different actual contents. At the moment this is done via shell script that invokes javac and then moves the generated .class files to the desired location. This seems a bit kludgy. > > Given a layout: > > redefTest/RedefTest.java > redefTest/ver1/Foo.java > redeftest/ver2/Foo.java > > is there a way to have jtreg compile all the source files such that the directory structure is replicated for the .class files? > > redefTest/RedefTest.d/RedefTest.class > redefTest/RedefTest.d/ver1/Foo.class > redefTest/RedefTest.d/ver2/Foo.class > > Otherwise what suggestions do people have? Can ClassfileInstaller help here? Or should I just stick with the shell script? > > Thanks, > David From david.holmes at oracle.com Thu Mar 15 09:43:59 2018 From: david.holmes at oracle.com (David Holmes) Date: Thu, 15 Mar 2018 19:43:59 +1000 Subject: Organising compiled class files In-Reply-To: <572EC264-7CFF-4C07-BBBA-9041763AFF05@oracle.com> References: <00c1e65e-b260-6452-8203-175d191e7e80@oracle.com> <572EC264-7CFF-4C07-BBBA-9041763AFF05@oracle.com> Message-ID: On 15/03/2018 6:41 PM, Weijun Wang wrote: > Do CompilerUtils and InMemoryJavaCompiler in jdk.test.lib.compiler work for you? CompilerUtils seems like it could replace the shell script. IMJC is probably a bit too low-level (I could also exec javac). Thanks, David > --Max > >> On Mar 15, 2018, at 1:09 PM, David Holmes wrote: >> >> I'm working on class redefinition tests which require me to have multiple versions of the same-named class but different actual contents. At the moment this is done via shell script that invokes javac and then moves the generated .class files to the desired location. This seems a bit kludgy. >> >> Given a layout: >> >> redefTest/RedefTest.java >> redefTest/ver1/Foo.java >> redeftest/ver2/Foo.java >> >> is there a way to have jtreg compile all the source files such that the directory structure is replicated for the .class files? >> >> redefTest/RedefTest.d/RedefTest.class >> redefTest/RedefTest.d/ver1/Foo.class >> redefTest/RedefTest.d/ver2/Foo.class >> >> Otherwise what suggestions do people have? Can ClassfileInstaller help here? Or should I just stick with the shell script? >> >> Thanks, >> David > From jonathan.gibbons at oracle.com Thu Mar 15 14:52:01 2018 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Thu, 15 Mar 2018 07:52:01 -0700 Subject: Organising compiled class files In-Reply-To: References: <00c1e65e-b260-6452-8203-175d191e7e80@oracle.com> <572EC264-7CFF-4C07-BBBA-9041763AFF05@oracle.com> Message-ID: <91dbb502-e27c-4361-d911-07daee5bd243@oracle.com> Agreed that using code to drive javac is the way to go.? I'd recommend trying to call javac via API if possible, just to save the startup cost of execing javac. As well as the CompilerUtils test library, you can also use the new-in-9 java.util.spi.ToolProvider to get the "javac" provider, that provides the facilities as command-line use of javac, albeit in the same JVM. -- Jon On 3/15/18 2:43 AM, David Holmes wrote: > On 15/03/2018 6:41 PM, Weijun Wang wrote: >> Do CompilerUtils and InMemoryJavaCompiler in jdk.test.lib.compiler >> work for you? > > CompilerUtils seems like it could replace the shell script. IMJC is > probably a bit too low-level (I could also exec javac). > > Thanks, > David > >> --Max >> >>> On Mar 15, 2018, at 1:09 PM, David Holmes >>> wrote: >>> >>> I'm working on class redefinition tests which require me to have >>> multiple versions of the same-named class but different actual >>> contents. At the moment this is done via shell script that invokes >>> javac and then moves the generated .class files to the desired >>> location. This seems a bit kludgy. >>> >>> Given a layout: >>> >>> redefTest/RedefTest.java >>> redefTest/ver1/Foo.java >>> redeftest/ver2/Foo.java >>> >>> is there a way to have jtreg compile all the source files such that >>> the directory structure is replicated for the .class files? >>> >>> redefTest/RedefTest.d/RedefTest.class >>> redefTest/RedefTest.d/ver1/Foo.class >>> redefTest/RedefTest.d/ver2/Foo.class >>> >>> Otherwise what suggestions do people have? Can ClassfileInstaller >>> help here? Or should I just stick with the shell script? >>> >>> Thanks, >>> David >>