Commit 6aa09dea authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

unionfs: remove TestUnionFsFdLeak

TestUnionFsFdLeak looks at global state of the program, and is flaky:
the splice pool keeps open file descriptors, and its number depends on
how many read threads are scheduled in parallel.
parent 875784b3
// Copyright 2016 the Go-FUSE Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package unionfs
import (
"io/ioutil"
"testing"
)
func TestUnionFsFdLeak(t *testing.T) {
beforeEntries, err := ioutil.ReadDir("/proc/self/fd")
if err != nil {
t.Fatalf("ReadDir failed: %v", err)
}
wd, clean := setupUfs(t)
err = ioutil.WriteFile(wd+"/ro/file", []byte("blablabla"), 0644)
if err != nil {
t.Fatalf("WriteFile failed: %v", err)
}
setRecursiveWritable(t, wd+"/ro", false)
contents, err := ioutil.ReadFile(wd + "/mnt/file")
if err != nil {
t.Fatalf("ReadFile failed: %v", err)
}
err = ioutil.WriteFile(wd+"/mnt/file", contents, 0644)
if err != nil {
t.Fatalf("WriteFile failed: %v", err)
}
clean()
afterEntries, err := ioutil.ReadDir("/proc/self/fd")
if err != nil {
t.Fatalf("ReadDir failed: %v", err)
}
if len(afterEntries) != len(beforeEntries) {
t.Errorf("/proc/self/fd changed size: after %v before %v", len(beforeEntries), len(afterEntries))
}
}
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