From 1d47b929b03e57eb8126335813ab6b3873ca7689 Mon Sep 17 00:00:00 2001 From: msweet Date: Mon, 13 May 2013 19:40:47 +0000 Subject: [PATCH] cups.org: ipptool does not include any version information in the plist output git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10981 a1ca3aef-8c08-0410-bb20-df032aa958be --- CHANGES.txt | 2 ++ doc/help/man-ipptoolfile.html | 8 +++++ man/ipptoolfile.man | 6 ++++ test/ipptool.c | 60 ++++++++++++++++++++++++++++++++++- 4 files changed, 75 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index d05d8c820..a282705eb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,8 @@ CHANGES IN CUPS V1.7b2 - The ipptool program did not continue past include file errors by default () + - The ipptool program now supports FILE-ID and TEST-ID directives and + includes their values in its XML output () CHANGES IN CUPS V1.7b1 diff --git a/doc/help/man-ipptoolfile.html b/doc/help/man-ipptoolfile.html index 4441d9d75..e0be2dcbe 100644 --- a/doc/help/man-ipptoolfile.html +++ b/doc/help/man-ipptoolfile.html @@ -76,6 +76,10 @@ The following directives can be used outside of a test:
Defines the named variable to the given value if it does not already have a value.
+
FILE-ID "identifier" +
+
Specifies an identifier string for the current file. +
IGNORE-ERRORS yes
@@ -271,6 +275,10 @@ resulted in an error/failure. added as predicates - see the "STATUS PREDICATES" section for more information on predicates. +
TEST-ID "identifier" +
+
Specifies an identifier string for the current test. +
TRANSFER auto
Specifies that this test will use "Transfer-Encoding: chunked" if it has an diff --git a/man/ipptoolfile.man b/man/ipptoolfile.man index 2049cbde0..785e204bb 100644 --- a/man/ipptoolfile.man +++ b/man/ipptoolfile.man @@ -78,6 +78,9 @@ DEFINE-DEFAULT variable-name value Defines the named variable to the given value if it does not already have a value. .TP 5 +FILE-ID "identifier" +Specifies an identifier string for the current file. +.TP 5 IGNORE-ERRORS yes .TP 5 IGNORE-ERRORS no @@ -227,6 +230,9 @@ Specifies an expected response status-code value. Additional requirements can be added as predicates - see the "STATUS PREDICATES" section for more information on predicates. .TP 5 +TEST-ID "identifier" +Specifies an identifier string for the current test. +.TP 5 TRANSFER auto Specifies that this test will use "Transfer-Encoding: chunked" if it has an attached file or "Content-Length:" otherwise. diff --git a/test/ipptool.c b/test/ipptool.c index 61fc8ed70..a5c34c6e2 100644 --- a/test/ipptool.c +++ b/test/ipptool.c @@ -807,7 +807,9 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ ipp_attribute_t *attrptr, /* Attribute pointer */ *found, /* Found attribute */ *lastcol = NULL; /* Last collection attribute */ - char name[1024]; /* Name of test */ + char name[1024], /* Name of test */ + file_id[1024], /* File identifier */ + test_id[1024]; /* Test identifier */ char filename[1024]; /* Filename */ _cups_transfer_t transfer; /* To chunk or not to chunk */ int version, /* IPP version number to use */ @@ -870,6 +872,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ errors = cupsArrayNew3(NULL, NULL, NULL, 0, (cups_acopy_func_t)strdup, (cups_afree_func_t)free); + file_id[0] = '\0'; pass = 1; linenum = 1; request_id = (CUPS_RAND() % 1000) * 137 + 1; @@ -925,6 +928,25 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ continue; } + else if (!strcmp(token, "FILE-ID")) + { + /* + * FILE-ID "string" + */ + + if (get_token(fp, temp, sizeof(temp), &linenum)) + { + expand_variables(vars, file_id, temp, sizeof(file_id)); + } + else + { + print_fatal_error("Missing FILE-ID value on line %d.", linenum); + pass = 0; + goto test_exit; + } + + continue; + } else if (!strcmp(token, "IGNORE-ERRORS")) { /* @@ -1204,6 +1226,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ filename[0] = '\0'; skip_previous = 0; skip_test = 0; + test_id[0] = '\0'; version = Version; transfer = Transfer; compression[0] = '\0'; @@ -1487,6 +1510,25 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ continue; } + else if (!strcmp(token, "TEST-ID")) + { + /* + * TEST-ID "string" + */ + + if (get_token(fp, temp, sizeof(temp), &linenum)) + { + expand_variables(vars, test_id, temp, sizeof(test_id)); + } + else + { + print_fatal_error("Missing TEST-ID value on line %d.", linenum); + pass = 0; + goto test_exit; + } + + continue; + } else if (!strcmp(token, "TRANSFER")) { /* @@ -2348,8 +2390,22 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ puts(""); puts("Name"); print_xml_string("string", name); + if (file_id[0]) + { + puts("FileId"); + print_xml_string("string", file_id); + } + if (test_id[0]) + { + puts("TestId"); + print_xml_string("string", test_id); + } + puts("Version"); + printf("%d.%d\n", version / 10, version % 10); puts("Operation"); print_xml_string("string", ippOpString(op)); + puts("RequestId"); + printf("%d\n", request_id); puts("RequestAttributes"); puts(""); if (request->attrs) @@ -4406,6 +4462,8 @@ print_xml_header(void) "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"); puts(""); puts(""); + puts("ipptoolVersion"); + puts("" CUPS_SVERSION ""); puts("Transfer"); printf("%s\n", Transfer == _CUPS_TRANSFER_AUTO ? "auto" : -- 2.39.2