From f6c4a82a225caea553dc342744ca06d1c7712aac Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 5 Mar 2014 10:42:01 +0100 Subject: [PATCH] test_writesame*_0blocks.c: Include WSNZ bit in test From the SBC-4 section about the block limits VPD page: "A write same non-zero (WSNZ) bit set to one indicates that the device server does not support a value of zero in the NUMBER OF LOGICAL BLOCKS field in the WRITE SAME command CDBs (see 5.45, 5.46, and 5.47). A WSNZ bit set to zero indicates that the device server may or may not support a value of zero in the NUMBER OF LOGICAL BLOCKS field of the WRITE SAME commands." Hence verify that WRITE SAME with NUMBER OF LOGICAL BLOCKS set to zero fails if WSNZ = 0. Signed-off-by: Bart Van Assche --- test-tool/test_writesame10_0blocks.c | 9 +++++++-- test-tool/test_writesame16_0blocks.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/test-tool/test_writesame10_0blocks.c b/test-tool/test_writesame10_0blocks.c index 8f8fd2a..a9b0c0b 100644 --- a/test-tool/test_writesame10_0blocks.c +++ b/test-tool/test_writesame10_0blocks.c @@ -37,7 +37,8 @@ test_writesame10_0blocks(void) } logging(LOG_VERBOSE, LOG_BLANK_LINE); - logging(LOG_VERBOSE, "Test WRITESAME10 0-blocks at LBA==0"); + logging(LOG_VERBOSE, "Test WRITESAME10 0-blocks at LBA==0 (WSNZ=%d)", + inq_bl->wsnz); ret = writesame10(iscsic, tgt_lun, 0, block_size, 0, 0, 0, 0, 0, NULL); @@ -49,7 +50,11 @@ test_writesame10_0blocks(void) } else if (ret == -4) { CU_PASS("[SKIPPED] Number of WRITESAME10 logical blocks to be written exceeds MAXIMUM WRITE SAME LENGTH"); } else { - CU_ASSERT_EQUAL(ret, 0); + if (inq_bl->wsnz) { + CU_ASSERT_EQUAL(ret, -1); + } else { + CU_ASSERT_EQUAL(ret, 0); + } } logging(LOG_VERBOSE, "Test WRITESAME10 0-blocks one block past end-of-LUN"); diff --git a/test-tool/test_writesame16_0blocks.c b/test-tool/test_writesame16_0blocks.c index 4f8a74b..371e0d9 100644 --- a/test-tool/test_writesame16_0blocks.c +++ b/test-tool/test_writesame16_0blocks.c @@ -32,7 +32,8 @@ test_writesame16_0blocks(void) CHECK_FOR_SBC; logging(LOG_VERBOSE, LOG_BLANK_LINE); - logging(LOG_VERBOSE, "Test WRITESAME16 0-blocks at LBA==0"); + logging(LOG_VERBOSE, "Test WRITESAME16 0-blocks at LBA==0 (WSNZ=%d)", + inq_bl->wsnz); ret = writesame16(iscsic, tgt_lun, 0, block_size, 0, 0, 0, 0, 0, NULL); @@ -45,7 +46,11 @@ test_writesame16_0blocks(void) } else if (ret == -4) { CU_PASS("[SKIPPED] Number of WRITESAME16 logical blocks to be written exceeds MAXIMUM WRITE SAME LENGTH"); } else { - CU_ASSERT_EQUAL(ret, 0); + if (inq_bl->wsnz) { + CU_ASSERT_EQUAL(ret, -1); + } else { + CU_ASSERT_EQUAL(ret, 0); + } } logging(LOG_VERBOSE, "Test WRITESAME16 0-blocks one block past end-of-LUN");