TEST: REPORT SUPPORTED OPCODES, SERVACTV
When this flag is clear then service action must be zero.
This commit is contained in:
@@ -257,6 +257,7 @@ bin_iscsi_test_cu_SOURCES = test-tool/iscsi-test-cu.c \
|
||||
test-tool/test_readonly_sbc.c \
|
||||
test-tool/test_report_supported_opcodes_simple.c \
|
||||
test-tool/test_report_supported_opcodes_rctd.c \
|
||||
test-tool/test_report_supported_opcodes_servactv.c \
|
||||
test-tool/test_reserve6_simple.c \
|
||||
test-tool/test_reserve6_2initiators.c \
|
||||
test-tool/test_reserve6_logout.c \
|
||||
|
||||
@@ -224,6 +224,7 @@ static CU_TestInfo tests_readonly[] = {
|
||||
static CU_TestInfo tests_report_supported_opcodes[] = {
|
||||
{ (char *)"ReportSupportedOpcodesSimple", test_report_supported_opcodes_simple },
|
||||
{ (char *)"ReportSupportedOpcodesRCTD", test_report_supported_opcodes_rctd },
|
||||
{ (char *)"ReportSupportedOpcodesSERVACTV", test_report_supported_opcodes_servactv },
|
||||
CU_TEST_INFO_NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -140,6 +140,7 @@ void test_readonly_sbc(void);
|
||||
|
||||
void test_report_supported_opcodes_simple(void);
|
||||
void test_report_supported_opcodes_rctd(void);
|
||||
void test_report_supported_opcodes_servactv(void);
|
||||
|
||||
void test_reserve6_simple(void);
|
||||
void test_reserve6_2initiators(void);
|
||||
|
||||
72
test-tool/test_report_supported_opcodes_servactv.c
Normal file
72
test-tool/test_report_supported_opcodes_servactv.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
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_report_supported_opcodes_servactv(void)
|
||||
{
|
||||
int i, ret;
|
||||
struct scsi_task *rso_task;
|
||||
struct scsi_report_supported_op_codes *rsoc;
|
||||
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES SERVACTV flag");
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES report ALL opcodes "
|
||||
"without timeout descriptors");
|
||||
ret = report_supported_opcodes(iscsic, tgt_lun,
|
||||
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
|
||||
65535, &rso_task);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] READ_SUPPORTED_OPCODES is not "
|
||||
"implemented.");
|
||||
CU_PASS("READ_SUPPORTED_OPCODES is not implemented.");
|
||||
return;
|
||||
}
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
if (ret != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
|
||||
rsoc = scsi_datain_unmarshall(rso_task);
|
||||
CU_ASSERT_NOT_EQUAL(rsoc, NULL);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Verify that when SERVACTV is clear then "
|
||||
"ServiceAction must be zero.");
|
||||
for (i = 0; i < rsoc->num_descriptors; i++) {
|
||||
if (!rsoc->descriptors[i].servactv && rsoc->descriptors[i].sa) {
|
||||
logging(LOG_NORMAL, "[FAILED] ServiceAction is "
|
||||
"non-zero but SERVACTV is clear");
|
||||
CU_FAIL("[FAILED] ServiceAction is "
|
||||
"non-zero but SERVACTV is clear");
|
||||
}
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(rso_task);
|
||||
}
|
||||
Reference in New Issue
Block a user