Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Naohiro Aota and committed by
David Sterba
d5fac7dd be1c2e8a

+3
+3
fs/btrfs/tests/extent-map-tests.c
··· 1059 1059 1060 1060 if (out_stripe_len != BTRFS_STRIPE_LEN) { 1061 1061 test_err("calculated stripe length doesn't match"); 1062 + ret = -EINVAL; 1062 1063 goto out; 1063 1064 } 1064 1065 ··· 1067 1066 for (i = 0; i < out_ndaddrs; i++) 1068 1067 test_msg("mapped %llu", logical[i]); 1069 1068 test_err("unexpected number of mapped addresses: %d", out_ndaddrs); 1069 + ret = -EINVAL; 1070 1070 goto out; 1071 1071 } 1072 1072 1073 1073 for (i = 0; i < out_ndaddrs; i++) { 1074 1074 if (logical[i] != test->mapped_logical[i]) { 1075 1075 test_err("unexpected logical address mapped"); 1076 + ret = -EINVAL; 1076 1077 goto out; 1077 1078 } 1078 1079 }