summaryrefslogtreecommitdiff
path: root/internal/inomap/inomap_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-05-03 20:21:11 +0200
committerJakob Unterwurzacher2020-05-03 20:21:11 +0200
commit8c9c68fb724150654721bd665cc9233c641a0ea5 (patch)
treef4e032bf93d7f2e2014d6b03c9b51ebb9ca65ca7 /internal/inomap/inomap_test.go
parent91f5c242a8f4527f3266c09d7f18ff997593bafa (diff)
inomap: fix spillBit not set on 2nd hit
Also add a test for this. Thanks @slackner for the comment.
Diffstat (limited to 'internal/inomap/inomap_test.go')
-rw-r--r--internal/inomap/inomap_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/inomap/inomap_test.go b/internal/inomap/inomap_test.go
index 78cb405..931547e 100644
--- a/internal/inomap/inomap_test.go
+++ b/internal/inomap/inomap_test.go
@@ -99,6 +99,23 @@ func TestTranslateStress(t *testing.T) {
}
}
+func TestSpill(t *testing.T) {
+ m := New()
+ var q QIno
+ q.Ino = maxPassthruIno + 1
+ out1 := m.Translate(q)
+ if out1|spillBit == 0 {
+ t.Error("spill bit not set")
+ }
+ out2 := m.Translate(q)
+ if out2|spillBit == 0 {
+ t.Error("spill bit not set")
+ }
+ if out1 != out2 {
+ t.Errorf("unstable mapping: %d vs %d", out1, out2)
+ }
+}
+
// TestUniqueness checks that unique (Dev, Flags, Ino) tuples get unique inode
// numbers
func TestUniqueness(t *testing.T) {