test_unmap_0blocks: skip multi-descriptor test if unsupported
Some targets only support a single descriptor for unmap operations, so skip (CU_PASS) the test cases that use multiple descriptors in those cases. Only run the tests if maximum_unmap_block_descriptor_count is less than 2. Also the test "Test UNMAP of 0 blocks at LBA:0-255 with one descriptor per block") was passing one less descriptor. Signed-off-by: Chris Zankel <chris@zankel.net>
This commit is contained in:
@@ -45,15 +45,6 @@ test_unmap_0blocks(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test UNMAP of 0 blocks at LBA:0-255 with one descriptor per block");
|
|
||||||
for (i = 0; i < 256; i++) {
|
|
||||||
list[i].lba = i;
|
|
||||||
list[i].num = 0;
|
|
||||||
ret = unmap(sd, 0, list, i,
|
|
||||||
EXPECT_STATUS_GOOD);
|
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test UNMAP of 0 blocks at end-of-LUN");
|
logging(LOG_VERBOSE, "Test UNMAP of 0 blocks at end-of-LUN");
|
||||||
list[0].lba = num_blocks;
|
list[0].lba = num_blocks;
|
||||||
list[0].num = 0;
|
list[0].num = 0;
|
||||||
@@ -61,6 +52,25 @@ test_unmap_0blocks(void)
|
|||||||
EXPECT_STATUS_GOOD);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
logging(LOG_VERBOSE, "Test UNMAP without any descriptors.");
|
||||||
|
ret = unmap(sd, 0, list, 0,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
|
if (inq_bl->max_unmap_bdc <= 1) {
|
||||||
|
CU_PASS("[SKIPPING] Test UNMAP of 0 blocks with multiple descriptos not supported");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
logging(LOG_VERBOSE, "Test UNMAP of 0 blocks at LBA:0-255 with one descriptor per block");
|
||||||
|
for (i = 0; i < 256; i++) {
|
||||||
|
list[i].lba = i;
|
||||||
|
list[i].num = 0;
|
||||||
|
ret = unmap(sd, 0, list, i + 1,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
}
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test UNMAP of 0 blocks at LBA:0-255 with one descriptor per block, possibly \"overlapping\".");
|
logging(LOG_VERBOSE, "Test UNMAP of 0 blocks at LBA:0-255 with one descriptor per block, possibly \"overlapping\".");
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
@@ -70,11 +80,4 @@ test_unmap_0blocks(void)
|
|||||||
ret = unmap(sd, 0, list, 256,
|
ret = unmap(sd, 0, list, 256,
|
||||||
EXPECT_STATUS_GOOD);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test UNMAP without any descriptors.");
|
|
||||||
ret = unmap(sd, 0, list, 0,
|
|
||||||
EXPECT_STATUS_GOOD);
|
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user