From 739f762b224f5c4ceddd0a7625e8ab5d145e710c Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 18 Apr 2019 17:53:18 -0700 Subject: [PATCH 1/2] ci: test building with fuse License: MIT Signed-off-by: Steven Allen --- .circleci/config.yml | 17 ++++++++++++++++- mk/golang.mk | 4 +++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9a09195a7ff..6e427bd2388 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,6 +36,21 @@ defaults: &defaults - image: circleci/golang:1.12 jobs: + gobuild: + <<: *defaults + steps: + - checkout + - *make_out_dirs + - *restore_gomod + - run: + command: make cmd/ipfs-try-build + environment: + TEST_NO_FUSE: 0 + - run: + command: make cmd/ipfs-try-build + environment: + TEST_NO_FUSE: 1 + - *store_gomod gotest: <<: *defaults steps: @@ -43,7 +58,6 @@ jobs: - *make_out_dirs - *restore_gomod - - run: make cmd/ipfs-try-build - run: | make -j 1 test/unit/gotest.junit.xml \ && [[ ! $(jq -s -c 'map(select(.Action == "fail")) | .[]' test/unit/gotest.json) ]] @@ -96,5 +110,6 @@ workflows: version: 2 test: jobs: + - gobuild - gotest - sharness diff --git a/mk/golang.mk b/mk/golang.mk index 683757c0b30..e229023cd0d 100644 --- a/mk/golang.mk +++ b/mk/golang.mk @@ -46,6 +46,8 @@ test_go_test: $$(DEPS_GO) $(GOCC) test $(go-flags-with-tags) $(GOTFLAGS) ./... .PHONY: test_go_test +test_go_build: $$(TEST_GO_BUILD) + test_go_short: GOTFLAGS += -test.short test_go_short: test_go_test .PHONY: test_go_short @@ -54,7 +56,7 @@ test_go_race: GOTFLAGS += -race test_go_race: test_go_test .PHONY: test_go_race -test_go_expensive: test_go_test $$(TEST_GO_BUILD) +test_go_expensive: test_go_test test_go_build .PHONY: test_go_expensive TEST_GO += test_go_expensive From a3bdfd68de2b7307c25915566f1a0a35c3cf294a Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 18 Apr 2019 18:10:29 -0700 Subject: [PATCH 2/2] fix macos build when fuse is enabled Instead of trying to export the `errNeedFuseVersion` type, just use string matching. It's good enough for testing and the alternative was annoying. License: MIT Signed-off-by: Steven Allen --- fuse/node/mount_nofuse.go | 2 -- fuse/node/mount_test.go | 3 ++- fuse/node/mount_unix.go | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/fuse/node/mount_nofuse.go b/fuse/node/mount_nofuse.go index 92f61f809eb..7f824ef3e12 100644 --- a/fuse/node/mount_nofuse.go +++ b/fuse/node/mount_nofuse.go @@ -8,8 +8,6 @@ import ( core "github.com/ipfs/go-ipfs/core" ) -type errNeedFuseVersion error // used in tests, needed in OSX - func Mount(node *core.IpfsNode, fsdir, nsdir string) error { return errors.New("not compiled in") } diff --git a/fuse/node/mount_test.go b/fuse/node/mount_test.go index 69d07c9684d..ec57b9fc097 100644 --- a/fuse/node/mount_test.go +++ b/fuse/node/mount_test.go @@ -5,6 +5,7 @@ package node import ( "io/ioutil" "os" + "strings" "testing" "time" @@ -63,7 +64,7 @@ func TestExternalUnmount(t *testing.T) { mkdir(t, ipnsDir) err = Mount(node, ipfsDir, ipnsDir) - if _, ok := err.(errNeedFuseVersion); ok || err == fuse.ErrOSXFUSENotFound { + if strings.Contains(err.Error(), "unable to check fuse version") || err == fuse.ErrOSXFUSENotFound { t.Skip(err) } if err != nil { diff --git a/fuse/node/mount_unix.go b/fuse/node/mount_unix.go index 3b9cb5c3a07..8fee8694749 100644 --- a/fuse/node/mount_unix.go +++ b/fuse/node/mount_unix.go @@ -30,8 +30,6 @@ var platformFuseChecks = func(*core.IpfsNode) error { return nil } -type errNeedFuseVersion error // used in tests, needed in OSX - func Mount(node *core.IpfsNode, fsdir, nsdir string) error { // check if we already have live mounts. // if the user said "Mount", then there must be something wrong.