btrfs: Add self-tests for btrfs_rmap_block
A message that is not in the archive (sent off-list or not yet received): [email protected]
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
@@ -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
Quoted 27 lines · Nikolay Borisov
This is enough to exercise out of boundary address exclusion as well as address matching.
Signed-off-by Nikolay Borisov <[email protected]>---
V3:
* Defined "failed to alloc device" as intest_error
* Don't capitalize first letter in error messages
* Added proper handling ofadd_extent_mappingerrorV2:
* Adjusted comments about some members of structrmap_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 initializationfs/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
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,
};