Commit fe0d2505 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

os.Open API fixes for examplelib.

parent ffda34eb
......@@ -23,7 +23,7 @@ func TestMultiZipFs(t *testing.T) {
go state.Loop(true)
f, err := os.Open(mountPoint+"", os.O_RDONLY, 0)
f, err := os.Open(mountPoint + "")
CheckSuccess(err)
names, err := f.Readdirnames(-1)
......@@ -35,16 +35,16 @@ func TestMultiZipFs(t *testing.T) {
err = f.Close()
CheckSuccess(err)
f, err = os.Open(mountPoint+"/random", os.O_WRONLY|os.O_CREATE, 0)
f, err = os.Create(mountPoint + "/random")
if err == nil {
t.Error("Must fail writing in root.")
}
f, err = os.Open(mountPoint+"/config/zipmount", os.O_WRONLY, 0)
f, err = os.OpenFile(mountPoint+"/config/zipmount", os.O_WRONLY, 0)
if err == nil {
t.Error("Must fail without O_CREATE")
}
f, err = os.Open(mountPoint+"/config/zipmount", os.O_WRONLY|os.O_CREATE, 0)
f, err = os.Create(mountPoint + "/config/zipmount")
CheckSuccess(err)
// Directory exists, but is empty.
......
......@@ -76,7 +76,7 @@ func (me *stackFsTestCase) Cleanup() {
func (me *stackFsTestCase) testReaddir() {
fmt.Println("testReaddir... ")
dir, err := os.Open(me.mountDir, os.O_RDONLY, 0)
dir, err := os.Open(me.mountDir)
CheckSuccess(err)
infos, err := dir.Readdir(10)
CheckSuccess(err)
......@@ -114,13 +114,13 @@ func (me *stackFsTestCase) testSubFs() {
mountFile := filepath.Join(mount, name)
f, err := os.Open(mountFile, os.O_WRONLY, 0)
f, err := os.OpenFile(mountFile, os.O_WRONLY, 0)
if err == nil {
me.tester.Errorf("Expected error for open write %v", name)
continue
}
content1 := "booh!"
f, err = os.Open(mountFile, os.O_WRONLY|os.O_CREATE, magicMode)
f, err = os.Create(mountFile)
CheckSuccess(err)
f.Write([]byte(content1))
......@@ -135,7 +135,7 @@ func (me *stackFsTestCase) testSubFs() {
me.tester.Errorf("Mode %o", fi.Mode)
}
g, err := os.Open(mountFile, os.O_RDONLY, 0)
g, err := os.Open(mountFile)
CheckSuccess(err)
buf := make([]byte, 1024)
......@@ -177,7 +177,7 @@ func (me *stackFsTestCase) testAddRemove() {
if fs == nil {
me.tester.Errorf("remove fail")
}
dir, err := os.Open(me.mountDir, os.O_RDONLY, 0)
dir, err := os.Open(me.mountDir)
CheckSuccess(err)
infos, err := dir.Readdir(10)
CheckSuccess(err)
......@@ -186,7 +186,7 @@ func (me *stackFsTestCase) testAddRemove() {
}
dir.Close()
_, err = os.Open(filepath.Join(me.mountDir, "third"), os.O_RDONLY, 0)
_, err = os.Open(filepath.Join(me.mountDir, "third"))
if err == nil {
me.tester.Errorf("expect enoent %v", err)
}
......
......@@ -19,7 +19,7 @@ func TestZipFs(t *testing.T) {
go state.Loop(false)
d, err := os.Open(mountPoint, os.O_RDONLY, 0)
d, err := os.Open(mountPoint)
CheckSuccess(err)
names, err := d.Readdirnames(-1)
......@@ -43,7 +43,7 @@ func TestZipFs(t *testing.T) {
t.Error("file type", fi)
}
f, err := os.Open(mountPoint+"/file.txt", os.O_RDONLY, 0)
f, err := os.Open(mountPoint + "/file.txt")
CheckSuccess(err)
b := make([]byte, 1024)
......
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