Commit 51f7b76c authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Remove naming conflicts in newly added stackfs test code.

parent 02a3355d
...@@ -15,25 +15,10 @@ var _ = log.Println ...@@ -15,25 +15,10 @@ var _ = log.Println
//////////////// ////////////////
func IsDir(name string) bool {
fi, _ := os.Lstat(name)
return fi != nil && fi.IsDirectory()
}
func IsFile(name string) bool {
fi, _ := os.Lstat(name)
return fi != nil && fi.IsRegular()
}
func FileExists(name string) bool {
_, err := os.Lstat(name)
return err == nil
}
// Create and mount filesystem. // Create and mount filesystem.
const magicMode uint32 = 0753 const magicMode uint32 = 0753
type testCase struct { type stackFsTestCase struct {
origDir1 string origDir1 string
origDir2 string origDir2 string
mountDir string mountDir string
...@@ -44,7 +29,7 @@ type testCase struct { ...@@ -44,7 +29,7 @@ type testCase struct {
state *fuse.MountState state *fuse.MountState
} }
func (self *testCase) Setup(t *testing.T) { func (self *stackFsTestCase) Setup(t *testing.T) {
self.tester = t self.tester = t
self.testDir = fuse.MakeTempDir() self.testDir = fuse.MakeTempDir()
...@@ -80,7 +65,7 @@ func (self *testCase) Setup(t *testing.T) { ...@@ -80,7 +65,7 @@ func (self *testCase) Setup(t *testing.T) {
} }
// Unmount and del. // Unmount and del.
func (self *testCase) Cleanup() { func (self *stackFsTestCase) Cleanup() {
fmt.Println("Unmounting.") fmt.Println("Unmounting.")
err := self.state.Unmount() err := self.state.Unmount()
if err != nil { if err != nil {
...@@ -91,7 +76,7 @@ func (self *testCase) Cleanup() { ...@@ -91,7 +76,7 @@ func (self *testCase) Cleanup() {
//////////////// ////////////////
func (self *testCase) testReaddir() { func (self *stackFsTestCase) testReaddir() {
fmt.Println("testReaddir... ") fmt.Println("testReaddir... ")
dir, err := os.Open(self.mountDir, os.O_RDONLY, 0) dir, err := os.Open(self.mountDir, os.O_RDONLY, 0)
if err != nil { if err != nil {
...@@ -126,7 +111,7 @@ func (self *testCase) testReaddir() { ...@@ -126,7 +111,7 @@ func (self *testCase) testReaddir() {
} }
func (self *testCase) testSubFs() { func (self *stackFsTestCase) testSubFs() {
fmt.Println("testSubFs... ") fmt.Println("testSubFs... ")
for i := 1; i <= 2; i++ { for i := 1; i <= 2; i++ {
// orig := path.Join(self.testDir, fmt.Sprintf("orig%d", i)) // orig := path.Join(self.testDir, fmt.Sprintf("orig%d", i))
...@@ -181,7 +166,7 @@ func (self *testCase) testSubFs() { ...@@ -181,7 +166,7 @@ func (self *testCase) testSubFs() {
} }
} }
func (self *testCase) testAddRemove() { func (self *stackFsTestCase) testAddRemove() {
self.tester.Log("testAddRemove") self.tester.Log("testAddRemove")
attr := fuse.Attr{ attr := fuse.Attr{
Mode: 0755, Mode: 0755,
...@@ -229,10 +214,8 @@ func (self *testCase) testAddRemove() { ...@@ -229,10 +214,8 @@ func (self *testCase) testAddRemove() {
} }
} }
func TestStackFS(t *testing.T) {
// Test driver. ts := new(stackFsTestCase)
func TestMount(t *testing.T) {
ts := new(testCase)
ts.Setup(t) ts.Setup(t)
ts.testReaddir() ts.testReaddir()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment