[jdk8u-dev] RFR: JDK-8292688: Support Security properties in security.testlibrary.Proc

Martin Balao mbalao at openjdk.org
Sat Aug 20 02:15:24 UTC 2022


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

-------------

Commit messages:
 - JDK-8292688: Support Security properties in security.testlibrary.Proc

Changes: https://git.openjdk.org/jdk8u-dev/pull/107/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk8u-dev&pr=107&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8292688
  Stats: 27 lines in 1 file changed: 26 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk8u-dev/pull/107.diff
  Fetch: git fetch https://git.openjdk.org/jdk8u-dev pull/107/head:pull/107

PR: https://git.openjdk.org/jdk8u-dev/pull/107


More information about the jdk8u-dev mailing list