TEST: Add test that all mandatoryb VPD pages are available on SBC devices

This commit is contained in:
Ronnie Sahlberg
2013-03-12 19:26:39 -07:00
parent ec70169380
commit f11749ca52
4 changed files with 52 additions and 0 deletions

View File

@@ -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 \

View File

@@ -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
};

View File

@@ -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);

View File

@@ -0,0 +1,49 @@
/*
Copyright (C) 2013 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
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 <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <CUnit/CUnit.h>
#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);
}