TESTS: PREFETCH10/16, add test for prefetch-lengt==0

This commit is contained in:
Ronnie Sahlberg
2012-09-03 10:00:53 -07:00
parent 81e935ffb0
commit d6bbe8fe44
2 changed files with 43 additions and 3 deletions

View File

@@ -34,6 +34,7 @@ int T0240_prefetch10_simple(const char *initiator, const char *url, int data_los
printf("Test basic PREFETCH10 functionality.\n");
printf("1, Verify we can prefetch the first 1-256 blocks of the LUN.\n");
printf("2, Verify we can prefetch the last 1-256 blocks of the LUN.\n");
printf("3, Verify we can prefetch the last 256 blocks of the LUN by setting LEN==0.\n");
printf("\n");
return 0;
}
@@ -102,8 +103,8 @@ int T0240_prefetch10_simple(const char *initiator, const char *url, int data_los
test2:
/* Prefetch the last 0 - 255 blocks at the end of the LUN */
printf("Prefetching last 0-255 blocks ... ");
for (i = 0; i < 256; i++) {
printf("Prefetching last 1-255 blocks ... ");
for (i = 1; i < 256; i++) {
task = iscsi_prefetch10_sync(iscsi, lun, num_blocks - i, i, 0, 0);
if (task == NULL) {
printf("[FAILED]\n");
@@ -123,6 +124,24 @@ test2:
printf("[OK]\n");
test3:
task = iscsi_prefetch10_sync(iscsi, lun, num_blocks - 256, 0, 0, 0);
if (task == NULL) {
printf("[FAILED]\n");
printf("Failed to send prefetch10 command: %s\n", iscsi_get_error(iscsi));
ret = -1;
goto test4;
}
if (task->status != SCSI_STATUS_GOOD) {
printf("[FAILED]\n");
printf("Prefetch10 command: failed with sense. %s\n", iscsi_get_error(iscsi));
ret = -1;
scsi_free_scsi_task(task);
goto test4;
}
scsi_free_scsi_task(task);
printf("[OK]\n");
test4:
finished:
iscsi_logout_sync(iscsi);

View File

@@ -34,6 +34,7 @@ int T0250_prefetch16_simple(const char *initiator, const char *url, int data_los
printf("Test basic PREFETCH16 functionality.\n");
printf("1, Verify we can prefetch the first 1-256 blocks of the LUN.\n");
printf("2, Verify we can prefetch the last 1-256 blocks of the LUN.\n");
printf("3, Verify we can prefetch the last 256 blocks of the LUN by setting LEN==0.\n");
printf("\n");
return 0;
}
@@ -103,7 +104,7 @@ int T0250_prefetch16_simple(const char *initiator, const char *url, int data_los
test2:
/* Prefetch the last 0 - 255 blocks at the end of the LUN */
printf("Prefetching last 0-255 blocks ... ");
for (i = 0; i < 256; i++) {
for (i = 1; i < 256; i++) {
task = iscsi_prefetch16_sync(iscsi, lun, num_blocks - i, i, 0, 0);
if (task == NULL) {
printf("[FAILED]\n");
@@ -124,6 +125,26 @@ test2:
test3:
printf("Prefetching last 0-255 blocks ... ");
task = iscsi_prefetch16_sync(iscsi, lun, num_blocks - 256, 0, 0, 0);
if (task == NULL) {
printf("[FAILED]\n");
printf("Failed to send prefetch16 command: %s\n", iscsi_get_error(iscsi));
ret = -1;
goto test4;
}
if (task->status != SCSI_STATUS_GOOD) {
printf("[FAILED]\n");
printf("Prefetch16 command: failed with sense. %s\n", iscsi_get_error(iscsi));
ret = -1;
scsi_free_scsi_task(task);
goto test4;
}
scsi_free_scsi_task(task);
printf("[OK]\n");
test4:
finished:
iscsi_logout_sync(iscsi);
iscsi_destroy_context(iscsi);