Commit 426a23cf authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

UnionF: Expand the RemoveAll test.

parent c7e29df4
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
"io/ioutil" "io/ioutil"
"fmt" "fmt"
"log" "log"
"path/filepath"
"syscall" "syscall"
"testing" "testing"
"time" "time"
...@@ -645,11 +646,11 @@ func TestRemoveAll(t *testing.T) { ...@@ -645,11 +646,11 @@ func TestRemoveAll(t *testing.T) {
wd, clean := setupUfs(t) wd, clean := setupUfs(t)
defer clean() defer clean()
err := os.Mkdir(wd+"/ro/dir", 0755) err := os.MkdirAll(wd+"/ro/dir/subdir", 0755)
CheckSuccess(err) CheckSuccess(err)
contents := "hello" contents := "hello"
fn := wd + "/ro/dir/y" fn := wd + "/ro/dir/subdir/y"
err = ioutil.WriteFile(fn, []byte(contents), 0644) err = ioutil.WriteFile(fn, []byte(contents), 0644)
CheckSuccess(err) CheckSuccess(err)
...@@ -657,6 +658,18 @@ func TestRemoveAll(t *testing.T) { ...@@ -657,6 +658,18 @@ func TestRemoveAll(t *testing.T) {
if err != nil { if err != nil {
t.Error("Should delete all") t.Error("Should delete all")
} }
for _, f := range []string{"dir/subdir/y", "dir/subdir", "dir"} {
if fi, _ := os.Lstat(filepath.Join(wd, "mount", f)); fi != nil {
t.Errorf("file %s should have disappeared: %v", f, fi)
}
}
names, err := Readdirnames(wd + "/rw/DELETIONS")
CheckSuccess(err)
if len(names) != 3 {
t.Fatal("unexpected names", names)
}
} }
func Readdirnames(dir string) ([]string, os.Error) { func Readdirnames(dir string) ([]string, os.Error) {
......
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