Skip to content

Commit

Permalink
create symlink in working dir
Browse files Browse the repository at this point in the history
and add `.` as first item to `java.library.path`
  • Loading branch information
overheadhunter committed Sep 27, 2023
1 parent 0a8a238 commit ddab2db
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 2 additions & 0 deletions jfuse-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<argLine>@{surefire.jacoco.args} --enable-native-access=ALL-UNNAMED --enable-preview</argLine>
<systemProperties>
<fuse.lib.path>${fuse.lib.path}</fuse.lib.path>
<java.library.path>.:${java.library.path}</java.library.path>
</systemProperties>
</configuration>
</plugin>
Expand All @@ -103,6 +104,7 @@
<argLine>@{failsafe.jacoco.args} --enable-native-access=ALL-UNNAMED --enable-preview</argLine>
<systemProperties>
<fuse.lib.path>${fuse.lib.path}</fuse.lib.path>
<java.library.path>.:${java.library.path}</java.library.path>
</systemProperties>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,21 @@ public class FallbackLibLoadingIT {
@Test
@EnabledOnOs(OS.LINUX)
@DisplayName("loads fuse lib from java.library.path, if not calling FuseBuilder.setLibraryPath(...)")
public void loadFromJavaLibraryPathOnLinux(@TempDir Path p) throws IOException, TimeoutException {
loadFromJavaLibraryPath(p, "libfuse3.so");
public void loadFromJavaLibraryPathOnLinux() throws IOException, TimeoutException {
loadFromJavaLibraryPath("libfuse3.so");
}

@Test
@EnabledOnOs(OS.MAC)
@DisplayName("loads fuse lib from java.library.path, if not calling FuseBuilder.setLibraryPath(...)")
public void loadFromJavaLibraryPathOnMacOS(@TempDir Path p) throws IOException, TimeoutException {
loadFromJavaLibraryPath(p, "libfuse-t.dylib");
public void loadFromJavaLibraryPathOnMacOS() throws IOException, TimeoutException {
loadFromJavaLibraryPath("libfuse-t.dylib");
}

private void loadFromJavaLibraryPath(Path tmpLibPath, String libFileName) throws IOException, TimeoutException {
var libPath = System.getProperty("fuse.lib.path");
var symlinkPath = tmpLibPath.resolve(libFileName);
Files.createSymbolicLink(symlinkPath, Path.of(libPath));

System.setProperty("java.library.path", tmpLibPath.toString());
private void loadFromJavaLibraryPath(String libFileName) throws IOException, TimeoutException {
// symlink ./${libName} -> ${fuse.lib.path}
var symlinkPath = Path.of(System.getProperty("user.dir"), libFileName);
Files.createSymbolicLink(symlinkPath, Path.of(System.getProperty("fuse.lib.path")));

var builder = Fuse.builder();
var fs = new RandomFileSystem(builder.errno());
Expand Down

0 comments on commit ddab2db

Please sign in to comment.