diff --git a/test-tool/test_unmap_0blocks.c b/test-tool/test_unmap_0blocks.c index 063b798..76a7387 100644 --- a/test-tool/test_unmap_0blocks.c +++ b/test-tool/test_unmap_0blocks.c @@ -45,15 +45,6 @@ test_unmap_0blocks(void) 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"); list[0].lba = num_blocks; list[0].num = 0; @@ -61,6 +52,25 @@ test_unmap_0blocks(void) EXPECT_STATUS_GOOD); 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\"."); for (i = 0; i < 256; i++) { @@ -70,11 +80,4 @@ test_unmap_0blocks(void) ret = unmap(sd, 0, list, 256, EXPECT_STATUS_GOOD); 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); - }