diff options
author | Ayush Ranjan <ayushranjan@google.com> | 2019-07-29 18:32:45 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-07-29 18:33:55 -0700 |
commit | b765eb45894ea426d2c6d167b6ceb662db6ff4d2 (patch) | |
tree | 1dada0a548d86e6b34b01717a9f116a652d396da /pkg/sentry/fs/ext/extent_test.go | |
parent | a3e9031e665e5707ff1d181a577a808ff6d67452 (diff) |
ext: inode implementations.
PiperOrigin-RevId: 260624470
Diffstat (limited to 'pkg/sentry/fs/ext/extent_test.go')
-rw-r--r-- | pkg/sentry/fs/ext/extent_test.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/pkg/sentry/fs/ext/extent_test.go b/pkg/sentry/fs/ext/extent_test.go index b3f342c8e..01251d0a7 100644 --- a/pkg/sentry/fs/ext/extent_test.go +++ b/pkg/sentry/fs/ext/extent_test.go @@ -47,7 +47,13 @@ import ( func TestExtentTree(t *testing.T) { blkSize := uint64(64) // No block has more than 1 header + 4 entries. mockDisk := make([]byte, blkSize*10) - mockInode := &inode{diskInode: &disklayout.InodeNew{}} + mockExtentFile := extentFile{ + regFile: regularFile{ + inode: inode{ + diskInode: &disklayout.InodeNew{}, + }, + }, + } node3 := &disklayout.ExtentNode{ Header: disklayout.ExtentHeader{ @@ -138,15 +144,15 @@ func TestExtentTree(t *testing.T) { }, } - writeTree(mockInode, mockDisk, node0, blkSize) + writeTree(&mockExtentFile.regFile.inode, mockDisk, node0, blkSize) r := bytes.NewReader(mockDisk) - if err := mockInode.buildExtTree(r, blkSize); err != nil { + if err := mockExtentFile.buildExtTree(r, blkSize); err != nil { t.Fatalf("inode.buildExtTree failed: %v", err) } opt := cmpopts.IgnoreUnexported(disklayout.ExtentIdx{}, disklayout.ExtentHeader{}) - if diff := cmp.Diff(mockInode.root, node0, opt); diff != "" { + if diff := cmp.Diff(&mockExtentFile.root, node0, opt); diff != "" { t.Errorf("extent tree mismatch (-want +got):\n%s", diff) } } |