TESTS: add a flag --usb so we can clamp all i/o to at most 120k
Add checks for maximum tranfer length to all commands that are limited by BlockLimits/MTL
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <alloca.h>
|
||||
|
||||
#include <CUnit/CUnit.h>
|
||||
|
||||
@@ -29,6 +30,7 @@ void
|
||||
test_orwrite_simple(void)
|
||||
{
|
||||
int i, ret;
|
||||
unsigned char *buf = alloca(256 * block_size);
|
||||
|
||||
CHECK_FOR_DATALOSS;
|
||||
CHECK_FOR_SBC;
|
||||
@@ -37,11 +39,11 @@ test_orwrite_simple(void)
|
||||
logging(LOG_VERBOSE, "Test ORWRITE of 1-256 blocks at the start of the LUN");
|
||||
|
||||
for (i = 1; i <= 256; i++) {
|
||||
unsigned char *buf = malloc(block_size * i);
|
||||
|
||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||
break;
|
||||
}
|
||||
ret = orwrite(iscsic, tgt_lun, 0, i * block_size,
|
||||
block_size, 0, 0, 0, 0, 0, buf);
|
||||
free(buf);
|
||||
if (ret == -2) {
|
||||
logging(LOG_NORMAL, "[SKIPPED] ORWRITE is not implemented.");
|
||||
CU_PASS("ORWRITE is not implemented.");
|
||||
@@ -52,11 +54,11 @@ test_orwrite_simple(void)
|
||||
|
||||
logging(LOG_VERBOSE, "Test ORWRITE of 1-256 blocks at the end of the LUN");
|
||||
for (i = 1; i <= 256; i++) {
|
||||
unsigned char *buf = malloc(block_size * i);
|
||||
|
||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||
break;
|
||||
}
|
||||
ret = orwrite(iscsic, tgt_lun, num_blocks - i,
|
||||
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
|
||||
free(buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user