summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com/yahoo/nativec/GlibCTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'vespajlib/src/test/java/com/yahoo/nativec/GlibCTestCase.java')
-rw-r--r--vespajlib/src/test/java/com/yahoo/nativec/GlibCTestCase.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/nativec/GlibCTestCase.java b/vespajlib/src/test/java/com/yahoo/nativec/GlibCTestCase.java
new file mode 100644
index 00000000000..3a37116f606
--- /dev/null
+++ b/vespajlib/src/test/java/com/yahoo/nativec/GlibCTestCase.java
@@ -0,0 +1,33 @@
+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 unsúpported. 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 unsúpported. Only supported on linux.", PosixFAdvise.init().getMessage());
+ }
+ }
+}