Skip to content

Commit 851dc81

Browse files
committed
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.
1 parent b546688 commit 851dc81

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

examples/ipp-1.1.test

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,48 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
843843
}
844844

845845

846+
# Test Print-Job operation with optional job-hold-until job template attribute
847+
#
848+
# Optional by: RFC 8011 section 5.2.2
849+
#
850+
# Needed to hold the job to ensure the next test - cancel-job - passes. On some quicker
851+
# machines the job can finish quicker than we are able to cancel it, which does not fail
852+
# the IPP test because the STATUS is expected, but the count of the caught errors differs.
853+
{
854+
SKIP-IF-NOT-DEFINED OPTIONAL_HOLD_JOB
855+
856+
NAME "RFC 8011 section 5.2.2: Print-Job Operation with optional job-hold-until job template attribute"
857+
OPERATION Print-Job
858+
GROUP operation-attributes-tag
859+
ATTR charset attributes-charset utf-8
860+
ATTR naturalLanguage attributes-natural-language en
861+
ATTR uri printer-uri $uri
862+
ATTR name requesting-user-name $user
863+
ATTR name job-name $filename
864+
ATTR boolean ipp-attribute-fidelity false
865+
ATTR name document-name $filename
866+
ATTR keyword compression none
867+
ATTR keyword job-hold-until indefinite
868+
ATTR mimeMediaType document-format $filetype
869+
FILE $filename
870+
871+
STATUS successful-ok
872+
STATUS client-error-document-format-not-supported
873+
STATUS server-error-job-canceled
874+
STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 30
875+
876+
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
877+
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
878+
WITH-VALUE >0
879+
EXPECT job-state OF-TYPE unknown|enum COUNT 1 IN-GROUP job-attributes-tag
880+
WITH-VALUE 3,4,5,6,7,8,9
881+
EXPECT job-state-reasons OF-TYPE keyword IN-GROUP job-attributes-tag
882+
EXPECT ?job-state-message OF-TYPE text IN-GROUP job-attributes-tag
883+
EXPECT ?number-of-intervening-jobs OF-TYPE integer
884+
IN-GROUP job-attributes-tag WITH-VALUE >-1
885+
}
886+
887+
846888
# Test Cancel-Job operation
847889
#
848890
# Required by: RFC 8011 section 4.3.3

test/run-stp-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ fi
10491049

10501050
# Requests logged
10511051
count=`wc -l $BASE/log/access_log | awk '{print $1}'`
1052-
expected=`expr 35 + 18 + 30 + $pjobs \* 8 + $pprinters \* $pjobs \* 4 + 2 + 2 + 5 + 4`
1052+
expected=`expr 36 + 18 + 30 + $pjobs \* 8 + $pprinters \* $pjobs \* 4 + 2 + 2 + 5 + 4`
10531053
if test $count != $expected; then
10541054
echo "FAIL: $count requests logged, expected $expected."
10551055
echo " <p>FAIL: $count requests logged, expected $expected.</p>" >>$strfile

0 commit comments

Comments
 (0)