Skip to content

Commit

Permalink
Merge pull request #208 from zdohnal/page_range_undef_test
Browse files Browse the repository at this point in the history
test suite: Add tests for undefined page range limits
  • Loading branch information
zdohnal authored Oct 27, 2021
2 parents 8aa18ae + 55c7dfa commit 18e4f9d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 24 additions & 0 deletions test/5.5-lp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 9 additions & 2 deletions test/run-stp-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 18e4f9d

Please sign in to comment.