From d38cf7cfcdfe1249283931badaa24213cbddffce Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Tue, 30 Apr 2013 19:17:59 -0700 Subject: [PATCH] TESTS: since we track expcmdsn we dont need to keep the old value around in a static variable --- test-tool/test_iscsi_cmdsn_toohigh.c | 9 +-------- test-tool/test_iscsi_cmdsn_toolow.c | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/test-tool/test_iscsi_cmdsn_toohigh.c b/test-tool/test_iscsi_cmdsn_toohigh.c index 24aebbb..caffb63 100644 --- a/test-tool/test_iscsi_cmdsn_toohigh.c +++ b/test-tool/test_iscsi_cmdsn_toohigh.c @@ -28,20 +28,14 @@ static int change_cmdsn; static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) { - static uint32_t old_cmdsn; - switch (change_cmdsn) { case 1: - old_cmdsn = *(uint32_t *)&pdu->outdata.data[24]; /* change the cmdsn so it becomes too big */ *(uint32_t *)&pdu->outdata.data[24] = htonl(iscsi->maxcmdsn + 1); /* fudge the cmdsn value back to where it should be if this * pdu is ignored. */ - iscsi->cmdsn--; - break; - case 2: - *(uint32_t *)&pdu->outdata.data[24] = old_cmdsn; + iscsi->cmdsn = iscsi->expcmdsn; break; } @@ -81,7 +75,6 @@ void test_iscsi_cmdsn_toohigh(void) iscsi_set_noautoreconnect(iscsic, 0); logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN. should work again"); - change_cmdsn = 2; ret = testunitready(iscsic, tgt_lun); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_iscsi_cmdsn_toolow.c b/test-tool/test_iscsi_cmdsn_toolow.c index fdf7713..d7357b2 100644 --- a/test-tool/test_iscsi_cmdsn_toolow.c +++ b/test-tool/test_iscsi_cmdsn_toolow.c @@ -28,20 +28,14 @@ static int change_cmdsn; static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) { - static uint32_t old_cmdsn; - switch (change_cmdsn) { case 1: - old_cmdsn = *(uint32_t *)&pdu->outdata.data[24]; /* change the cmdsn so it becomes too big */ *(uint32_t *)&pdu->outdata.data[24] = htonl(iscsi->expcmdsn + 1); /* fudge the cmdsn value back to where it should be if this * pdu is ignored. */ - iscsi->cmdsn--; - break; - case 2: - *(uint32_t *)&pdu->outdata.data[24] = old_cmdsn; + iscsi->cmdsn = iscsi->expcmdsn; break; } @@ -82,7 +76,6 @@ void test_iscsi_cmdsn_toolow(void) iscsi_set_noautoreconnect(iscsic, 0); logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN. should work again"); - change_cmdsn = 2; ret = testunitready(iscsic, tgt_lun); CU_ASSERT_EQUAL(ret, 0);