From 77ff1b1808a442275d2d02d3948a00f2deebe2ad Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 22 Apr 2013 17:11:38 -0700 Subject: [PATCH] TESTS: make the "is readcapacity16 supported on this device" tests cleaner --- test-tool/test_readcapacity16_alloclen.c | 11 ++++++++--- test-tool/test_readcapacity16_simple.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/test-tool/test_readcapacity16_alloclen.c b/test-tool/test_readcapacity16_alloclen.c index ef57115..fee1f4f 100644 --- a/test-tool/test_readcapacity16_alloclen.c +++ b/test-tool/test_readcapacity16_alloclen.c @@ -36,9 +36,14 @@ test_readcapacity16_alloclen(void) for (i = 0; i < 16; i++) { ret = readcapacity16(iscsic, tgt_lun, i); - if (sbc3_support && ret == -2) { - logging(LOG_NORMAL, "[FAILED] READCAPACITY16 is not available but the device claims SBC-3 support."); - CU_FAIL("READCAPACITY16 failed but the device claims SBC-3 support."); + if (ret == -2) { + if (sbc3_support) { + logging(LOG_NORMAL, "[FAILED] READCAPACITY16 is not available but the device claims SBC-3 support."); + CU_FAIL("READCAPACITY16 failed but the device claims SBC-3 support."); + } else { + logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on this target and it does not claim SBC-3 support."); + CU_PASS("READCAPACITY16 is not implemented and no SBC-3 support claimed."); + } return; } CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_readcapacity16_simple.c b/test-tool/test_readcapacity16_simple.c index e9f7815..a7c187d 100644 --- a/test-tool/test_readcapacity16_simple.c +++ b/test-tool/test_readcapacity16_simple.c @@ -36,14 +36,14 @@ test_readcapacity16_simple(void) logging(LOG_VERBOSE, "Test that READCAPACITY16 works"); ret = readcapacity16(iscsic, tgt_lun, 16); - if (sbc3_support && ret == -2) { - logging(LOG_NORMAL, "[FAILED] READCAPACITY16 is not available but the device claims SBC-3 support."); - CU_FAIL("READCAPACITY16 failed but the device claims SBC-3 support."); - return; - } - if (!sbc3_support && ret == -2) { - logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on this target and it does not claim SBC-3 support."); - CU_PASS("READCAPACITY16 is not implemented and no SBC-3 support claimed."); + if (ret == -2) { + if (sbc3_support) { + logging(LOG_NORMAL, "[FAILED] READCAPACITY16 is not available but the device claims SBC-3 support."); + CU_FAIL("READCAPACITY16 failed but the device claims SBC-3 support."); + } else { + logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on this target and it does not claim SBC-3 support."); + CU_PASS("READCAPACITY16 is not implemented and no SBC-3 support claimed."); + } return; } CU_ASSERT_EQUAL(ret, 0);