Commit 0531d69c authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

unionfs: skip xattr test if we're running very slowly

The timed cache expires after some time, so if the test ran slowly, we
cannot reliably test the cache's functionality.
parent 32b02fb6
...@@ -79,6 +79,7 @@ func TestXAttrCaching(t *testing.T) { ...@@ -79,6 +79,7 @@ func TestXAttrCaching(t *testing.T) {
go server.Serve() go server.Serve()
server.WaitMount() server.WaitMount()
start := time.Now()
if fi, err := os.Lstat(wd + "/mnt"); err != nil || !fi.IsDir() { if fi, err := os.Lstat(wd + "/mnt"); err != nil || !fi.IsDir() {
t.Fatalf("root not readable: %v, %v", err, fi) t.Fatalf("root not readable: %v, %v", err, fi)
} }
...@@ -118,6 +119,13 @@ func TestXAttrCaching(t *testing.T) { ...@@ -118,6 +119,13 @@ func TestXAttrCaching(t *testing.T) {
if got != want { if got != want {
t.Fatalf("Got %q want %q", got, err) t.Fatalf("Got %q want %q", got, err)
} }
if time.Now().Sub(start) >= entryTTL {
// If we run really slowly, this test will spuriously
// fail.
t.Skip("test took too long.")
}
actual := atomic.LoadInt64(&roFS.xattrRead) actual := atomic.LoadInt64(&roFS.xattrRead)
if actual != 1 { if actual != 1 {
t.Errorf("got xattrRead=%d, want 1", actual) t.Errorf("got xattrRead=%d, want 1", actual)
......
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