Skip to content

Commit ca93a96

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 a2b43e6 commit ca93a96

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
@@ -842,6 +842,48 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
842842
}
843843

844844

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