From: Michael Sweet Date: Tue, 13 Jun 2017 13:19:03 +0000 (-0400) Subject: Update DELAY directive to support the repeat interval, which now defaults to a X-Git-Tag: v2.2.4~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1dd3a3976ce3e44b90a005d061cd7a61c26e68a;p=thirdparty%2Fcups.git Update DELAY directive to support the repeat interval, which now defaults to a constant of 5 seconds. --- diff --git a/doc/help/man-ipptool.html b/doc/help/man-ipptool.html index c1034f3d3f..ef95bfee49 100644 --- a/doc/help/man-ipptool.html +++ b/doc/help/man-ipptool.html @@ -210,10 +210,9 @@ Get a list of completed jobs for "myprinter":

See Also

ipptoolfile(5), -CUPS Online Help (http://localhost:631/help), IANA IPP Registry (http://www.iana.org/assignments/ipp\-registrations), PWG Internet Printing Protocol Workgroup (http://www.pwg.org/ipp) -RFC 2911 (http://tools.ietf.org/html/rfc2911), +RFC 8011 (http://tools.ietf.org/html/rfc8011),

Copyright

Copyright © 2007-2017 by Apple Inc. diff --git a/doc/help/man-ipptoolfile.html b/doc/help/man-ipptoolfile.html index 2ddd22ea6a..2921bea2d3 100644 --- a/doc/help/man-ipptoolfile.html +++ b/doc/help/man-ipptoolfile.html @@ -12,22 +12,42 @@ ipptoolfile - ipptool file format

Description

The ipptool(1) -program accepts free-form plain text files that describe one or more IPP requests. Comments start with the "#" character and continue to the end of the line. Each request is enclosed by curly braces, for example: +program accepts free-form plain text files that describe one or more IPP requests. +Comments start with the "#" character and continue to the end of the line. +Each request is enclosed by curly braces, for example:
 
     # This is a comment
     {
       # The name of the test
-      NAME "Print PostScript File"
+      NAME "Print PDF File"
 
       # The request to send
       OPERATION Print-Job
+
       GROUP operation-attributes-tag
       ATTR charset attributes-charset utf-8
       ATTR language attributes-natural-language en
       ATTR uri printer-uri $uri
       ATTR name requesting-user-name $user
-      FILE testfile.ps
+      ATTR mimeMediaType document-format application/pdf
+
+      GROUP job-attributes-tag
+      ATTR collection media-col {
+        # US Letter plain paper from the "main" tray
+        MEMBER collection media-size {
+          MEMBER integer x-dimension 21590
+          MEMBER integer y-dimension 27940
+        }
+        MEMBER integer media-top-margin 423
+        MEMBER integer media-bottom-margin 423
+        MEMBER integer media-left-margin 423
+        MEMBER integer media-right-margin 423
+        MEMBER keyword media-source "main"
+        MEMBER keyword media-type "stationery"
+      }
+
+      FILE testfile.pdf
 
       # The response to expect
       STATUS successful-ok
@@ -36,10 +56,11 @@ program accepts free-form plain text files that describe one or more IPP request
     }
     {
       # The name of the test
-      NAME "Get Attributes of PostScript Job"
+      NAME "Wait for Job to Complete"
 
       # The request to send
       OPERATION Get-Job-Attributes
+
       GROUP operation-attributes-tag
       ATTR charset attributes-charset utf-8
       ATTR language attributes-natural-language en
@@ -51,8 +72,12 @@ program accepts free-form plain text files that describe one or more IPP request
       STATUS successful-ok
       EXPECT job-id OF-TYPE integer WITH-VALUE $job-id
       EXPECT job-uri OF-TYPE uri
-      EXPECT job-state OF-TYPE enum WITH-VALUE 3,4,5,6,7,8,9
+      EXPECT job-state OF-TYPE enum WITH-VALUE >5 REPEAT-NO-MATCH
       EXPECT job-originating-user-name OF-TYPE name WITH-VALUE "$user"
+
+      # Show the job state until completed...
+      DISPLAY job-state
+      DISPLAY job-state-reasons
     }
 

Top-level Directives

@@ -115,15 +140,20 @@ command-line. Support for content length requests is required for conformance wi The following directives are understood within a test:
ATTR tag attribute-name value(s) -
Adds an attribute to the test request. Values are separated by the comma (",") character - escape commas using the "" character. Common attributes and values are listed in the IANA IPP registry - see references below. +
Adds an attribute to the test request. +Values are separated by the comma (",") character - escape commas using the "" character. +Common attributes and values are listed in the IANA IPP registry - see references below.
ATTR collection attribute-name { MEMBER tag member-name value(s) ... } [ ... ,{ ... } ] -
Adds a collection attribute to the test request. Member attributes follow the same syntax as regular attributes and can themselves be nested collections. Multiple collection values can be supplied as needed, separated by commas. +
Adds a collection attribute to the test request. +Member attributes follow the same syntax as regular attributes and can themselves be nested collections. +Multiple collection values can be supplied as needed, separated by commas.
COMPRESSION deflate
COMPRESSION gzip
COMPRESSION none
Uses the specified compression on the document data following the attributes in a Print-Job or Send-Document request. -
DELAY seconds -
Specifies a delay before this test will be run. +
DELAY seconds[,repeat-seconds] +
Specifies a delay in seconds before this test will be run. +If two values are specified, the second value is used as the delay between repeated tests.
DISPLAY attribute-name
Specifies that value of the named attribute should be output as part of the test report. @@ -496,10 +526,9 @@ if any.

See Also

ipptool(1), -CUPS Online Help (http://localhost:631/help), IANA IPP Registry (http://www.iana.org/assignments/ipp-registrations), PWG Internet Printing Protocol Workgroup (http://www.pwg.org/ipp), -RFC 2911 (http://tools.ietf.org/html/rfc3911) +RFC 8011 (http://tools.ietf.org/html/rfc8011)

Copyright

Copyright © 2007-2017 by Apple Inc. diff --git a/doc/help/man-lpstat.html b/doc/help/man-lpstat.html index 391ce44e89..106b9f5988 100644 --- a/doc/help/man-lpstat.html +++ b/doc/help/man-lpstat.html @@ -36,6 +36,8 @@ lpstat - print cups status information ] ] [ -d ] [ +-e +] [ -o [ destination(s) @@ -85,6 +87,8 @@ If no printers are specified then all printers are listed. If no classes are specified then all classes are listed.
-d
Shows the current default destination. +
-e +
Shows all available destinations on the local network.
-h server[:port]
Specifies an alternate server.
-l @@ -113,7 +117,7 @@ If no printers are specified then all printers are listed.

Conforming To

Unlike the System V printing system, CUPS allows printer names to contain any printable character except SPACE, TAB, "/", and "#". Also, printer and class names are not case-sensitive. -

The -h, -E, -U, and -W options are unique to CUPS. +

The -h, -e, -E, -U, and -W options are unique to CUPS.

The Solaris -f, -P, and -S options are silently ignored.

See Also

cancel(1), diff --git a/man/ipptool.man b/man/ipptool.man index d84fa94cbf..ecc9575254 100644 --- a/man/ipptool.man +++ b/man/ipptool.man @@ -1,7 +1,7 @@ .\" -.\" ipptool man page for CUPS. +.\" ipptool man page. .\" -.\" Copyright 2010-2015 by Apple Inc. +.\" Copyright 2010-2017 by Apple Inc. .\" .\" These coded instructions, statements, and computer programs are the .\" property of Apple Inc. and are protected by Federal copyright @@ -9,7 +9,7 @@ .\" which should have been included with this file. If this file is .\" file is missing or damaged, see the license at "http://www.cups.org/". .\" -.TH ipptool 1 "CUPS" "26 August 2015" "Apple Inc." +.TH ipptool 1 "CUPS" "13 June 2017" "Apple Inc." .SH NAME ipptool \- perform internet printing protocol requests .SH SYNOPSIS @@ -235,9 +235,8 @@ Send email notifications to "user@example.com" when "myprinter" changes: .fi .SH SEE ALSO .BR ipptoolfile (5), -CUPS Online Help (http://localhost:631/help), IANA IPP Registry (http://www.iana.org/assignments/ipp\-registrations), PWG Internet Printing Protocol Workgroup (http://www.pwg.org/ipp) -RFC 2911 (http://tools.ietf.org/html/rfc2911), +RFC 8011 (http://tools.ietf.org/html/rfc8011), .SH COPYRIGHT Copyright \[co] 2007-2017 by Apple Inc. diff --git a/man/ipptoolfile.man b/man/ipptoolfile.man index 1f649e5a2a..795995da09 100644 --- a/man/ipptoolfile.man +++ b/man/ipptoolfile.man @@ -1,7 +1,7 @@ .\" -.\" ipptoolfile man page for CUPS. +.\" ipptoolfile man page. .\" -.\" Copyright 2010-2014 by Apple Inc. +.\" Copyright 2010-2017 by Apple Inc. .\" .\" These coded instructions, statements, and computer programs are the .\" property of Apple Inc. and are protected by Federal copyright @@ -9,28 +9,48 @@ .\" which should have been included with this file. If this file is .\" file is missing or damaged, see the license at "http://www.cups.org/". .\" -.TH ipptoolfile 5 "CUPS" "4 February 2015" "Apple Inc." +.TH ipptoolfile 5 "CUPS" "13 June 2017" "Apple Inc." .SH NAME ipptoolfile \- ipptool file format .SH DESCRIPTION The .BR ipptool (1) -program accepts free-form plain text files that describe one or more IPP requests. Comments start with the "#" character and continue to the end of the line. Each request is enclosed by curly braces, for example: +program accepts free-form plain text files that describe one or more IPP requests. +Comments start with the "#" character and continue to the end of the line. +Each request is enclosed by curly braces, for example: .nf # This is a comment { # The name of the test - NAME "Print PostScript File" + NAME "Print PDF File" # The request to send OPERATION Print\-Job + GROUP operation\-attributes\-tag ATTR charset attributes\-charset utf\-8 ATTR language attributes\-natural\-language en ATTR uri printer\-uri $uri ATTR name requesting\-user\-name $user - FILE testfile.ps + ATTR mimeMediaType document\-format application/pdf + + GROUP job\-attributes\-tag + ATTR collection media\-col { + # US Letter plain paper from the "main" tray + MEMBER collection media\-size { + MEMBER integer x\-dimension 21590 + MEMBER integer y\-dimension 27940 + } + MEMBER integer media\-top\-margin 423 + MEMBER integer media\-bottom\-margin 423 + MEMBER integer media\-left\-margin 423 + MEMBER integer media\-right\-margin 423 + MEMBER keyword media\-source "main" + MEMBER keyword media\-type "stationery" + } + + FILE testfile.pdf # The response to expect STATUS successful\-ok @@ -39,10 +59,11 @@ program accepts free-form plain text files that describe one or more IPP request } { # The name of the test - NAME "Get Attributes of PostScript Job" + NAME "Wait for Job to Complete" # The request to send OPERATION Get\-Job\-Attributes + GROUP operation\-attributes\-tag ATTR charset attributes\-charset utf\-8 ATTR language attributes\-natural\-language en @@ -54,8 +75,12 @@ program accepts free-form plain text files that describe one or more IPP request STATUS successful\-ok EXPECT job\-id OF\-TYPE integer WITH\-VALUE $job\-id EXPECT job\-uri OF\-TYPE uri - EXPECT job\-state OF\-TYPE enum WITH\-VALUE 3,4,5,6,7,8,9 + EXPECT job\-state OF\-TYPE enum WITH\-VALUE >5 REPEAT\-NO\-MATCH EXPECT job\-originating\-user\-name OF\-TYPE name WITH\-VALUE "$user" + + # Show the job state until completed... + DISPLAY job-state + DISPLAY job-state-reasons } .fi .SS TOP-LEVEL DIRECTIVES @@ -140,10 +165,14 @@ Specifies the default IPP version number to use for the tests that follow. The following directives are understood within a \fItest\fR: .TP 5 \fBATTR \fItag attribute-name value(s)\fR -Adds an attribute to the test request. Values are separated by the comma (",") character - escape commas using the "\" character. Common attributes and values are listed in the IANA IPP registry - see references below. +Adds an attribute to the test request. +Values are separated by the comma (",") character - escape commas using the "\" character. +Common attributes and values are listed in the IANA IPP registry - see references below. .TP 5 \fBATTR collection \fIattribute-name \fB{ MEMBER \fItag member-name value(s) ... \fB}\fR [ \fI... \fB,{ \fI... \fB} \fR] -Adds a collection attribute to the test request. Member attributes follow the same syntax as regular attributes and can themselves be nested collections. Multiple collection values can be supplied as needed, separated by commas. +Adds a collection attribute to the test request. +Member attributes follow the same syntax as regular attributes and can themselves be nested collections. +Multiple collection values can be supplied as needed, separated by commas. .TP 5 \fBCOMPRESSION deflate\fR .TP 5 @@ -152,8 +181,9 @@ Adds a collection attribute to the test request. Member attributes follow the sa \fBCOMPRESSION none\fR Uses the specified compression on the document data following the attributes in a Print-Job or Send-Document request. .TP 5 -\fBDELAY \fIseconds\fR -Specifies a delay before this test will be run. +\fBDELAY \fIseconds\fR[\fI,repeat-seconds\fR] +Specifies a delay in seconds before this test will be run. +If two values are specified, the second value is used as the delay between repeated tests. .TP 5 \fBDISPLAY \fIattribute-name\fR Specifies that value of the named attribute should be output as part of the @@ -612,9 +642,8 @@ if any. Inserts the current user's login name. .SH SEE ALSO .BR ipptool (1), -CUPS Online Help (http://localhost:631/help), IANA IPP Registry (http://www.iana.org/assignments/ipp-registrations), PWG Internet Printing Protocol Workgroup (http://www.pwg.org/ipp), -RFC 2911 (http://tools.ietf.org/html/rfc3911) +RFC 8011 (http://tools.ietf.org/html/rfc8011) .SH COPYRIGHT Copyright \[co] 2007-2017 by Apple Inc. diff --git a/test/ipptool.c b/test/ipptool.c index 5e61a48c10..b701627112 100644 --- a/test/ipptool.c +++ b/test/ipptool.c @@ -775,9 +775,9 @@ do_tests(FILE *outfile, /* I - Output file */ 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? */ + useconds_t delay, /* Initial delay */ + repeat_interval; /* Repeat interval (delay) */ http_t *http = NULL; /* HTTP connection to server */ FILE *fp = NULL; /* Test file */ char resource[512], /* Resource for request */ @@ -860,7 +860,7 @@ do_tests(FILE *outfile, /* I - Output file */ * Loop on tests... */ - CUPS_SRAND(time(NULL)); + CUPS_SRAND((unsigned)time(NULL)); errors = cupsArrayNew3(NULL, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free); @@ -1206,19 +1206,22 @@ do_tests(FILE *outfile, /* I - Output file */ strlcpy(resource, vars->resource, sizeof(resource)); request_id ++; - request = ippNew(); - op = (ipp_op_t)0; - group = IPP_TAG_ZERO; - ignore_errors = IgnoreErrors; - last_expect = NULL; - last_status = NULL; - filename[0] = '\0'; - skip_previous = 0; - skip_test = 0; - test_id[0] = '\0'; - version = Version; - transfer = Transfer; - compression[0] = '\0'; + request = ippNew(); + op = (ipp_op_t)0; + group = IPP_TAG_ZERO; + ignore_errors = IgnoreErrors; + last_expect = NULL; + last_status = NULL; + filename[0] = '\0'; + skip_previous = 0; + skip_test = 0; + test_id[0] = '\0'; + version = Version; + transfer = Transfer; + compression[0] = '\0'; + delay = 0; + repeat_count = 0; + repeat_interval = 5000000; strlcpy(name, testfile, sizeof(name)); if (strrchr(name, '.') != NULL) @@ -1633,7 +1636,7 @@ do_tests(FILE *outfile, /* I - Output file */ * Delay before operation... */ - double delay; + double dval; /* Delay value */ if (!get_token(fp, temp, sizeof(temp), &linenum)) { @@ -1644,19 +1647,37 @@ do_tests(FILE *outfile, /* I - Output file */ expand_variables(vars, token, temp, sizeof(token)); - if ((delay = _cupsStrScand(token, NULL, localeconv())) <= 0.0) + if ((dval = _cupsStrScand(token, &tokenptr, localeconv())) <= 0.0 || (*tokenptr && *tokenptr != ',')) { print_fatal_error(outfile, "Bad DELAY value \"%s\" on line %d.", token, linenum); pass = 0; goto test_exit; } - else - { + + delay = (useconds_t)(1000000.0 * dval); + + if (*tokenptr == ',') + { + if ((dval = _cupsStrScand(tokenptr + 1, &tokenptr, localeconv())) <= 0.0 || *tokenptr) + { + print_fatal_error(outfile, "Bad DELAY value \"%s\" on line %d.", token, + linenum); + pass = 0; + goto test_exit; + } + + repeat_interval = (useconds_t)(1000000.0 * dval); + } + else + repeat_interval = delay; + + if (delay > 0) + { if (Output == _CUPS_OUTPUT_TEST) - printf(" [%g second delay]\n", delay); + printf(" [%g second delay]\n", delay * 0.000001); - usleep((useconds_t)(1000000.0 * delay)); + usleep(delay); } } else if (!_cups_strcasecmp(token, "ATTR")) @@ -2562,9 +2583,6 @@ do_tests(FILE *outfile, /* I - Output file */ } PasswordTries = 0; - repeat_count = 0; - repeat_interval = 1; - repeat_prev = 1; do { @@ -3252,8 +3270,7 @@ do_tests(FILE *outfile, /* I - Output file */ } } - sleep((unsigned)repeat_interval); - repeat_interval = _cupsNextDelay(repeat_interval, &repeat_prev); + usleep(repeat_interval); if (Output == _CUPS_OUTPUT_TEST || (Output == _CUPS_OUTPUT_PLIST && outfile != stdout)) {