]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Update DELAY directive to support the repeat interval, which now defaults to a
authorMichael Sweet <michael.r.sweet@gmail.com>
Tue, 13 Jun 2017 13:19:03 +0000 (09:19 -0400)
committerMichael Sweet <michael.r.sweet@gmail.com>
Tue, 13 Jun 2017 13:19:03 +0000 (09:19 -0400)
constant of 5 seconds.

doc/help/man-ipptool.html
doc/help/man-ipptoolfile.html
doc/help/man-lpstat.html
man/ipptool.man
man/ipptoolfile.man
test/ipptool.c

index c1034f3d3ffd2c60202be16c86aab5852832ff05..ef95bfee49a1b40843c86b3542b49a2a217fb091 100644 (file)
@@ -210,10 +210,9 @@ Get a list of completed jobs for "myprinter":
 </pre>
 <h2 class="title"><a name="SEE_ALSO">See Also</a></h2>
 <a href="man-ipptoolfile.html?TOPIC=Man+Pages"><b>ipptoolfile</b>(5),</a>
-CUPS Online Help (<a href="http://localhost:631/help)">http://localhost:631/help)</a>,
 IANA IPP Registry (<a href="http://www.iana.org/assignments/ipp\-registrations)">http://www.iana.org/assignments/ipp\-registrations)</a>,
 PWG Internet Printing Protocol Workgroup (<a href="http://www.pwg.org/ipp">http://www.pwg.org/ipp</a>)
-RFC 2911 (<a href="http://tools.ietf.org/html/rfc2911)">http://tools.ietf.org/html/rfc2911)</a>,
+RFC 8011 (<a href="http://tools.ietf.org/html/rfc8011)">http://tools.ietf.org/html/rfc8011)</a>,
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
 Copyright &copy; 2007-2017 by Apple Inc.
 
index 2ddd22ea6ab01541b6450fe2f4cec63046284029..2921bea2d384f247cc96e1fb8004ba11bf1f2a52 100644 (file)
@@ -12,22 +12,42 @@ ipptoolfile - ipptool file format
 <h2 class="title"><a name="DESCRIPTION">Description</a></h2>
 The
 <a href="man-ipptool.html?TOPIC=Man+Pages"><b>ipptool</b>(1)</a>
-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:
 <pre class="man">
 
     # 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
     }
 </pre>
 <h3><a name="TOP_LEVEL_DIRECTIVES">Top-level Directives</a></h3>
@@ -115,15 +140,20 @@ command-line. Support for content length requests is required for conformance wi
 The following directives are understood within a <i>test</i>:
 <dl class="man">
 <dt><b>ATTR </b><i>tag attribute-name value(s)</i>
-<dd style="margin-left: 5.0em">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.
+<dd style="margin-left: 5.0em">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.
 <dt><b>ATTR collection </b><i>attribute-name </i><b>{ MEMBER </b><i>tag member-name value(s) ... </i><b>}</b> [ <i>... </i><b>,{ </b><i>... </i><b>} </b>]
-<dd style="margin-left: 5.0em">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.
+<dd style="margin-left: 5.0em">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.
 <dt><b>COMPRESSION deflate</b>
 <dd style="margin-left: 5.0em"><dt><b>COMPRESSION gzip</b>
 <dd style="margin-left: 5.0em"><dt><b>COMPRESSION none</b>
 <dd style="margin-left: 5.0em">Uses the specified compression on the document data following the attributes in a Print-Job or Send-Document request.
-<dt><b>DELAY </b><i>seconds</i>
-<dd style="margin-left: 5.0em">Specifies a delay before this test will be run.
+<dt><b>DELAY </b><i>seconds</i>[<i>,repeat-seconds</i>]
+<dd style="margin-left: 5.0em">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.
 <dt><b>DISPLAY </b><i>attribute-name</i>
 <dd style="margin-left: 5.0em">Specifies that value of the named attribute should be output as part of the
 test report.
@@ -496,10 +526,9 @@ if any.
 </dl>
 <h2 class="title"><a name="SEE_ALSO">See Also</a></h2>
 <a href="man-ipptool.html?TOPIC=Man+Pages"><b>ipptool</b>(1),</a>
-CUPS Online Help (<a href="http://localhost:631/help)">http://localhost:631/help)</a>,
 IANA IPP Registry (<a href="http://www.iana.org/assignments/ipp-registrations)">http://www.iana.org/assignments/ipp-registrations)</a>,
 PWG Internet Printing Protocol Workgroup (<a href="http://www.pwg.org/ipp)">http://www.pwg.org/ipp)</a>,
-RFC 2911 (<a href="http://tools.ietf.org/html/rfc3911">http://tools.ietf.org/html/rfc3911</a>)
+RFC 8011 (<a href="http://tools.ietf.org/html/rfc8011">http://tools.ietf.org/html/rfc8011</a>)
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
 Copyright &copy; 2007-2017 by Apple Inc.
 
index 391ce44e89f4f1d59bae0ac54744ffb443604edc..106b9f59881f1005dfbe485264a78f9d6eb0d323 100644 (file)
@@ -36,6 +36,8 @@ lpstat - print cups status information
 ] ] [
 <b>-d</b>
 ] [
+<b>-e</b>
+] [
 <b>-o</b>
 [
 <i>destination(s)</i>
@@ -85,6 +87,8 @@ If no printers are specified then all printers are listed.
 If no classes are specified then all classes are listed.
 <dt><b>-d</b>
 <dd style="margin-left: 5.0em">Shows the current default destination.
+<dt><b>-e</b>
+<dd style="margin-left: 5.0em">Shows all available destinations on the local network.
 <dt><b>-h </b><i>server</i>[<b>:</b><i>port</i>]
 <dd style="margin-left: 5.0em">Specifies an alternate server.
 <dt><b>-l</b>
@@ -113,7 +117,7 @@ If no printers are specified then all printers are listed.
 <h2 class="title"><a name="CONFORMING_TO">Conforming To</a></h2>
 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 <i>not</i> case-sensitive.
-<p>The <i>-h</i>, <i>-E</i>, <i>-U</i>, and <i>-W</i> options are unique to CUPS.
+<p>The <i>-h</i>, <i>-e</i>, <i>-E</i>, <i>-U</i>, and <i>-W</i> options are unique to CUPS.
 <p>The Solaris <i>-f</i>, <i>-P</i>, and <i>-S</i> options are silently ignored.
 <h2 class="title"><a name="SEE_ALSO">See Also</a></h2>
 <a href="man-cancel.html?TOPIC=Man+Pages"><b>cancel</b>(1),</a>
index d84fa94cbfb93896e0370f9e0ebd97e1ffc1d4c4..ecc957525405f5ec8a903c0538d893d3e2023f34 100644 (file)
@@ -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.
index 1f649e5a2a3a666fa01d1bc8d4d46eb0ae1cc4b2..795995da09cb0b57eafdcbd162d47b2518c8d217 100644 (file)
@@ -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.
index 5e61a48c10def0c72dd77c1eb8c41a0284a31261..b701627112ea82e0d60c17e37c02ce58fad75597 100644 (file)
@@ -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))
        {