Skip to contentSkip to conversation

btrfs: Add self-tests for btrfs_rmap_block

PATCH In review Nikolay Borisov 1 participant 2 messages Jan 13, 2020 1 message not in the archive Btrfs file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v3 1/1 btrfs: Add self-tests for btrfs_rmap_block

This is enough to exercise out of boundary address exclusion as well as address matching.

---

V3:
* Defined "failed to alloc device" as in test_error
* Don't capitalize first letter in error messages
* Added proper handling of add_extent_mapping error

V2:
* Adjusted comments about some members of struct rmap_test_vector
* Fixed inline comments
* Correctly handle error when initialising dummy device
* Other minor cosmetic changes around comments/braces for single statement 'if' and structure initialization

 fs/btrfs/tests/btrfs-tests.c      |   1 +
 fs/btrfs/tests/extent-map-tests.c | 149 +++++++++++++++++++++++++++++-
 2 files changed, 149 insertions(+), 1 deletion(-)
fs/btrfs/tests/btrfs-tests.c +1 -0
index 1710f2533d04..c13ed41d4e9f 100644
@@ -27,6 +27,7 @@ const char *test_error[] = {
 	[TEST_ALLOC_INODE]	     = "cannot allocate inode",
 	[TEST_ALLOC_BLOCK_GROUP]     = "cannot allocate block group",
 	[TEST_ALLOC_EXTENT_MAP]      = "cannot allocate extent map",
+	[TEST_ALLOC_DEVICE]	     = "cannot allocate device",
 };
 
 static const struct super_operations btrfs_test_super_ops = {
fs/btrfs/tests/extent-map-tests.c +148 -1

171 lines not on this page · raw message

--
2.17.1

#2 lore raw
Quoted 27 lines · Nikolay Borisov

This is enough to exercise out of boundary address exclusion as well as address matching.

---

V3:
* Defined "failed to alloc device" as in test_error
* Don't capitalize first letter in error messages
* Added proper handling of add_extent_mapping error

V2:
* Adjusted comments about some members of struct rmap_test_vector
* Fixed inline comments
* Correctly handle error when initialising dummy device
* Other minor cosmetic changes around comments/braces for single statement 'if' and structure initialization

 fs/btrfs/tests/btrfs-tests.c      |   1 +
 fs/btrfs/tests/extent-map-tests.c | 149 +++++++++++++++++++++++++++++-
 2 files changed, 149 insertions(+), 1 deletion(-)
fs/btrfs/tests/btrfs-tests.c +0 -0
index 1710f2533d04..c13ed41d4e9f 100644

fs/btrfs/tests/btrfs-tests.c const char *test_error[] = { · line 32

Quoted 6 lines
fs/btrfs/tests/btrfs-tests.c +1 -0
@@ -27,6 +27,7 @@ const char *test_error[] = {
 	[TEST_ALLOC_INODE]	     = "cannot allocate inode",
 	[TEST_ALLOC_BLOCK_GROUP]     = "cannot allocate block group",
 	[TEST_ALLOC_EXTENT_MAP]      = "cannot allocate extent map",
+	[TEST_ALLOC_DEVICE]	     = "cannot allocate device",
 };
 

Meh, this patch also needs the following hunk:

fs/btrfs/tests/btrfs-tests.h +0 -0

index 7a2d7ffbe30e..f6f1c173a530 100644

--- a/fs/btrfs/tests/btrfs-tests.h

+++ b/fs/btrfs/tests/btrfs-tests.h

@@ -23,6 +23,7 @@ enum {

TEST_ALLOC_INODE,

TEST_ALLOC_BLOCK_GROUP,

TEST_ALLOC_EXTENT_MAP,

+ TEST_ALLOC_DEVICE,

};