TESTS more writesame1* test fixes

This commit is contained in:
Ronnie Sahlberg
2013-08-25 16:39:38 -07:00
parent ab600e39b0
commit daac72a8f9
11 changed files with 51 additions and 54 deletions

View File

@@ -16,6 +16,7 @@
*/
#include <stdio.h>
#include <alloca.h>
#include <CUnit/CUnit.h>
@@ -28,6 +29,7 @@ void
test_writesame10_beyond_eol(void)
{
int i, ret;
unsigned char *buf = alloca(block_size);
CHECK_FOR_DATALOSS;
CHECK_FOR_SBC;
@@ -39,13 +41,11 @@ test_writesame10_beyond_eol(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITESAME10 1-256 blocks one block beyond the end");
memset(buf, 0, block_size);
for (i = 1; i <= 256; i++) {
unsigned char *buf = malloc(block_size);
ret = writesame10_lbaoutofrange(iscsic, tgt_lun, num_blocks - i + 1,
block_size, i,
0, 0, 0, 0, buf);
free(buf);
if (ret == -2) {
CU_PASS("[SKIPPED] Target does not support WRITESAME10. Skipping test");
return;
@@ -56,36 +56,27 @@ test_writesame10_beyond_eol(void)
logging(LOG_VERBOSE, "Test WRITESAME10 1-256 blocks at LBA==2^31");
for (i = 1; i <= 256; i++) {
unsigned char *buf = malloc(block_size);
ret = writesame10_lbaoutofrange(iscsic, tgt_lun, 0x80000000,
block_size, i,
0, 0, 0, 0, buf);
free(buf);
CU_ASSERT_EQUAL(ret, 0);
}
logging(LOG_VERBOSE, "Test WRITESAME10 1-256 blocks at LBA==-1");
for (i = 1; i <= 256; i++) {
unsigned char *buf = malloc(block_size);
ret = writesame10_lbaoutofrange(iscsic, tgt_lun, -1,
block_size, i,
0, 0, 0, 0, buf);
free(buf);
CU_ASSERT_EQUAL(ret, 0);
}
logging(LOG_VERBOSE, "Test WRITESAME10 2-256 blocks all but one block beyond the end");
for (i = 2; i <= 256; i++) {
unsigned char *buf = malloc(block_size);
ret = writesame10_lbaoutofrange(iscsic, tgt_lun, num_blocks - 1,
block_size, i,
0, 0, 0, 0, buf);
free(buf);
CU_ASSERT_EQUAL(ret, 0);
}
}