Browse Source

Only run windows library test if running as admin.

pull/187/head
weisj 5 years ago
parent
commit
390241aaca
  1. 10
      core/src/test/java/test/NativeLibraryTest.java

10
core/src/test/java/test/NativeLibraryTest.java

@ -47,6 +47,7 @@ public class NativeLibraryTest {
@Test
@EnabledOnOs(OS.WINDOWS)
public void testWindowsLibraryLoading() {
if (!isAdmin()) return;
WindowsLibrary library = new TestWindowsLibrary();
Assertions.assertNotNull(getClass().getResource(library.getX64Path() + library.getLibraryName()),
"x64 library doesn't exist");
@ -56,6 +57,15 @@ public class NativeLibraryTest {
Assertions.assertTrue(library.isLoaded(), "Windows library isn't loaded");
}
private static boolean isAdmin() {
String[] groups = (new com.sun.security.auth.module.NTSystem()).getGroupIDs();
for (String group : groups) {
if ("S-1-5-32-544".equals(group))
return true;
}
return false;
}
private static class TestMacOsLibrary extends MacOSLibrary {
@Override
protected void error(final String message, final Throwable e) {

Loading…
Cancel
Save