Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go-fuse
Commits
2fd32745
Commit
2fd32745
authored
Jul 19, 2013
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unionfs: test debug_setting symlink.
parent
27ecdf3b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
5 deletions
+52
-5
fuse/pathfs/api.go
fuse/pathfs/api.go
+3
-0
fuse/pathfs/default.go
fuse/pathfs/default.go
+2
-0
fuse/pathfs/locking.go
fuse/pathfs/locking.go
+5
-0
fuse/pathfs/prefixfs.go
fuse/pathfs/prefixfs.go
+4
-0
unionfs/autounion.go
unionfs/autounion.go
+1
-2
unionfs/autounion_race_test.go
unionfs/autounion_race_test.go
+35
-0
unionfs/autounion_test.go
unionfs/autounion_test.go
+2
-3
No files found.
fuse/pathfs/api.go
View file @
2fd32745
...
...
@@ -18,6 +18,9 @@ type FileSystem interface {
// Used for pretty printing.
String
()
string
// If called, provide debug output through the log package.
SetDebug
(
debug
bool
)
// Attributes. This function is the main entry point, through
// which FUSE discovers which files and directories exist.
//
...
...
fuse/pathfs/default.go
View file @
2fd32745
...
...
@@ -16,6 +16,8 @@ func NewDefaultFileSystem() FileSystem {
// defaultFileSystem implements a FileSystem that returns ENOSYS for every operation.
type
defaultFileSystem
struct
{}
func
(
fs
*
defaultFileSystem
)
SetDebug
(
debug
bool
)
{}
// defaultFileSystem
func
(
fs
*
defaultFileSystem
)
GetAttr
(
name
string
,
context
*
fuse
.
Context
)
(
*
fuse
.
Attr
,
fuse
.
Status
)
{
return
nil
,
fuse
.
ENOSYS
...
...
fuse/pathfs/locking.go
View file @
2fd32745
...
...
@@ -28,6 +28,11 @@ func (fs *lockingFileSystem) String() string {
return
fs
.
FS
.
String
()
}
func
(
fs
*
lockingFileSystem
)
SetDebug
(
debug
bool
)
{
defer
fs
.
locked
()()
fs
.
FS
.
SetDebug
(
debug
)
}
func
(
fs
*
lockingFileSystem
)
StatFs
(
name
string
)
*
fuse
.
StatfsOut
{
defer
fs
.
locked
()()
return
fs
.
FS
.
StatFs
(
name
)
...
...
fuse/pathfs/prefixfs.go
View file @
2fd32745
...
...
@@ -19,6 +19,10 @@ func NewPrefixFileSystem(fs FileSystem, prefix string) FileSystem {
return
&
prefixFileSystem
{
fs
,
prefix
}
}
func
(
fs
*
prefixFileSystem
)
SetDebug
(
debug
bool
)
{
fs
.
FileSystem
.
SetDebug
(
debug
)
}
func
(
fs
*
prefixFileSystem
)
prefixed
(
n
string
)
string
{
return
filepath
.
Join
(
fs
.
Prefix
,
n
)
}
...
...
unionfs/autounion.go
View file @
2fd32745
...
...
@@ -270,8 +270,7 @@ func (fs *autoUnionFs) Symlink(pointedTo string, linkName string, context *fuse.
}
func
(
fs
*
autoUnionFs
)
SetDebug
(
b
bool
)
{
// Officially, this should use locking, but we don't care
// about race conditions here.
// TODO(hanwen): this should use locking.
fs
.
debug
=
b
fs
.
nodeFs
.
SetDebug
(
b
)
...
...
unionfs/autounion_race_test.go
0 → 100644
View file @
2fd32745
// +build !race
package
unionfs
import
(
"os"
"testing"
"time"
)
// Ideally, this should check inject a logger rather than a boolean,
// so we can check if the messages are as we expect. Right now, this
// test requires visual inspection. When run with -v, the UNLINK reply
// and SYMLINK request are not printed.
func
TestToggleDebug
(
t
*
testing
.
T
)
{
wd
,
clean
:=
setup
(
t
)
defer
clean
()
os
.
Remove
(
wd
+
"/mnt/status/debug_setting"
)
time
.
Sleep
(
10
*
time
.
Millisecond
)
if
err
:=
os
.
Symlink
(
"xyz"
,
wd
+
"/mnt/status/debug_setting"
);
err
!=
nil
{
t
.
Fatalf
(
"Symlink: %v"
,
err
)
}
// now we should be in debug mode.
link
,
err
:=
os
.
Readlink
(
wd
+
"/mnt/status/debug_setting"
)
if
err
!=
nil
{
t
.
Fatalf
(
"Readlink: %v"
,
err
)
}
if
link
!=
"1"
{
t
.
Errorf
(
"got %q want %q for debug_setting readlink"
,
link
,
"1"
)
}
}
unionfs/autounion_test.go
View file @
2fd32745
...
...
@@ -53,12 +53,11 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
fs
:=
NewAutoUnionFs
(
wd
+
"/store"
,
testAOpts
)
nfs
:=
pathfs
.
NewPathNodeFs
(
fs
,
nil
)
state
,
conn
,
err
:=
nodefs
.
MountFileSystem
(
wd
+
"/mnt"
,
nfs
,
&
testAOpts
.
Options
)
state
,
_
,
err
:=
nodefs
.
MountFileSystem
(
wd
+
"/mnt"
,
nfs
,
&
testAOpts
.
Options
)
if
err
!=
nil
{
t
.
Fatalf
(
"MountNodeFileSystem failed: %v"
,
err
)
}
state
.
SetDebug
(
VerboseTest
())
conn
.
SetDebug
(
VerboseTest
())
fs
.
SetDebug
(
VerboseTest
())
go
state
.
Serve
()
return
wd
,
func
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment