summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Husted <sigstop@gmail.com>2019-11-11 12:00:08 -0800
committerJustin Husted <sigstop@gmail.com>2019-11-11 12:18:22 -0800
commita00998c4cdf834ebce00bedabd2804fe5376a63c (patch)
treef098e102fd22d5e6aa69ef29ab53bb92aa4ac43d
parent1f7098c22213bbe66896f390a529223468a3986e (diff)
Make fuse3 support optional and document.
The experimental fuse3 support is not complete yet, and fuse3 is new and still difficult to install on some platforms. Make it optional at compile time, and default to off. Signed-off-by: Justin Husted <sigstop@gmail.com>
-rw-r--r--INSTALL30
-rw-r--r--Makefile6
-rw-r--r--bcachefs.c2
-rw-r--r--cmd_fusemount.c4
-rw-r--r--tests/test_fuse.py4
-rw-r--r--tests/util.py5
6 files changed, 50 insertions, 1 deletions
diff --git a/INSTALL b/INSTALL
index 46833a3..e344c53 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,3 +1,4 @@
+-- Getting started --
Dependencies:
@@ -20,3 +21,32 @@ On debian, you can install these with
uuid-dev zlib1g-dev valgrind
Then, just make && make install
+
+
+-- Experimental features --
+
+Experimental fuse support is currently disabled by default. Fuse support is at
+an early stage and may corrupt your filesystem, so it should only be used for
+testing. To enable, you'll also need to add:
+
+* libfuse3
+
+On debian:
+ apt install -y libfuse3-dev
+
+Then, make using the BCACHEFS_FUSE environment variable:
+
+BCACHEFS_FUSE=1 make &&
+
+
+-- Tests --
+
+Some tests are available to validate the "bcachefs" binary. The tests depend
+on python3 pytest.
+
+On debian:
+ apt install -u python3-pytest
+
+Then, you can run the tests via:
+
+ make check
diff --git a/Makefile b/Makefile
index eb2798f..adea761 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,11 @@ ifdef D
CFLAGS+=-DCONFIG_BCACHEFS_DEBUG=y
endif
-PKGCONFIG_LIBS="blkid uuid liburcu libsodium zlib liblz4 libzstd fuse3"
+PKGCONFIG_LIBS="blkid uuid liburcu libsodium zlib liblz4 libzstd"
+ifdef BCACHEFS_FUSE
+ PKGCONFIG_LIBS+="fuse3"
+ CFLAGS+=-DBCACHEFS_FUSE
+endif
PKGCONFIG_CFLAGS:=$(shell $(PKG_CONFIG) --cflags $(PKGCONFIG_LIBS))
ifeq (,$(PKGCONFIG_CFLAGS))
diff --git a/bcachefs.c b/bcachefs.c
index 8840d51..03ebfd2 100644
--- a/bcachefs.c
+++ b/bcachefs.c
@@ -203,8 +203,10 @@ int main(int argc, char *argv[])
if (!strcmp(cmd, "setattr"))
return cmd_setattr(argc, argv);
+#ifdef BCACHEFS_FUSE
if (!strcmp(cmd, "fusemount"))
return cmd_fusemount(argc, argv);
+#endif
if (!strcmp(cmd, "--help")) {
usage();
diff --git a/cmd_fusemount.c b/cmd_fusemount.c
index 96a2339..4e4c24c 100644
--- a/cmd_fusemount.c
+++ b/cmd_fusemount.c
@@ -1,3 +1,5 @@
+#ifdef BCACHEFS_FUSE
+
#include <errno.h>
#include <float.h>
#include <getopt.h>
@@ -1262,3 +1264,5 @@ out:
return ret ? 1 : 0;
}
+
+#endif /* BCACHEFS_FUSE */
diff --git a/tests/test_fuse.py b/tests/test_fuse.py
index 877fd64..da0a7a4 100644
--- a/tests/test_fuse.py
+++ b/tests/test_fuse.py
@@ -2,9 +2,13 @@
#
# Tests of the fuse mount functionality.
+import pytest
import os
import util
+pytestmark = pytest.mark.skipif(
+ not util.have_fuse(), reason="bcachefs not built with fuse support.")
+
def test_mount(bfuse):
bfuse.mount()
bfuse.unmount()
diff --git a/tests/util.py b/tests/util.py
index 18d6002..b6e05e3 100644
--- a/tests/util.py
+++ b/tests/util.py
@@ -4,6 +4,7 @@ import os
import pytest
import re
import subprocess
+import sys
import tempfile
import threading
import time
@@ -208,3 +209,7 @@ class BFuse(threading.Thread):
assert self.returncode == 0
assert len(self.stdout) > 0
assert len(self.stderr) == 0
+
+def have_fuse():
+ res = run(BCH_PATH, 'fusemount', valgrind=False)
+ return "Please supply a mountpoint." in res.stdout