]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Test suite: Add tests for undefined page range limits 208/head
authorZdenek Dohnal <zdohnal@redhat.com>
Wed, 27 Oct 2021 04:58:42 +0000 (06:58 +0200)
committerZdenek Dohnal <zdohnal@redhat.com>
Wed, 27 Oct 2021 04:58:42 +0000 (06:58 +0200)
Originally pdftopdf from cups-filters doesn't support page range with
undefined upper limit (f.e. '5-'), but I found out these page ranges
aren't checked in CUPS test suite neither.

It would be great if we could cover the use case in test suite to
prevent possible regressions in the future.

CHANGES.md
test/5.5-lp.sh
test/run-stp-tests.sh

index 3c7eb40fc712509cbc1434e395bf671fe1129c69..5236ed517963f31da7417f89e7a79cfaca754db4 100644 (file)
@@ -78,6 +78,7 @@ CUPS v2.4-b1 (Pending)
   `ListenBackLog`, `LPDConfigFile`, `KeepAliveTimeout`, `RIPCache`, and
   `SMBConfigFile` directives in `cupsd.conf` and `cups-files.conf`.
 - Stubbed out deprecated `httpMD5` functions.
+- Add test for undefined page ranges during printing.
 
 
 CUPS v2.3.3op2 (February 1, 2021)
index 03adc5ffd79a86becc6aa1bb6b9e890020ba3ea7..a267791850e6b5f91fbc6de3d2cc15f444c05ab7 100644 (file)
@@ -45,6 +45,30 @@ else
 fi
 echo ""
 
+echo "LP Page ranges Test - undefined low page limit"
+echo ""
+echo "    lp -d Test1 -P -5 testfile.pdf"
+$runcups $VALGRIND ../systemv/lp -d Test1 -P -5 ../examples/testfile.pdf 2>&1
+if test $? != 0; then
+       echo "    FAILED"
+       exit 1
+else
+       echo "    PASSED"
+fi
+echo ""
+
+echo "LP Page ranges Test - undefined upper page limit"
+echo ""
+echo "    lp -d Test1 -P 5- -o job-sheets=classified,classified testfile.pdf"
+$runcups $VALGRIND ../systemv/lp -d Test1 -P 5- ../examples/testfile.pdf 2>&1
+if test $? != 0; then
+       echo "    FAILED"
+       exit 1
+else
+       echo "    PASSED"
+fi
+echo ""
+
 echo "LP Flood Test ($1 times in parallel)"
 echo ""
 echo "    lp -d Test1 testfile.jpg"
index 9de391d9e32fd71168e80d293eac63d330e894f9..5037c81e1a0aba44df486454d2b10834406a213e 100755 (executable)
@@ -999,7 +999,10 @@ fi
 
 # Pages printed on Test1 (within 1 page for timing-dependent cancel issues)
 count=`$GREP '^Test1 ' $BASE/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
-expected=`expr $pjobs \* 2 + 34`
+# expected numbers of pages from page ranges tests:
+# - 5 pages for the job with a lower limit undefined (-5)
+# - 4 pages for the job with a upper limit undefined (5-)
+expected=`expr $pjobs \* 2 + 34 + 5 + 4`
 expected2=`expr $expected + 2`
 if test $count -lt $expected -a $count -gt $expected2; then
        echo "FAIL: Printer 'Test1' produced $count page(s), expected $expected."
@@ -1040,9 +1043,13 @@ fi
 # - 1 request for setting cupsSNMP/IPPSupplies to False - CUPS-Add-Modify-Printer
 # - 1 request for deleting the queue - CUPS-Delete-Printer
 
+# Number of requests related to undefined page range limits - total 4 in 'expected'
+# 2 requests (Create-Job, Send-Document) * number of jobs (2 - one for undefined
+# low limit, one for undefined upper limit)
+
 # 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`
+expected=`expr 35 + 18 + 30 + $pjobs \* 8 + $pprinters \* $pjobs \* 4 + 2 + 2 + 5 + 4`
 if test $count != $expected; then
        echo "FAIL: $count requests logged, expected $expected."
        echo "    <p>FAIL: $count requests logged, expected $expected.</p>" >>$strfile