RFR: JDK-8304063: tools/jpackage/share/AppLauncherEnvTest.java fails when checking LD_LIBRARY_PATH

Alexey Semenyuk asemenyuk at openjdk.org
Wed Mar 15 18:40:25 UTC 2023


On Wed, 15 Mar 2023 11:46:22 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> The test fails on Alpine Linux 3.17, when checking the environment variable LD_LIBRARY_PATH; looks like the actual env variable is much longer than the test expects. It turned out that at least on Linux (probably also on other OS like AIX)  the actual env variable has the expected string at it's end, but might contain more path entries ( LD_LIBRARY_PATH can be adjusted by jvm - https://github.com/openjdk/jdk/blob/master/src/java.base/unix/native/libjli/java_md.c  ).

Changes requested by asemenyuk (Reviewer).

test/jdk/tools/jpackage/share/AppLauncherEnvTest.java line 93:

> 91:         } else {
> 92:             TKit.assertEquals(expectedEnvVarValue, actualEnvVarValue, msg);
> 93:         }

I'd keep the check as a single statement:

TKit.assertTextStream(expectedEnvVarValue)
    .predicate(TKit.isLinux() ? String::endsWith : String::equals)
    .label(String.format("value of %s env variable", envVarName))
    .apply(Stream.of(actualEnvVarValue));


It also will produce a nicer log record than `TKit.assertTrue(false, msg);`

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

PR: https://git.openjdk.org/jdk/pull/13041


More information about the core-libs-dev mailing list