From f11749ca527993c798191dc222dadcd545fa8c34 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Tue, 12 Mar 2013 19:26:39 -0700 Subject: [PATCH] TEST: Add test that all mandatoryb VPD pages are available on SBC devices --- Makefile.am | 1 + test-tool/iscsi-test-cu.c | 1 + test-tool/iscsi-test-cu.h | 1 + test-tool/test_inquiry_mandatory_vpd_sbc.c | 49 ++++++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 test-tool/test_inquiry_mandatory_vpd_sbc.c diff --git a/Makefile.am b/Makefile.am index 9d8f412..4f569c8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -192,6 +192,7 @@ bin_iscsi_test_cu_SOURCES = test-tool/iscsi-test-cu.c \ test-tool/test_inquiry_alloc_length.c \ test-tool/test_inquiry_evpd.c \ test-tool/test_inquiry_supported_vpd.c \ + test-tool/test_inquiry_mandatory_vpd_sbc.c \ test-tool/test_nomedia_sbc.c \ test-tool/test_orwrite_simple.c \ test-tool/test_orwrite_beyond_eol.c \ diff --git a/test-tool/iscsi-test-cu.c b/test-tool/iscsi-test-cu.c index 852b897..2d8640c 100644 --- a/test-tool/iscsi-test-cu.c +++ b/test-tool/iscsi-test-cu.c @@ -71,6 +71,7 @@ static CU_TestInfo tests_inquiry[] = { { (char *)"testInquiryAllocLength", test_inquiry_alloc_length}, { (char *)"testInquiryEVPD", test_inquiry_evpd}, { (char *)"testInquirySupportedVPD", test_inquiry_supported_vpd}, + { (char *)"testInquiryMandatoryVPDSBC", test_inquiry_mandatory_vpd_sbc}, CU_TEST_INFO_NULL }; diff --git a/test-tool/iscsi-test-cu.h b/test-tool/iscsi-test-cu.h index 180a0e4..e0c62d6 100644 --- a/test-tool/iscsi-test-cu.h +++ b/test-tool/iscsi-test-cu.h @@ -47,6 +47,7 @@ void test_inquiry_standard(void); void test_inquiry_alloc_length(void); void test_inquiry_evpd(void); void test_inquiry_supported_vpd(void); +void test_inquiry_mandatory_vpd_sbc(void); void test_nomedia_sbc(void); diff --git a/test-tool/test_inquiry_mandatory_vpd_sbc.c b/test-tool/test_inquiry_mandatory_vpd_sbc.c new file mode 100644 index 0000000..00926aa --- /dev/null +++ b/test-tool/test_inquiry_mandatory_vpd_sbc.c @@ -0,0 +1,49 @@ +/* + Copyright (C) 2013 by Ronnie Sahlberg + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . +*/ + +#include + +#include + +#include "iscsi.h" +#include "scsi-lowlevel.h" +#include "iscsi-support.h" +#include "iscsi-test-cu.h" + +void +test_inquiry_mandatory_vpd_sbc(void) +{ + int ret; + + logging(LOG_VERBOSE, LOG_BLANK_LINE); + logging(LOG_VERBOSE, "Test INQUIRY support for mandatory SBC VPD"); + + CHECK_FOR_SBC; + + + logging(LOG_VERBOSE, "SUPPORTED_VPD_PAGES is mandatory for SBC devices. Verify we can read it."); + ret = inquiry(iscsic, tgt_lun, + 1, SCSI_INQUIRY_PAGECODE_SUPPORTED_VPD_PAGES, + 255, NULL); + CU_ASSERT_EQUAL(ret, 0); + + logging(LOG_VERBOSE, "DEVICE_IDENTIFICATION is mandatory for SBC devices. Verify we can read it."); + ret = inquiry(iscsic, tgt_lun, + 1, SCSI_INQUIRY_PAGECODE_DEVICE_IDENTIFICATION, + 255, NULL); + CU_ASSERT_EQUAL(ret, 0); +}