30
30
/**
31
31
* @test
32
32
* @summary VerifyDependencies checks readability verifies that a Linux shared
33
- * library has no dependency on symbols from glibc version higher than 2.17
33
+ * library has no dependency on symbols from glibc version higher than <code>expectedVersion</code>
34
34
* @run main VerifyDependencies
35
35
* @requires (os.family == "linux")
36
36
*/
37
37
38
38
public class VerifyDependencies {
39
39
40
- static final public String EXPECTED_VERSION = "2.17" ;
40
+ static final public String EXPECTED_VERSION_LEGACY = "2.17" ;
41
+ static final public String EXPECTED_VERSION_VULKAN = "2.28" ;
42
+
43
+ static String expectedVersion ;
44
+
41
45
public static void verifyLibrary (String libraryPath ) throws IOException {
42
46
Process process ;
43
47
BufferedReader reader ;
@@ -52,12 +56,12 @@ public static void verifyLibrary(String libraryPath) throws IOException {
52
56
System .out .println (line );
53
57
if (line .contains ("GLIBC_" )) {
54
58
String version = extractVersion (line );
55
- if (compareVersions (version , EXPECTED_VERSION ) > 0 ) {
59
+ if (compareVersions (version , expectedVersion ) > 0 ) {
56
60
throw new RuntimeException (libraryPath + " has a dependency on glibc version " + version );
57
61
}
58
62
}
59
63
}
60
- System .out .println (libraryPath + " has no dependency on glibc version higher than " + EXPECTED_VERSION );
64
+ System .out .println (libraryPath + " has no dependency on glibc version higher than " + expectedVersion );
61
65
}
62
66
63
67
private static String extractVersion (String line ) {
@@ -125,6 +129,12 @@ public boolean accept(File dir, String name) {
125
129
126
130
public static void main (String [] args ) throws IOException {
127
131
String javaHome = System .getProperty ("java.home" );
132
+
133
+ String vendorVersion = System .getProperty ("java.vendor.version" );
134
+ expectedVersion = vendorVersion .substring (Math .max (vendorVersion .length () - 3 , 0 )).compareTo ("-vk" ) == 0
135
+ ? EXPECTED_VERSION_VULKAN : EXPECTED_VERSION_LEGACY ;
136
+ System .out .println ("supporting glibc version is not less than " + expectedVersion );
137
+
128
138
findInDirectory (javaHome + "/bin" , false );
129
139
findInDirectory (javaHome + "/lib" , true );
130
140
}
0 commit comments