]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Test suite: Add regression test for cupsSNMP/IPPSupplies 276/head
authorZdenek Dohnal <zdohnal@redhat.com>
Tue, 26 Oct 2021 15:33:40 +0000 (17:33 +0200)
committerZdenek Dohnal <zdohnal@redhat.com>
Tue, 26 Oct 2021 15:33:40 +0000 (17:33 +0200)
lpadmin can set cupsSNMPSupplies and cupsIPPSupplies keywords in the PPD
file which was broken in the past (Apple Issue #5610).

Until we get rid of PPD files completely or if we use the options in the
no-PPD future, it would be great if we had a regression test in the test
suite.

test/5.1-lpadmin.sh
test/run-stp-tests.sh

index 7efc398924e16d8f844625b59f9215c743b09246..61a9cca40e7bc2f1f427b7d7629d19cee631fad1 100644 (file)
@@ -61,3 +61,67 @@ else
        echo "    PASSED"
 fi
 echo ""
+
+echo "Add a printer for cupSNMP/IPPSupplies test"
+echo ""
+echo "    lpadmin -p Test4 -E -v file:/dev/null -m drv:///sample.drv/zebra.ppd"
+$runcups $VALGRIND ../systemv/lpadmin -p Test4 -E -v file:/dev/null -m drv:///sample.drv/zebra.ppd 2>&1
+if test $? != 0; then
+       echo "    FAILED"
+       exit 1
+else
+       echo "    PASSED"
+fi
+echo ""
+
+echo "Turn on cupsSNMP/IPPSupplies option"
+echo ""
+echo "    lpadmin -p Test4 -o cupsSNMPSupplies=true -o cupsIPPSupplies=true"
+$runcups $VALGRIND ../systemv/lpadmin -p Test4 -o cupsSNMPSupplies=true -o cupsIPPSupplies=true 2>&1
+grep '*cupsSNMPSupplies: True' $BASE/ppd/Test4.ppd
+if test $? != 0; then
+       echo "    FAILED"
+       exit 1
+else
+       echo "    PASSED"
+fi
+grep '*cupsIPPSupplies: True' $BASE/ppd/Test4.ppd
+if test $? != 0; then
+       echo "    FAILED"
+       exit 1
+else
+       echo "    PASSED"
+fi
+echo ""
+
+echo "Turn on cupsSNMP/IPPSupplies option"
+echo ""
+echo "    lpadmin -p Test4 -o cupsSNMPSupplies=false -o cupsIPPSupplies=false"
+$runcups $VALGRIND ../systemv/lpadmin -p Test4 -o cupsSNMPSupplies=false -o cupsIPPSupplies=false 2>&1
+grep '*cupsSNMPSupplies: False' $BASE/ppd/Test4.ppd
+if test $? != 0; then
+       echo "    FAILED"
+       exit 1
+else
+       echo "    PASSED"
+fi
+grep '*cupsIPPSupplies: False' $BASE/ppd/Test4.ppd
+if test $? != 0; then
+       echo "    FAILED"
+       exit 1
+else
+       echo "    PASSED"
+fi
+echo ""
+
+echo "Delete the printer with cupsSNMP/IPPSupplies"
+echo ""
+echo "    lpadmin -x Test4"
+$runcups $VALGRIND ../systemv/lpadmin -x Test4 2>&1
+if test $? != 0; then
+       echo "    FAILED"
+       exit 1
+else
+       echo "    PASSED"
+fi
+echo ""
index ae6d6a115b6541842c18b88de37cdeef76ca5b64..9de391d9e32fd71168e80d293eac63d330e894f9 100755 (executable)
@@ -1034,9 +1034,15 @@ else
        echo "    <p>PASS: Printer 'Test3' correctly produced $count page(s).</p>" >>$strfile
 fi
 
+# Number of requests from 5.1-lpadmin.sh: cupsSNMP/IPPSupplies tests - total 5 in 'expected':
+# - 2 requests for creating a queue - CUPS-Get-PPD and CUPS-Add-Modify-Printer
+# - 1 request for setting cupsSNMP/IPPSupplies to True - CUPS-Add-Modify-Printer
+# - 1 request for setting cupsSNMP/IPPSupplies to False - CUPS-Add-Modify-Printer
+# - 1 request for deleting the queue - CUPS-Delete-Printer
+
 # Requests logged
 count=`wc -l $BASE/log/access_log | awk '{print $1}'`
-expected=`expr 35 + 18 + 30 + $pjobs \* 8 + $pprinters \* $pjobs \* 4 + 2 + 2`
+expected=`expr 35 + 18 + 30 + $pjobs \* 8 + $pprinters \* $pjobs \* 4 + 2 + 2 + 5`
 if test $count != $expected; then
        echo "FAIL: $count requests logged, expected $expected."
        echo "    <p>FAIL: $count requests logged, expected $expected.</p>" >>$strfile