]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
Make fuse3 support optional and document.
authorJustin Husted <sigstop@gmail.com>
Mon, 11 Nov 2019 20:00:08 +0000 (12:00 -0800)
committerJustin Husted <sigstop@gmail.com>
Mon, 11 Nov 2019 20:18:22 +0000 (12:18 -0800)
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>
INSTALL
Makefile
bcachefs.c
cmd_fusemount.c
tests/test_fuse.py
tests/util.py

diff --git a/INSTALL b/INSTALL
index 46833a392eb15637b4a2f5475f964bf4420f4529..e344c53c5086410206bb3b86daa6a176c02d9670 100644 (file)
--- 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
index eb2798ff5a5d6b2382cb7424574cb52263930e4d..adea7611d8092a0f81b1431bf61ae4593a72b7c7 100644 (file)
--- 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))
index 8840d5161d6308de42552c9914e8f165f87fc78c..03ebfd2017e6454b171a01e5a402e6e769af27d2 100644 (file)
@@ -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();
index 96a2339d2dcf801301e9a724644d8f448ba293d1..4e4c24cce888b28679841097e49a4961c2e9b70a 100644 (file)
@@ -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 */
index 877fd64c7c8f50343836221dba383a738c55fa3e..da0a7a42f59bd260a10503d6afdc2c0a7ced8086 100644 (file)
@@ -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()
index 18d60020c3056f81dd06e3868a7211a73a1e173a..b6e05e3a97d2696f1f06369fc64bd1746bc37f4f 100644 (file)
@@ -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