[jdk8u-dev] RFR: JDK-8292688: Support Security properties in security.testlibrary.Proc
Severin Gehwolf
sgehwolf at openjdk.org
Tue Aug 23 16:33:39 UTC 2022
On Sat, 20 Aug 2022 02:10:51 GMT, Martin Balao <mbalao at openjdk.org> wrote:
> Hi,
>
> I'd like to propose a test library enhacement as described in JDK-8292688 [1].
>
> In addition to hook context modifications from Proc.java changes in JDK-8209901, I had to use Paths::get to obtain a Path instance from a String (Path::of is not available in 8u).
>
> I tested these changes with my own code snippet:
>
>
> public final class Main {
> private static final String CHILD_ID = "CHILD_ID";
> private static final String SEC_PROP = "SEC_PROP";
> private static final String SEC_PROP_VAL = "KNOWN_VAL!";
> public static void main(String[] args) throws Throwable {
> if (args.length > 0 && args[0].equals(CHILD_ID)) {
> String secVal = java.security.Security.getProperty(SEC_PROP);
> System.out.println("SEC_PROP: " + secVal);
> if (!secVal.equals(SEC_PROP_VAL)) {
> throw new Exception("TEST FAILED");
> }
> } else {
> Proc p = Proc.create(Main.class.getName()).args(CHILD_ID);
> p.secprop(SEC_PROP, SEC_PROP_VAL);
> p.debug(Main.class.getName());
> p.inheritIO();
> p.start().waitFor(0);
> }
> }
> }
>
>
> Thanks,
> Martin.-
>
> --
> [1] - https://bugs.openjdk.org/browse/JDK-8292688
Looks fine to me.
-------------
Marked as reviewed by sgehwolf (Reviewer).
PR: https://git.openjdk.org/jdk8u-dev/pull/107
More information about the jdk8u-dev
mailing list