*define_match, /* Variable to define on match */
*define_no_match, /* Variable to define on no-match */
*define_value; /* Variable to define with value */
- int repeat_match, /* Repeat test on match */
+ int repeat_limit, /* Maximum number of times to repeat */
+ repeat_match, /* Repeat test on match */
repeat_no_match, /* Repeat test on no match */
with_flags, /* WITH flags */
count; /* Expected count if > 0 */
ipp_status_t status; /* Expected status code */
char *if_defined, /* Only if variable is defined */
*if_not_defined; /* Only if variable is not defined */
- int repeat_match, /* Repeat the test when it does not match */
+ int repeat_limit, /* Maximum number of times to repeat */
+ repeat_match, /* Repeat the test when it does not match */
repeat_no_match; /* Repeat the test when it matches */
} _cups_status_t;
set_variable(&vars, "filetype", "text/html");
else if (!_cups_strcasecmp(ext, ".jpg"))
set_variable(&vars, "filetype", "image/jpeg");
+ else if (!_cups_strcasecmp(ext, ".pcl") ||
+ !_cups_strcasecmp(ext, ".pcl.gz"))
+ set_variable(&vars, "filetype", "application/vnd.hp-PCL");
else if (!_cups_strcasecmp(ext, ".pdf"))
set_variable(&vars, "filetype", "application/pdf");
else if (!_cups_strcasecmp(ext, ".png"))
show_header = 1, /* Show the test header? */
ignore_errors, /* Ignore test failures? */
skip_previous = 0, /* Skip on previous test failure? */
+ repeat_count, /* Repeat count */
+ repeat_interval, /* Repeat interval */
+ repeat_prev, /* Previous repeat interval */
repeat_test; /* Repeat a test? */
http_t *http = NULL; /* HTTP connection to server */
FILE *fp = NULL; /* Test file */
_cups_strcasecmp(token, "IF-NOT-DEFINED") &&
_cups_strcasecmp(token, "IN-GROUP") &&
_cups_strcasecmp(token, "OF-TYPE") &&
+ _cups_strcasecmp(token, "REPEAT-LIMIT") &&
_cups_strcasecmp(token, "REPEAT-MATCH") &&
_cups_strcasecmp(token, "REPEAT-NO-MATCH") &&
_cups_strcasecmp(token, "SAME-COUNT-AS") &&
if (_cups_strcasecmp(token, "IF-DEFINED") &&
_cups_strcasecmp(token, "IF-NOT-DEFINED") &&
+ _cups_strcasecmp(token, "REPEAT-LIMIT") &&
_cups_strcasecmp(token, "REPEAT-MATCH") &&
_cups_strcasecmp(token, "REPEAT-NO-MATCH"))
last_status = NULL;
last_status->if_defined = NULL;
last_status->if_not_defined = NULL;
+ last_status->repeat_limit = 1000;
last_status->repeat_match = 0;
last_status->repeat_no_match = 0;
}
num_expects ++;
memset(last_expect, 0, sizeof(_cups_expect_t));
+ last_expect->repeat_limit = 1000;
if (token[0] == '!')
{
goto test_exit;
}
}
+ else if (!_cups_strcasecmp(token, "REPEAT-LIMIT"))
+ {
+ if (!get_token(fp, token, sizeof(token), &linenum))
+ {
+ print_fatal_error("Missing REPEAT-LIMIT value on line %d.", linenum);
+ pass = 0;
+ goto test_exit;
+ }
+ else if (atoi(token) <= 0)
+ {
+ print_fatal_error("Bad REPEAT-LIMIT value on line %d.", linenum);
+ pass = 0;
+ goto test_exit;
+ }
+
+ if (last_status)
+ last_status->repeat_limit = atoi(token);
+ else if (last_expect)
+ last_expect->repeat_limit = atoi(token);
+ else
+ {
+ print_fatal_error("REPEAT-LIMIT without a preceding EXPECT or STATUS "
+ "on line %d.", linenum);
+ pass = 0;
+ goto test_exit;
+ }
+ }
else if (!_cups_strcasecmp(token, "REPEAT-MATCH"))
{
if (last_status)
goto skip_error;
}
+ repeat_count = 0;
+ repeat_interval = 1;
+ repeat_prev = 1;
+
do
{
+ repeat_count ++;
+
status = HTTP_OK;
if (transfer == _CUPS_TRANSFER_CHUNKED ||
status = httpGetStatus(http);
}
- if (!Cancel && status == HTTP_ERROR &&
+ if (!Cancel && status == HTTP_ERROR && http->error != EINVAL &&
#ifdef WIN32
http->error != WSAETIMEDOUT)
#else
}
}
- if (!Cancel && status == HTTP_ERROR &&
+ if (!Cancel && status == HTTP_ERROR && http->error != EINVAL &&
#ifdef WIN32
http->error != WSAETIMEDOUT)
#else
if (response->request.status.status_code == statuses[i].status)
{
- if (statuses[i].repeat_match)
+ if (statuses[i].repeat_match &&
+ repeat_count < statuses[i].repeat_limit)
repeat_test = 1;
break;
}
- else if (statuses[i].repeat_no_match)
+ else if (statuses[i].repeat_no_match &&
+ repeat_count < statuses[i].repeat_limit)
repeat_test = 1;
}
}
}
- if (expect->repeat_no_match)
+ if (expect->repeat_no_match &&
+ repeat_count < expect->repeat_limit)
repeat_test = 1;
continue;
buffer, sizeof(buffer));
}
- if (expect->repeat_no_match)
+ if (expect->repeat_no_match &&
+ repeat_count < expect->repeat_limit)
repeat_test = 1;
continue;
expect->count, found->num_values);
}
- if (expect->repeat_no_match)
+ if (expect->repeat_no_match &&
+ repeat_count < expect->repeat_limit)
repeat_test = 1;
continue;
expect->same_count_as, attrptr->num_values);
}
- if (expect->repeat_no_match)
+ if (expect->repeat_no_match &&
+ repeat_count < expect->repeat_limit)
repeat_test = 1;
continue;
if (found && expect->define_value)
set_variable(vars, expect->define_value, buffer);
- if (found && expect->repeat_match)
+ if (found && expect->repeat_match &&
+ repeat_count < expect->repeat_limit)
repeat_test = 1;
}
}
*/
if (repeat_test)
- sleep(1);
+ {
+ if (Output == _CUPS_OUTPUT_TEST)
+ {
+ printf("%04d]\n", repeat_count);
+ fflush(stdout);
+ }
+
+ sleep(repeat_interval);
+ repeat_interval = _cupsNextDelay(repeat_interval, &repeat_prev);
+
+ if (Output == _CUPS_OUTPUT_TEST)
+ {
+ printf(" %-68.68s [", name);
+ fflush(stdout);
+ }
+ }
}
while (repeat_test);