Skip to content

Commit d5fac7d

Browse files
naotakdave
authored andcommitted
btrfs: tests: fix return 0 on rmap test failure
In test_rmap_blocks(), we have ret = 0 before checking the results. We need to set it to -EINVAL, so that a mismatching result will return -EINVAL not 0. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent be1c2e8 commit d5fac7d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fs/btrfs/tests/extent-map-tests.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,19 +1059,22 @@ static int test_rmap_block(struct btrfs_fs_info *fs_info,
10591059

10601060
if (out_stripe_len != BTRFS_STRIPE_LEN) {
10611061
test_err("calculated stripe length doesn't match");
1062+
ret = -EINVAL;
10621063
goto out;
10631064
}
10641065

10651066
if (out_ndaddrs != test->expected_mapped_addr) {
10661067
for (i = 0; i < out_ndaddrs; i++)
10671068
test_msg("mapped %llu", logical[i]);
10681069
test_err("unexpected number of mapped addresses: %d", out_ndaddrs);
1070+
ret = -EINVAL;
10691071
goto out;
10701072
}
10711073

10721074
for (i = 0; i < out_ndaddrs; i++) {
10731075
if (logical[i] != test->mapped_logical[i]) {
10741076
test_err("unexpected logical address mapped");
1077+
ret = -EINVAL;
10751078
goto out;
10761079
}
10771080
}

0 commit comments

Comments
 (0)