summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/ext4/disklayout/test_utils.go
diff options
context:
space:
mode:
authorAyush Ranjan <ayushranjan@google.com>2019-06-28 16:17:19 -0700
committergVisor bot <gvisor-bot@google.com>2019-06-28 16:18:29 -0700
commitc4da599e22e1490dc2a108cbf85ba19af2f5e2df (patch)
treec98f6b3a8d92f88ec365b2164e9edd9474ebb2cb /pkg/sentry/fs/ext4/disklayout/test_utils.go
parentcf51e77d6d7cf5302f03812bb726a86e9be572f5 (diff)
ext4: disklayout: SuperBlock interface implementations.
PiperOrigin-RevId: 255687771
Diffstat (limited to 'pkg/sentry/fs/ext4/disklayout/test_utils.go')
-rw-r--r--pkg/sentry/fs/ext4/disklayout/test_utils.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/pkg/sentry/fs/ext4/disklayout/test_utils.go b/pkg/sentry/fs/ext4/disklayout/test_utils.go
new file mode 100644
index 000000000..9c63f04c0
--- /dev/null
+++ b/pkg/sentry/fs/ext4/disklayout/test_utils.go
@@ -0,0 +1,30 @@
+// Copyright 2019 The gVisor Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package disklayout
+
+import (
+ "reflect"
+ "testing"
+
+ "gvisor.dev/gvisor/pkg/binary"
+)
+
+func assertSize(t *testing.T, v interface{}, want uintptr) {
+ t.Helper()
+
+ if got := binary.Size(v); got != want {
+ t.Errorf("struct %s should be exactly %d bytes but is %d bytes", reflect.TypeOf(v).Name(), want, got)
+ }
+}