本文整理汇总了Golang中github.com/hanwen/go-fuse/fuse.CheckSuccess函数的典型用法代码示例。如果您正苦于以下问题:Golang CheckSuccess函数的具体用法?Golang CheckSuccess怎么用?Golang CheckSuccess使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckSuccess函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: setup
func setup(t *testing.T) (workdir string, cleanup func()) {
wd, _ := ioutil.TempDir("", "")
err := os.Mkdir(wd+"/mnt", 0700)
fuse.CheckSuccess(err)
err = os.Mkdir(wd+"/store", 0700)
fuse.CheckSuccess(err)
os.Mkdir(wd+"/ro", 0700)
fuse.CheckSuccess(err)
WriteFile(wd+"/ro/file1", "file1")
WriteFile(wd+"/ro/file2", "file2")
fs := NewAutoUnionFs(wd+"/store", testAOpts)
state, conn, err := fuse.MountPathFileSystem(wd+"/mnt", fs, &testAOpts.FileSystemOptions)
CheckSuccess(err)
state.Debug = fuse.VerboseTest()
conn.Debug = fuse.VerboseTest()
go state.Loop()
return wd, func() {
state.Unmount()
os.RemoveAll(wd)
}
}
示例2: setup
func setup(t *testing.T) (workdir string, cleanup func()) {
wd := fuse.MakeTempDir()
err := os.Mkdir(wd+"/mount", 0700)
fuse.CheckSuccess(err)
err = os.Mkdir(wd+"/store", 0700)
fuse.CheckSuccess(err)
os.Mkdir(wd+"/ro", 0700)
fuse.CheckSuccess(err)
WriteFile(wd+"/ro/file1", "file1")
WriteFile(wd+"/ro/file2", "file2")
fs := NewAutoUnionFs(wd+"/store", testAOpts)
state, conn, err := fuse.MountFileSystem(wd+"/mount", fs, &testAOpts.FileSystemOptions)
CheckSuccess(err)
state.Debug = true
conn.Debug = true
go state.Loop(false)
return wd, func() {
state.Unmount()
os.RemoveAll(wd)
}
}
示例3: setupUfs
func setupUfs(t *testing.T) (workdir string, cleanup func()) {
wd := fuse.MakeTempDir()
err := os.Mkdir(wd+"/mount", 0700)
fuse.CheckSuccess(err)
err = os.Mkdir(wd+"/rw", 0700)
fuse.CheckSuccess(err)
os.Mkdir(wd+"/ro", 0700)
fuse.CheckSuccess(err)
var fses []fuse.FileSystem
fses = append(fses, fuse.NewLoopbackFileSystem(wd+"/rw"))
fses = append(fses, fuse.NewLoopbackFileSystem(wd+"/ro"))
ufs := NewUnionFs("testFs", fses, testOpts)
opts := &fuse.FileSystemOptions{
EntryTimeout: entryTtl,
AttrTimeout: entryTtl,
NegativeTimeout: entryTtl,
}
state, _, err := fuse.MountFileSystem(wd+"/mount", ufs, opts)
CheckSuccess(err)
state.Debug = true
go state.Loop(false)
return wd, func() {
state.Unmount()
os.RemoveAll(wd)
}
}
示例4: setupUfs
func setupUfs(t *testing.T) (workdir string, cleanup func()) {
wd := fuse.MakeTempDir()
err := os.Mkdir(wd+"/mount", 0700)
fuse.CheckSuccess(err)
err = os.Mkdir(wd+"/rw", 0700)
fuse.CheckSuccess(err)
os.Mkdir(wd+"/ro", 0700)
fuse.CheckSuccess(err)
var fses []fuse.FileSystem
fses = append(fses, fuse.NewLoopbackFileSystem(wd+"/rw"))
fses = append(fses,
NewCachingFileSystem(fuse.NewLoopbackFileSystem(wd+"/ro"), 0))
ufs := NewUnionFs(fses, testOpts)
// We configure timeouts are smaller, so we can check for
// UnionFs's cache consistency.
opts := &fuse.FileSystemOptions{
EntryTimeout: .5 * entryTtl,
AttrTimeout: .5 * entryTtl,
NegativeTimeout: .5 * entryTtl,
}
state, _, err := fuse.MountFileSystem(wd+"/mount", ufs, opts)
CheckSuccess(err)
state.Debug = true
go state.Loop(false)
return wd, func() {
state.Unmount()
os.RemoveAll(wd)
}
}
示例5: dirNames
func dirNames(path string) map[string]bool {
f, err := os.Open(path)
fuse.CheckSuccess(err)
result := make(map[string]bool)
names, err := f.Readdirnames(-1)
fuse.CheckSuccess(err)
err = f.Close()
CheckSuccess(err)
for _, nm := range names {
result[nm] = true
}
return result
}
示例6: setupUfs
func setupUfs(t *testing.T) (workdir string, cleanup func()) {
// Make sure system setting does not affect test.
syscall.Umask(0)
wd, _ := ioutil.TempDir("", "")
err := os.Mkdir(wd+"/mnt", 0700)
fuse.CheckSuccess(err)
err = os.Mkdir(wd+"/rw", 0700)
fuse.CheckSuccess(err)
os.Mkdir(wd+"/ro", 0700)
fuse.CheckSuccess(err)
var fses []fuse.FileSystem
fses = append(fses, fuse.NewLoopbackFileSystem(wd+"/rw"))
fses = append(fses,
NewCachingFileSystem(fuse.NewLoopbackFileSystem(wd+"/ro"), 0))
ufs := NewUnionFs(fses, testOpts)
// We configure timeouts are smaller, so we can check for
// UnionFs's cache consistency.
opts := &fuse.FileSystemOptions{
EntryTimeout: .5 * entryTtl,
AttrTimeout: .5 * entryTtl,
NegativeTimeout: .5 * entryTtl,
}
pathfs := fuse.NewPathNodeFs(ufs,
&fuse.PathNodeFsOptions{ClientInodes: true})
state, conn, err := fuse.MountNodeFileSystem(wd+"/mnt", pathfs, opts)
CheckSuccess(err)
conn.Debug = fuse.VerboseTest()
state.Debug = fuse.VerboseTest()
go state.Loop()
return wd, func() {
state.Unmount()
os.RemoveAll(wd)
}
}
示例7: setupMemUfs
func setupMemUfs(t *testing.T) (workdir string, ufs *MemUnionFs, cleanup func()) {
// Make sure system setting does not affect test.
syscall.Umask(0)
wd, _ := ioutil.TempDir("", "")
err := os.Mkdir(wd+"/mnt", 0700)
fuse.CheckSuccess(err)
err = os.Mkdir(wd+"/backing", 0700)
fuse.CheckSuccess(err)
os.Mkdir(wd+"/ro", 0700)
fuse.CheckSuccess(err)
roFs := fuse.NewLoopbackFileSystem(wd + "/ro")
memFs := NewMemUnionFs(wd+"/backing", roFs)
// We configure timeouts are smaller, so we can check for
// UnionFs's cache consistency.
opts := &fuse.FileSystemOptions{
EntryTimeout: entryTtl / 2,
AttrTimeout: entryTtl / 2,
NegativeTimeout: entryTtl / 2,
PortableInodes: true,
}
state, conn, err := fuse.MountNodeFileSystem(wd+"/mnt", memFs, opts)
CheckSuccess(err)
conn.Debug = fuse.VerboseTest()
state.Debug = fuse.VerboseTest()
go state.Loop()
return wd, memFs, func() {
state.Unmount()
os.RemoveAll(wd)
}
}
示例8: TestUnionFsDisappearing
func TestUnionFsDisappearing(t *testing.T) {
// This init is like setupUfs, but we want access to the
// writable Fs.
wd, _ := ioutil.TempDir("", "")
defer os.RemoveAll(wd)
err := os.Mkdir(wd+"/mnt", 0700)
fuse.CheckSuccess(err)
err = os.Mkdir(wd+"/rw", 0700)
fuse.CheckSuccess(err)
os.Mkdir(wd+"/ro", 0700)
fuse.CheckSuccess(err)
wrFs := fuse.NewLoopbackFileSystem(wd + "/rw")
var fses []fuse.FileSystem
fses = append(fses, wrFs)
fses = append(fses, fuse.NewLoopbackFileSystem(wd+"/ro"))
ufs := NewUnionFs(fses, testOpts)
opts := &fuse.FileSystemOptions{
EntryTimeout: entryTtl,
AttrTimeout: entryTtl,
NegativeTimeout: entryTtl,
}
nfs := fuse.NewPathNodeFs(ufs, nil)
state, _, err := fuse.MountNodeFileSystem(wd+"/mnt", nfs, opts)
CheckSuccess(err)
defer state.Unmount()
state.Debug = fuse.VerboseTest()
go state.Loop()
log.Println("TestUnionFsDisappearing2")
err = ioutil.WriteFile(wd+"/ro/file", []byte("blabla"), 0644)
CheckSuccess(err)
freezeRo(wd + "/ro")
err = os.Remove(wd + "/mnt/file")
CheckSuccess(err)
oldRoot := wrFs.Root
wrFs.Root = "/dev/null"
time.Sleep(1.5 * entryTtl * 1e9)
_, err = ioutil.ReadDir(wd + "/mnt")
if err == nil {
t.Fatal("Readdir should have failed")
}
log.Println("expected readdir failure:", err)
err = ioutil.WriteFile(wd+"/mnt/file2", []byte("blabla"), 0644)
if err == nil {
t.Fatal("write should have failed")
}
log.Println("expected write failure:", err)
// Restore, and wait for caches to catch up.
wrFs.Root = oldRoot
time.Sleep(1.5 * entryTtl * 1e9)
_, err = ioutil.ReadDir(wd + "/mnt")
if err != nil {
t.Fatal("Readdir should succeed", err)
}
err = ioutil.WriteFile(wd+"/mnt/file2", []byte("blabla"), 0644)
if err != nil {
t.Fatal("write should succeed", err)
}
}
示例9: remove
func remove(path string) {
err := os.Remove(path)
fuse.CheckSuccess(err)
}