Bugfixes for the compare and write tests

This commit is contained in:
Ronnie Sahlberg
2012-07-14 13:15:45 +10:00
parent 17e3355dc2
commit b5a6f7c3cb
2 changed files with 18 additions and 17 deletions

View File

@@ -81,6 +81,7 @@ int T0340_compareandwrite_simple(const char *initiator, const char *url, int dat
ret = 0;
/* write the first 1 - 255 blocks at the start of the LUN */
printf("Compare and write first 1-255 blocks ... ");
for (i = 1; i < 256; i++) {
@@ -129,9 +130,9 @@ int T0340_compareandwrite_simple(const char *initiator, const char *url, int dat
test2:
/* write the last 1 - 255 blocks at the end of the LUN */
printf("Compare and write last 1-256 blocks ... ");
printf("Compare and write last 1-255 blocks ... ");
for (i = 1; i < 256; i++) {
task = iscsi_read16_sync(iscsi, lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0);
task = iscsi_read16_sync(iscsi, lun, num_blocks + 1 - i, i * block_size, block_size, 0, 0, 0, 0, 0);
if (task == NULL) {
printf("[FAILED]\n");
printf("Failed to send READ16 command: %s\n", iscsi_get_error(iscsi));

View File

@@ -34,10 +34,10 @@ int T0343_compareandwrite_beyondeol(const char *initiator, const char *url, int
printf("=======================\n");
if (show_info) {
printf("Test that COMPAREANDWRITE fails if writing beyond end-of-lun.\n");
printf("1, Writing 1-256 blocks with one block beyond end-of-lun should fail.\n");
printf("2, Writing 1-256 blocks at LBA 2^63 should fail.\n");
printf("3, Writing 1-256 blocks at LBA -1 should fail.\n");
printf("4, Writing 1-256 blocks all but one block beyond eol\n");
printf("1, Writing 1-255 blocks with one block beyond end-of-lun should fail.\n");
printf("2, Writing 1-255 blocks at LBA 2^63 should fail.\n");
printf("3, Writing 1-255 blocks at LBA -1 should fail.\n");
printf("4, Writing 1-255 blocks all but one block beyond eol\n");
printf("\n");
return 0;
}
@@ -81,9 +81,9 @@ int T0343_compareandwrite_beyondeol(const char *initiator, const char *url, int
ret = 0;
/* read 1 - 256 blocks beyond the end of the device */
printf("Writing 1-256 blocks with one block beyond end-of-device ... ");
for (i = 1; i <= 256; i++) {
/* read 1 - 255 blocks beyond the end of the device */
printf("Writing 1-255 blocks with one block beyond end-of-device ... ");
for (i = 1; i <= 255; i++) {
task = iscsi_compareandwrite_sync(iscsi, lun, num_blocks + 2 - i, data, i * block_size, block_size, 0, 0, 0, 0, 0);
if (task == NULL) {
printf("[FAILED]\n");
@@ -104,9 +104,9 @@ int T0343_compareandwrite_beyondeol(const char *initiator, const char *url, int
test2:
/* read 1 - 256 blocks at lba 2^63 */
printf("Writing 1-256 blocks at LBA 2^63 ... ");
for (i = 1; i <= 256; i++) {
/* read 1 - 255 blocks at lba 2^63 */
printf("Writing 1-255 blocks at LBA 2^63 ... ");
for (i = 1; i < 256; i++) {
task = iscsi_compareandwrite_sync(iscsi, lun, 0x8000000000000000, data, i * block_size, block_size, 0, 0, 0, 0, 0);
if (task == NULL) {
printf("[FAILED]\n");
@@ -127,9 +127,9 @@ test2:
test3:
/* read 1 - 256 blocks at lba -1 */
printf("Writing 1-256 blocks at LBA -1 ... ");
for (i = 1; i <= 256; i++) {
/* read 1 - 255 blocks at lba -1 */
printf("Writing 1-255 blocks at LBA -1 ... ");
for (i = 1; i < 256; i++) {
task = iscsi_compareandwrite_sync(iscsi, lun, 0xffffffffffffffff, data, i * block_size, block_size, 0, 0, 0, 0, 0);
if (task == NULL) {
printf("[FAILED]\n");
@@ -149,9 +149,9 @@ test3:
printf("[OK]\n");
test4:
/* read 2-256 blocks, all but one block beyond the eol */
/* read 2-255 blocks, all but one block beyond the eol */
printf("Writing 1-255 blocks beyond eol starting at last block ... ");
for (i=2; i<=256; i++) {
for (i = 2; i < 256; i++) {
task = iscsi_compareandwrite_sync(iscsi, lun, num_blocks, data, i * block_size, block_size, 0, 0, 0, 0, 0);
if (task == NULL) {
printf("[FAILED]\n");