# HG changeset patch # User asiebenborn # Date 1524206654 -7200 # Fri Apr 20 08:44:14 2018 +0200 # Node ID 944e533ca57f8eea908ef55da615c005bf65abad # Parent f7d3f7b5648f994a1c684b27980cd6087f76e55d Exclude NativeLibraryTest.java on musl. diff --git a/test/jdk/TEST.ROOT b/test/jdk/TEST.ROOT --- a/test/jdk/TEST.ROOT +++ b/test/jdk/TEST.ROOT @@ -36,7 +36,8 @@ sun.arch.data.model \ java.runtime.name \ vm.graal.enabled \ - vm.cds + vm.cds \ + vm.musl # Minimum jtreg version requiredVersion=4.2 b12 diff --git a/test/jdk/java/lang/ClassLoader/nativeLibrary/NativeLibraryTest.java b/test/jdk/java/lang/ClassLoader/nativeLibrary/NativeLibraryTest.java --- a/test/jdk/java/lang/ClassLoader/nativeLibrary/NativeLibraryTest.java +++ b/test/jdk/java/lang/ClassLoader/nativeLibrary/NativeLibraryTest.java @@ -25,6 +25,9 @@ * @test * @bug 8164512 8191360 * @requires vm.compMode != "Xcomp" + * @comment Under musl, dlclose is a no-op. The static variable 'count' in libnative.c + * keeps its value across a GC and the check in Test.java fails. + * @requires !vm.musl * @summary verify if the native library is unloaded when the class loader is GC'ed * @build p.Test * @run main/othervm/native -Xcheck:jni NativeLibraryTest diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -22,6 +22,8 @@ */ package requires; +import java.io.BufferedReader; +import java.io.InputStreamReader; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -79,6 +81,7 @@ // vm.graal.enabled is true if Graal is used as JIT map.put("vm.graal.enabled", isGraalEnabled()); map.put("docker.support", dockerSupport()); + map.put("vm.musl", isMusl()); vmGC(map); // vm.gc.X = true/false VMProps.dump(map); @@ -406,7 +409,25 @@ return (p.exitValue() == 0); } - + /** + * Check if we run with musl libc. + * + * @return true if we run with musl libc. + */ + protected String isMusl() { + try { + ProcessBuilder pb = new ProcessBuilder("ldd", "--version"); + pb.redirectErrorStream(true); + final Process p = pb.start(); + BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); + String line = br.readLine(); + if (line != null && line.contains("musl")) { + return "true"; + } + } catch (Exception e) { + } + return "false"; + } /** * Dumps the map to the file if the file name is given as the property.