blob: c1e81dd672f3dfce82f4cf569d52249272ef391f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.nativec;
import com.sun.jna.Platform;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class GlibCTestCase {
@Test
public void requireThatPosixFAdviseIsDetected() {
if (Platform.isLinux()) {
assertNull(PosixFAdvise.init());
} else {
assertEquals("Platform is unsupported. Only supported on Linux.", PosixFAdvise.init().getMessage());
}
}
@Test
public void requireGlibcVersionIsDetected() {
if (Platform.isLinux()) {
assertNull(GLibcVersion.init());
GLibcVersion version = new GLibcVersion();
assertNotEquals("", version.version());
assertTrue(version.major() >= 2);
assertTrue((version.major() >= 3) || ((version.major() == 2) && (version.minor() >= 17)));
} else {
assertEquals("Platform is unsupported. Only supported on Linux.", PosixFAdvise.init().getMessage());
}
}
}
|