From 851dc81e2b66391e45a739b80caec3814d595e35 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Wed, 27 Jul 2022 19:04:03 +0200 Subject: [PATCH] Test suite: If holding supported, add a new print job for cancelling On some quicker machines the print-job operation finishes quicker than we can cancel it in the test - so add job-hold-until job template attribute if the printer supports it, which will hold the job until it is cancelled by the next test. The next test passes because it has both statuses (correct and error one) as expected, but cupsd generates an additional error in log if the job cancelling fails, which would be more dirty to cover in run-stp-test.sh. There is a loophole when the error is still generated - if the printer/machine is quick enough to finish the job, but the machine/printer doesn't support job holding at the same time. IMHO the current patch should cover most cases. --- examples/ipp-1.1.test | 42 ++++++++++++++++++++++++++++++++++++++++++ test/run-stp-tests.sh | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/examples/ipp-1.1.test b/examples/ipp-1.1.test index 73e933feee..d920867681 100644 --- a/examples/ipp-1.1.test +++ b/examples/ipp-1.1.test @@ -843,6 +843,48 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/" } +# Test Print-Job operation with optional job-hold-until job template attribute +# +# Optional by: RFC 8011 section 5.2.2 +# +# Needed to hold the job to ensure the next test - cancel-job - passes. On some quicker +# machines the job can finish quicker than we are able to cancel it, which does not fail +# the IPP test because the STATUS is expected, but the count of the caught errors differs. +{ + SKIP-IF-NOT-DEFINED OPTIONAL_HOLD_JOB + + NAME "RFC 8011 section 5.2.2: Print-Job Operation with optional job-hold-until job template attribute" + OPERATION Print-Job + GROUP operation-attributes-tag + ATTR charset attributes-charset utf-8 + ATTR naturalLanguage attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + ATTR name job-name $filename + ATTR boolean ipp-attribute-fidelity false + ATTR name document-name $filename + ATTR keyword compression none + ATTR keyword job-hold-until indefinite + ATTR mimeMediaType document-format $filetype + FILE $filename + + STATUS successful-ok + STATUS client-error-document-format-not-supported + STATUS server-error-job-canceled + STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 30 + + EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME" + EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag + WITH-VALUE >0 + EXPECT job-state OF-TYPE unknown|enum COUNT 1 IN-GROUP job-attributes-tag + WITH-VALUE 3,4,5,6,7,8,9 + EXPECT job-state-reasons OF-TYPE keyword IN-GROUP job-attributes-tag + EXPECT ?job-state-message OF-TYPE text IN-GROUP job-attributes-tag + EXPECT ?number-of-intervening-jobs OF-TYPE integer + IN-GROUP job-attributes-tag WITH-VALUE >-1 +} + + # Test Cancel-Job operation # # Required by: RFC 8011 section 4.3.3 diff --git a/test/run-stp-tests.sh b/test/run-stp-tests.sh index 39b53c3e45..e44e90a7c9 100755 --- a/test/run-stp-tests.sh +++ b/test/run-stp-tests.sh @@ -1049,7 +1049,7 @@ fi # Requests logged count=`wc -l $BASE/log/access_log | awk '{print $1}'` -expected=`expr 35 + 18 + 30 + $pjobs \* 8 + $pprinters \* $pjobs \* 4 + 2 + 2 + 5 + 4` +expected=`expr 36 + 18 + 30 + $pjobs \* 8 + $pprinters \* $pjobs \* 4 + 2 + 2 + 5 + 4` if test $count != $expected; then echo "FAIL: $count requests logged, expected $expected." echo "

FAIL: $count requests logged, expected $expected.

" >>$strfile