From 55c7dfa9ed973961adb8ad5ed6f433171d703c69 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Wed, 27 Oct 2021 06:58:42 +0200 Subject: [PATCH] Test suite: Add tests for undefined page range limits 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 | 1 + test/5.5-lp.sh | 24 ++++++++++++++++++++++++ test/run-stp-tests.sh | 11 +++++++++-- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 3c7eb40fc7..5236ed5179 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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) diff --git a/test/5.5-lp.sh b/test/5.5-lp.sh index 03adc5ffd7..a267791850 100644 --- a/test/5.5-lp.sh +++ b/test/5.5-lp.sh @@ -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" diff --git a/test/run-stp-tests.sh b/test/run-stp-tests.sh index 9de391d9e3..5037c81e1a 100755 --- a/test/run-stp-tests.sh +++ b/test/run-stp-tests.sh @@ -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 "

FAIL: $count requests logged, expected $expected.

" >>$strfile -- 2.47.2