diff options
author | Didier Raboud <odyx@debian.org> | 2012-10-25 20:44:09 +0200 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2012-10-25 20:44:09 +0200 |
commit | b0950df0920600c7b76f0aada5fb2d7dfe01eb7b (patch) | |
tree | 572af97f88a95670b867d6986953623579edc26e /test | |
parent | 3621a2b09269d8c9c136b4317193c31e96471ec6 (diff) | |
download | cups-b0950df0920600c7b76f0aada5fb2d7dfe01eb7b.tar.gz |
Imported Upstream version 1.4.4upstream/1.4.4
Diffstat (limited to 'test')
53 files changed, 5794 insertions, 0 deletions
diff --git a/test/4.1-requests.test b/test/4.1-requests.test new file mode 100644 index 00000000..860d43c0 --- /dev/null +++ b/test/4.1-requests.test @@ -0,0 +1,159 @@ +# +# "$Id: 4.1-requests.test 8235 2009-01-13 00:55:16Z mike $" +# +# Verify that the server requires the following attributes: +# +# attributes-charset +# attributes-natural-language +# printer-uri/job-uri +# +{ + # The name of the test... + NAME "No Attributes" + + # The operation to use + OPERATION get-jobs + + # What statuses are OK? + STATUS client-error-bad-request + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Charset Attribute" + + # The operation to use + OPERATION get-jobs + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + + # What statuses are OK? + STATUS client-error-bad-request + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Language Attribute" + + # The operation to use + OPERATION get-jobs + + # The attributes to send + GROUP operation + ATTR language attributes-natural-language en + + # What statuses are OK? + STATUS client-error-bad-request + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Language + Charset Attributes" + + # The operation to use + OPERATION get-jobs + + # The attributes to send + GROUP operation + ATTR language attributes-natural-language en + ATTR charset attributes-charset utf-8 + + # What statuses are OK? + STATUS client-error-bad-request + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Charset + Language Attributes" + + # The operation to use + OPERATION get-jobs + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + + # What statuses are OK? + STATUS client-error-bad-request + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Charset + Language + Printer URI Attributes" + + # The operation to use + OPERATION get-jobs + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Charset + Language + Job URI Attributes" + + # The operation to use + OPERATION get-jobs + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri job-uri $scheme://$hostname:$port/jobs + + # What statuses are OK? + STATUS client-error-bad-request + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Bad IPP Version" + + # The operation to use + OPERATION get-jobs + + # The version number to use + VERSION 0.0 + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri ipp://localhost/printers + + # What statuses are OK? + STATUS server-error-version-not-supported +} +# +# End of "$Id: 4.1-requests.test 8235 2009-01-13 00:55:16Z mike $" +# diff --git a/test/4.2-cups-printer-ops.test b/test/4.2-cups-printer-ops.test new file mode 100644 index 00000000..c858a8db --- /dev/null +++ b/test/4.2-cups-printer-ops.test @@ -0,0 +1,327 @@ +# +# "$Id: 4.2-cups-printer-ops.test 8536 2009-04-21 23:02:10Z mike $" +# +# Verify that the CUPS printer operations work. +# +{ + # The name of the test... + NAME "Add Printer Test1" + + # The operation to use + OPERATION cups-add-printer + RESOURCE /admin/ + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + + FILE testhp.ppd + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Verify Printer Test1 Added" + + # The operation to use + OPERATION get-printer-attributes + RESOURCE / + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Delete Printer Test1" + + # The operation to use + OPERATION cups-delete-printer + RESOURCE /admin/ + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Verify Printer Test1 Deleted" + + # The operation to use + OPERATION get-printer-attributes + RESOURCE / + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + + # What statuses are OK? + STATUS client-error-not-found + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Subscribe to Printer Events" + + # The operation to use + OPERATION Create-Printer-Subscription + RESOURCE / + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/ + ATTR name requesting-user-name $user + + GROUP subscription + ATTR uri notify-recipient-uri testnotify:// + ATTR keyword notify-events printer-added,printer-modified,printer-deleted + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT notify-subscription-id +} +{ + # The name of the test... + NAME "Add Printer Test2" + + # The operation to use + OPERATION cups-add-printer + RESOURCE /admin/ + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test2 + + FILE testhp.ppd + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Verify Printer Test2 Added" + + # The operation to use + OPERATION get-printer-attributes + RESOURCE / + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test2 + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Modify Printer Test2" + + # The operation to use + OPERATION cups-add-printer + RESOURCE /admin/ + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test2 + + GROUP printer + ATTR uri device-uri file:/tmp/Test2 + ATTR enum printer-state 3 + ATTR boolean printer-is-accepting-jobs true + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Re-Add Printer Test1" + + # The operation to use + OPERATION cups-add-printer + RESOURCE /admin/ + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + + GROUP printer + ATTR uri device-uri file:/tmp/Test1 + ATTR enum printer-state 3 + ATTR boolean printer-is-accepting-jobs true + + FILE testps.ppd + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Verify Printer Test1 Re-Added" + + # The operation to use + OPERATION get-printer-attributes + RESOURCE / + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Get Default Printer with no default set" + + # The operation to use + OPERATION cups-get-default + RESOURCE / + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + + # What statuses are OK? + STATUS client-error-not-found + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Set Default Printer to Test1" + + # The operation to use + OPERATION cups-set-default + RESOURCE /admin/ + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Get Default Printer" + + # The operation to use + OPERATION cups-get-default + RESOURCE / + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT printer-name + EXPECT printer-uri-supported +} +{ + # The name of the test... + NAME "Get IPP/2.x Attributes for Printer Test1" + + # The operation to use + OPERATION get-printer-attributes + RESOURCE / + + # The IPP version to use + VERSION 2.0 + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT media-col-default +} + +# +# End of "$Id: 4.2-cups-printer-ops.test 8536 2009-04-21 23:02:10Z mike $" +# diff --git a/test/4.3-job-ops.test b/test/4.3-job-ops.test new file mode 100644 index 00000000..b3d8b75a --- /dev/null +++ b/test/4.3-job-ops.test @@ -0,0 +1,330 @@ +# +# "$Id: 4.3-job-ops.test 8929 2009-12-15 22:40:37Z mike $" +# +# Verify that the IPP job operations work. +# +{ + # The name of the test... + NAME "Print PostScript Job with bad job-sheets value to Test1" + + # The operation to use + OPERATION print-job + RESOURCE /printers/Test1 + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + ATTR name requesting-user-name $user + ATTR name job-sheets "none\,none" + + FILE testfile.ps + + # What statuses are OK? + STATUS client-error-bad-request +} +{ + # The name of the test... + NAME "Print PostScript Job to Test1" + + # The operation to use + OPERATION print-job + RESOURCE /printers/Test1 + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + ATTR name requesting-user-name $user + + FILE testfile.ps + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT job-id +} +{ + # The name of the test... + NAME "Get Job Attributes" + + # The operation to use + OPERATION get-job-attributes + RESOURCE /jobs + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + ATTR integer job-id $job-id + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT job-id + EXPECT job-uri + EXPECT job-state +} +{ + # The name of the test... + NAME "Print JPEG Job to Test2" + + # The operation to use + OPERATION print-job + RESOURCE /printers/Test2 + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test2 + ATTR name requesting-user-name $user + + GROUP subscription + ATTR uri notify-recipient-uri testnotify:/// + + FILE testfile.jpg + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT job-id + EXPECT notify-subscription-id +} +{ + # The name of the test... + NAME "Get Job Attributes" + + # The operation to use + OPERATION get-job-attributes + RESOURCE /jobs + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test2 + ATTR integer job-id $job-id + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT job-id + EXPECT job-uri + EXPECT job-state +} +{ + # The name of the test... + NAME "Print Text Job to Test1" + + # The operation to use + OPERATION print-job + RESOURCE /printers/Test1 + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + ATTR name requesting-user-name $user + + FILE testfile.txt + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT job-id +} +{ + # The name of the test... + NAME "Print PDF Job to Test1" + + # The operation to use + OPERATION print-job + RESOURCE /printers/Test1 + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + ATTR name requesting-user-name $user + + GROUP job + ATTR keyword job-hold-until weekend + + FILE testfile.pdf + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT job-id +} +{ + # The name of the test... + NAME "Hold Job on Test1" + + # The operation to use + OPERATION hold-job + RESOURCE /printers/Test1 + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + ATTR integer job-id $job-id + ATTR name requesting-user-name $user + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Release Job on Test1" + + # The operation to use + OPERATION release-job + RESOURCE /printers/Test1 + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + ATTR integer job-id $job-id + ATTR name requesting-user-name $user + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Print Held Image Job to Test1" + + # The operation to use + OPERATION print-job + RESOURCE /printers/Test1 + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + ATTR name requesting-user-name $user + GROUP job + ATTR keyword job-hold-until indefinite + + FILE testfile.jpg + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT job-id +} +{ + # The name of the test... + NAME "Cancel Job" + + # The operation to use + OPERATION cancel-job + RESOURCE /jobs + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri job-uri $method://$hostname:$port/jobs/$job-id + ATTR name requesting-user-name $user + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Get Job List on Test1" + + # The operation to use + OPERATION get-jobs + RESOURCE /printers/Test1 + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $method://$hostname:$port/printers/Test1 + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT !job-printer-uri +} +{ + # The name of the test... + NAME "Get All Jobs" + + # The operation to use + OPERATION get-jobs + RESOURCE /jobs + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $scheme://$hostname:$port/ + ATTR keyword requested-attributes all + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT job-uri + EXPECT job-id + EXPECT job-state + EXPECT job-printer-uri +} + +# +# End of "$Id: 4.3-job-ops.test 8929 2009-12-15 22:40:37Z mike $" +# diff --git a/test/4.4-subscription-ops.test b/test/4.4-subscription-ops.test new file mode 100644 index 00000000..7ea3367e --- /dev/null +++ b/test/4.4-subscription-ops.test @@ -0,0 +1,148 @@ +# +# "$Id: 4.4-subscription-ops.test 8145 2008-11-19 19:45:40Z mike $" +# +# Verify that the CUPS subscription operations work. +# +{ + # The name of the test... + NAME "Add Printer Subscription w/Lease" + + # The operation to use + OPERATION Create-Printer-Subscription + RESOURCE / + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1 + + GROUP subscription + ATTR uri notify-recipient-uri testnotify:// + ATTR keyword notify-events printer-state-changed + ATTR integer notify-lease-duration 5 + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT notify-subscription-id + DISPLAY notify-subscription-id +} +{ + # The name of the test... + NAME "Verify Subscription Expiration" + + # Delay test for 7 seconds to allow lease to expire... + DELAY 7 + + # The operation to use + OPERATION Get-Subscription-Attributes + RESOURCE / + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1 + ATTR integer notify-subscription-id $notify-subscription-id + + # What statuses are OK? + STATUS client-error-not-found + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} +{ + # The name of the test... + NAME "Add 2 Printer Subscriptions w/Lease" + + # The operation to use + OPERATION Create-Printer-Subscription + RESOURCE / + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1 + + GROUP subscription + ATTR uri notify-recipient-uri testnotify:// + ATTR keyword notify-events printer-state-changed + ATTR integer notify-lease-duration 5 + + GROUP subscription + ATTR uri notify-recipient-uri testnotify:// + ATTR keyword notify-events printer-config-changed + ATTR integer notify-lease-duration 5 + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT notify-subscription-id + DISPLAY notify-subscription-id +} +{ + # The name of the test... + NAME "List Printer Subscriptions" + + # The operation to use + OPERATION Get-Subscriptions + RESOURCE / + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1 + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT notify-subscription-id + DISPLAY notify-subscription-id + EXPECT notify-printer-uri + DISPLAY notify-printer-uri + EXPECT notify-events + DISPLAY notify-events +} +{ + # The name of the test... + NAME "Check MaxSubscriptions limits" + + # The operation to use + OPERATION Create-Printer-Subscription + RESOURCE / + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1 + + GROUP subscription + ATTR uri notify-recipient-uri testnotify:// + ATTR keyword notify-events printer-state-changed + ATTR integer notify-lease-duration 5 + + # What statuses are OK? + STATUS client-error-too-many-subscriptions + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language +} + +# +# End of "$Id: 4.4-subscription-ops.test 8145 2008-11-19 19:45:40Z mike $" +# diff --git a/test/5.1-lpadmin.sh b/test/5.1-lpadmin.sh new file mode 100644 index 00000000..f1699616 --- /dev/null +++ b/test/5.1-lpadmin.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# +# "$Id: 5.1-lpadmin.sh 8266 2009-01-19 23:10:15Z mike $" +# +# Test the lpadmin command. +# +# Copyright 2007-2009 by Apple Inc. +# Copyright 1997-2005 by Easy Software Products, all rights reserved. +# +# These coded instructions, statements, and computer programs are the +# property of Apple Inc. and are protected by Federal copyright +# law. Distribution and use rights are outlined in the file "LICENSE.txt" +# which should have been included with this file. If this file is +# file is missing or damaged, see the license at "http://www.cups.org/". +# + +echo "Add Printer Test" +echo "" +echo " lpadmin -p Test3 -v file:/dev/null -E -m drv:///sample.drv/deskjet.ppd" +../systemv/lpadmin -p Test3 -v file:/dev/null -E -m drv:///sample.drv/deskjet.ppd 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +echo "Modify Printer Test" +echo "" +echo " lpadmin -p Test3 -v file:/tmp/Test3 -o PageSize=A4" +../systemv/lpadmin -p Test3 -v file:/tmp/Test3 -o PageSize=A4 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +echo "Delete Printer Test" +echo "" +echo " lpadmin -x Test3" +../systemv/lpadmin -x Test3 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +# +# End of "$Id: 5.1-lpadmin.sh 8266 2009-01-19 23:10:15Z mike $". +# diff --git a/test/5.2-lpc.sh b/test/5.2-lpc.sh new file mode 100644 index 00000000..b6908052 --- /dev/null +++ b/test/5.2-lpc.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# "$Id: 5.2-lpc.sh 6649 2007-07-11 21:46:42Z mike $" +# +# Test the lpc command. +# +# Copyright 2007 by Apple Inc. +# Copyright 1997-2005 by Easy Software Products, all rights reserved. +# +# These coded instructions, statements, and computer programs are the +# property of Apple Inc. and are protected by Federal copyright +# law. Distribution and use rights are outlined in the file "LICENSE.txt" +# which should have been included with this file. If this file is +# file is missing or damaged, see the license at "http://www.cups.org/". +# + +echo "LPC Test" +echo "" +echo " lpc status" +../berkeley/lpc status 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +# +# End of "$Id: 5.2-lpc.sh 6649 2007-07-11 21:46:42Z mike $". +# diff --git a/test/5.3-lpq.sh b/test/5.3-lpq.sh new file mode 100644 index 00000000..05f66a99 --- /dev/null +++ b/test/5.3-lpq.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# "$Id: 5.3-lpq.sh 8144 2008-11-19 19:23:12Z mike $" +# +# Test the lpq command. +# +# Copyright 2007 by Apple Inc. +# Copyright 1997-2005 by Easy Software Products, all rights reserved. +# +# These coded instructions, statements, and computer programs are the +# property of Apple Inc. and are protected by Federal copyright +# law. Distribution and use rights are outlined in the file "LICENSE.txt" +# which should have been included with this file. If this file is +# file is missing or damaged, see the license at "http://www.cups.org/". +# + +echo "LPQ Test" +echo "" +echo " lpq -P Test1" +../berkeley/lpq -P Test1 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +# +# End of "$Id: 5.3-lpq.sh 8144 2008-11-19 19:23:12Z mike $". +# diff --git a/test/5.4-lpstat.sh b/test/5.4-lpstat.sh new file mode 100644 index 00000000..31818919 --- /dev/null +++ b/test/5.4-lpstat.sh @@ -0,0 +1,43 @@ +#!/bin/sh +# +# "$Id: 5.4-lpstat.sh 8498 2009-04-13 17:03:15Z mike $" +# +# Test the lpstat command. +# +# Copyright 2007-2009 by Apple Inc. +# Copyright 1997-2005 by Easy Software Products, all rights reserved. +# +# These coded instructions, statements, and computer programs are the +# property of Apple Inc. and are protected by Federal copyright +# law. Distribution and use rights are outlined in the file "LICENSE.txt" +# which should have been included with this file. If this file is +# file is missing or damaged, see the license at "http://www.cups.org/". +# + +echo "LPSTAT Test" +echo "" +echo " lpstat -t" +../systemv/lpstat -t 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +echo "LPSTAT Test" +echo "" +echo " lpstat -H" +server="`../systemv/lpstat -H 2>&1`" +if test $? != 0 -o "x$server" != xlocalhost:8631; then + echo " FAILED ($server)" + exit 1 +else + echo " PASSED ($server)" +fi +echo "" + +# +# End of "$Id: 5.4-lpstat.sh 8498 2009-04-13 17:03:15Z mike $". +# diff --git a/test/5.5-lp.sh b/test/5.5-lp.sh new file mode 100644 index 00000000..630f8e81 --- /dev/null +++ b/test/5.5-lp.sh @@ -0,0 +1,86 @@ +#!/bin/sh +# +# "$Id: 5.5-lp.sh 8380 2009-02-22 05:24:23Z mike $" +# +# Test the lp command. +# +# Copyright 2007-2009 by Apple Inc. +# Copyright 1997-2005 by Easy Software Products, all rights reserved. +# +# These coded instructions, statements, and computer programs are the +# property of Apple Inc. and are protected by Federal copyright +# law. Distribution and use rights are outlined in the file "LICENSE.txt" +# which should have been included with this file. If this file is +# file is missing or damaged, see the license at "http://www.cups.org/". +# + +echo "LP Default Test" +echo "" +echo " lp testfile.pdf" +../systemv/lp testfile.pdf 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +echo "LP Destination Test" +echo "" +echo " lp -d Test2 testfile.jpg" +../systemv/lp -d Test2 testfile.jpg 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +echo "LP Options Test" +echo "" +echo " lp -d Test1 -P 1-4 -o job-sheets=classified,classified testfile.pdf" +../systemv/lp -d Test1 -P 1-4 -o job-sheets=classified,classified 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" +echo " lp -d Test2 testfile.jpg" +i=0 +while test $i -lt $1; do + echo " flood copy $i..." 1>&2 + + j=1 + while test $j -le $2; do + ../systemv/lp -d test-$j testfile.jpg 2>&1 + j=`expr $j + 1` + done + + ../systemv/lp -d Test1 testfile.jpg 2>&1 & + ../systemv/lp -d Test2 testfile.jpg 2>&1 & + lppid=$! + + i=`expr $i + 1` +done +wait $lppid +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +./waitjobs.sh + +# +# End of "$Id: 5.5-lp.sh 8380 2009-02-22 05:24:23Z mike $". +# diff --git a/test/5.6-lpr.sh b/test/5.6-lpr.sh new file mode 100644 index 00000000..a5059b86 --- /dev/null +++ b/test/5.6-lpr.sh @@ -0,0 +1,86 @@ +#!/bin/sh +# +# "$Id: 5.6-lpr.sh 8380 2009-02-22 05:24:23Z mike $" +# +# Test the lpr command. +# +# Copyright 2007-2009 by Apple Inc. +# Copyright 1997-2005 by Easy Software Products, all rights reserved. +# +# These coded instructions, statements, and computer programs are the +# property of Apple Inc. and are protected by Federal copyright +# law. Distribution and use rights are outlined in the file "LICENSE.txt" +# which should have been included with this file. If this file is +# file is missing or damaged, see the license at "http://www.cups.org/". +# + +echo "LPR Default Test" +echo "" +echo " lpr testfile.pdf" +../berkeley/lpr testfile.pdf 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +echo "LPR Destination Test" +echo "" +echo " lpr -P Test2 testfile.jpg" +../berkeley/lpr -P Test2 testfile.jpg 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +echo "LPR Options Test" +echo "" +echo " lpr -P Test1 -o number-up=4 -o job-sheets=standard,none testfile.pdf" +../berkeley/lpr -P Test1 -o number-up=4 -o job-sheets=standard,none testfile.pdf 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +echo "LPR Flood Test ($1 times in parallel)" +echo "" +echo " lpr -P Test1 testfile.jpg" +echo " lpr -P Test2 testfile.jpg" +i=0 +while test $i -lt $1; do + echo " flood copy $i..." 1>&2 + + j=1 + while test $j -le $2; do + ../berkeley/lpr -P test-$j testfile.jpg 2>&1 + j=`expr $j + 1` + done + + ../berkeley/lpr -P Test1 testfile.jpg 2>&1 & + ../berkeley/lpr -P Test2 testfile.jpg 2>&1 & + lprpid=$! + + i=`expr $i + 1` +done +wait $lppid +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +./waitjobs.sh + +# +# End of "$Id: 5.6-lpr.sh 8380 2009-02-22 05:24:23Z mike $". +# diff --git a/test/5.7-lprm.sh b/test/5.7-lprm.sh new file mode 100644 index 00000000..bcb72116 --- /dev/null +++ b/test/5.7-lprm.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# +# "$Id: 5.7-lprm.sh 7409 2008-03-29 00:26:03Z mike $" +# +# Test the lprm command. +# +# Copyright 2007 by Apple Inc. +# Copyright 1997-2005 by Easy Software Products, all rights reserved. +# +# These coded instructions, statements, and computer programs are the +# property of Apple Inc. and are protected by Federal copyright +# law. Distribution and use rights are outlined in the file "LICENSE.txt" +# which should have been included with this file. If this file is +# file is missing or damaged, see the license at "http://www.cups.org/". +# + +echo "LPRM Current Test" +echo "" +echo " lpr -o job-hold-until=indefinite testfile.jpg" +../berkeley/lpr -o job-hold-until=indefinite testfile.jpg 2>&1 +echo " lprm" +../berkeley/lprm 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +echo "LPRM Destination Test" +echo "" +echo " lpr -P Test1 -o job-hold-until=indefinite testfile.jpg" +../berkeley/lpr -P Test1 -o job-hold-until=indefinite testfile.jpg 2>&1 +echo " lprm Test1" +../berkeley/lprm Test1 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +# +# End of "$Id: 5.7-lprm.sh 7409 2008-03-29 00:26:03Z mike $". +# diff --git a/test/5.8-cancel.sh b/test/5.8-cancel.sh new file mode 100644 index 00000000..7cf31b0d --- /dev/null +++ b/test/5.8-cancel.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# +# "$Id: 5.8-cancel.sh 7409 2008-03-29 00:26:03Z mike $" +# +# Test the cancel command. +# +# Copyright 2007-2008 by Apple Inc. +# Copyright 1997-2006 by Easy Software Products, all rights reserved. +# +# These coded instructions, statements, and computer programs are the +# property of Apple Inc. and are protected by Federal copyright +# law. Distribution and use rights are outlined in the file "LICENSE.txt" +# which should have been included with this file. If this file is +# file is missing or damaged, see the license at "http://www.cups.org/". +# + +echo "Cancel Destination Test" +echo "" +echo " lp -d Test1 -o job-hold-until=indefinite testfile.jpg" +../systemv/lp -d Test1 -o job-hold-until=indefinite testfile.jpg 2>&1 +echo " cancel Test1" +../systemv/cancel Test1 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +echo "Cancel All Test" +echo "" +echo " cancel -a" +../systemv/cancel -a 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +# +# End of "$Id: 5.8-cancel.sh 7409 2008-03-29 00:26:03Z mike $". +# diff --git a/test/5.9-lpinfo.sh b/test/5.9-lpinfo.sh new file mode 100644 index 00000000..1902aeb9 --- /dev/null +++ b/test/5.9-lpinfo.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# +# "$Id: 5.9-lpinfo.sh 7711 2008-07-02 04:39:27Z mike $" +# +# Test the lpinfo command. +# +# Copyright 2007-2008 by Apple Inc. +# Copyright 1997-2005 by Easy Software Products, all rights reserved. +# +# These coded instructions, statements, and computer programs are the +# property of Apple Inc. and are protected by Federal copyright +# law. Distribution and use rights are outlined in the file "LICENSE.txt" +# which should have been included with this file. If this file is +# file is missing or damaged, see the license at "http://www.cups.org/". +# + +echo "LPINFO Devices Test" +echo "" +echo " lpinfo -v" +../systemv/lpinfo -v 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +echo "LPINFO Drivers Test" +echo "" +echo " lpinfo -m" +../systemv/lpinfo -m 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +echo "LPINFO Drivers Test" +echo "" +echo " lpinfo -m | grep -q sample.drv" +../systemv/lpinfo -m | grep -q sample.drv 2>&1 +if test $? != 0; then + echo " FAILED" + exit 1 +else + echo " PASSED" +fi +echo "" + +# +# End of "$Id: 5.9-lpinfo.sh 7711 2008-07-02 04:39:27Z mike $". +# diff --git a/test/Dependencies b/test/Dependencies new file mode 100644 index 00000000..43ea4007 --- /dev/null +++ b/test/Dependencies @@ -0,0 +1,5 @@ +# DO NOT DELETE THIS LINE -- make depend depends on it. + +ipptest.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h +ipptest.o: ../cups/http.h ../cups/versioning.h ../cups/ppd.h ../cups/array.h +ipptest.o: ../cups/file.h ../cups/language.h ../cups/language.h diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 00000000..b218f1c7 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,117 @@ +# +# "$Id: Makefile 8224 2009-01-09 21:28:38Z mike $" +# +# IPP test makefile for the Common UNIX Printing System (CUPS). +# +# Copyright 2007-2009 by Apple Inc. +# Copyright 1997-2006 by Easy Software Products, all rights reserved. +# +# These coded instructions, statements, and computer programs are the +# property of Apple Inc. and are protected by Federal copyright +# law. Distribution and use rights are outlined in the file "LICENSE.txt" +# which should have been included with this file. If this file is +# file is missing or damaged, see the license at "http://www.cups.org/". +# + +include ../Makedefs + + +# +# Make all targets... +# + +all: ipptest + + +# +# Make library targets... +# + +libs: + + +# +# Make unit tests... +# + +unittests: + + +# +# Clean all object files... +# + +clean: + $(RM) ipptest ipptest.o + + +# +# Update dependencies (without system header dependencies...) +# + +depend: + makedepend -Y -I.. -fDependencies ipptest.c >/dev/null 2>&1 + + +# +# Install all targets... +# + +install: all install-data install-headers install-libs install-exec + + +# +# Install data files... +# + +install-data: + + +# +# Install programs... +# + +install-exec: + + +# +# Install headers... +# + +install-headers: + + +# +# Install libraries... +# + +install-libs: + + +# +# Unnstall all targets... +# + +uninstall: + + +# +# ipptest +# + +ipptest: ipptest.o ../cups/libcups.a + echo Linking $@... + $(CC) $(LDFLAGS) -o ipptest ipptest.o ../cups/libcups.a \ + $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ) + + +# +# Dependencies... +# + +include Dependencies + + +# +# End of "$Id: Makefile 8224 2009-01-09 21:28:38Z mike $". +# diff --git a/test/create-job-format.test b/test/create-job-format.test new file mode 100644 index 00000000..87d94a5b --- /dev/null +++ b/test/create-job-format.test @@ -0,0 +1,56 @@ +# Print a test page using create-job + send-document, specifying the +# document format. +{ + # The name of the test... + NAME "Print test page using create-job" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION create-job + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + + GROUP job + ATTR integer copies 1 + + # What statuses are OK? + STATUS ok + STATUS ok-subst + + # What attributes do we expect? + EXPECT job-id + EXPECT job-uri +} +{ + # The name of the test... + NAME "... and send-document" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION send-document + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR integer job-id $job-id + ATTR name requesting-user-name $user + ATTR mimetype document-format application/postscript + ATTR boolean last-document true + + FILE ../data/testprint.ps + + # What statuses are OK? + STATUS ok + STATUS ok-subst +} diff --git a/test/create-job-sheets.test b/test/create-job-sheets.test new file mode 100644 index 00000000..d15bb7d4 --- /dev/null +++ b/test/create-job-sheets.test @@ -0,0 +1,55 @@ +# Test create-job + send-document with job-sheets attribute +{ + # The name of the test... + NAME "Print test page using create-job" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION create-job + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + + GROUP job + ATTR integer copies 1 + ATTR name job-sheets standard + + # What statuses are OK? + STATUS ok + STATUS ok-subst + + # What attributes do we expect? + EXPECT job-id + EXPECT job-uri +} +{ + # The name of the test... + NAME "... and send-document" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION send-document + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR integer job-id $job-id + ATTR name requesting-user-name $user + ATTR boolean last-document true + + FILE ../data/testprint.ps + + # What statuses are OK? + STATUS ok + STATUS ok-subst +} diff --git a/test/create-job-timeout.test b/test/create-job-timeout.test new file mode 100644 index 00000000..514924d4 --- /dev/null +++ b/test/create-job-timeout.test @@ -0,0 +1,54 @@ +# Print a test page using create-job + send-document, but don't send +# last-document = true +{ + # The name of the test... + NAME "Print test page using create-job" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION create-job + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + + GROUP job + ATTR integer copies 1 + ATTR name job-sheets unclassified,unclassified + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT job-id + EXPECT job-uri +} +{ + # The name of the test... + NAME "... and send-document" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION send-document + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR integer job-id $job-id + ATTR name requesting-user-name $user + ATTR mimetype document-format application/octet-stream + + FILE ../data/testprint.ps + + # What statuses are OK? + STATUS successful-ok +} diff --git a/test/create-job.test b/test/create-job.test new file mode 100644 index 00000000..61336c63 --- /dev/null +++ b/test/create-job.test @@ -0,0 +1,52 @@ +# Print a test page using create-job + send-document +{ + # The name of the test... + NAME "Print test page using create-job" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION create-job + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + + GROUP job + ATTR integer copies 1 + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT job-id + EXPECT job-uri +} +{ + # The name of the test... + NAME "... and send-document" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION send-document + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR integer job-id $job-id + ATTR name requesting-user-name $user + ATTR boolean last-document true + + FILE ../data/testprint.ps + + # What statuses are OK? + STATUS successful-ok +} diff --git a/test/create-printer-subscription.test b/test/create-printer-subscription.test new file mode 100644 index 00000000..c6427ef7 --- /dev/null +++ b/test/create-printer-subscription.test @@ -0,0 +1,36 @@ +# +# "$Id: 4.4-subscription-ops.test 4840 2005-11-14 21:53:30Z mike $" +# +# Verify that the CUPS subscription operations work. +# +{ + # The name of the test... + NAME "Add Printer Subscription w/Lease" + + # The operation to use + OPERATION Create-Printer-Subscription + RESOURCE / + + # The attributes to send + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + + GROUP subscription + ATTR uri notify-recipient testnotify://nowait + ATTR keyword notify-events printer-state-changed + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT attributes-charset + EXPECT attributes-natural-language + EXPECT notify-subscription-id + DISPLAY notify-subscription-id +} + +# +# End of "$Id: 4.4-subscription-ops.test 4840 2005-11-14 21:53:30Z mike $" +# diff --git a/test/get-devices.test b/test/get-devices.test new file mode 100644 index 00000000..76bb5ec7 --- /dev/null +++ b/test/get-devices.test @@ -0,0 +1,21 @@ +# Get devices using CUPS-get-devices +{ + # The name of the test... + NAME "Get devices using CUPS-get-devices" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION CUPS-get-devices + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + + # What statuses are OK? + STATUS ok + STATUS ok-subst +} diff --git a/test/get-job-attributes.test b/test/get-job-attributes.test new file mode 100644 index 00000000..ba62bd7f --- /dev/null +++ b/test/get-job-attributes.test @@ -0,0 +1,27 @@ +# Test get-job-attributes by sending a print job, getting the attributes, +# and cancelling it. +{ + # The name of the test... + NAME "Get job info with get-job-attributes" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION get-job-attributes + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri job-uri $uri +# ATTR keyword requested-attributes job-media-sheets-completed,job-state + + # What statuses are OK? + #STATUS ok + #STATUS ok-subst + + # What attributes do we expect? + EXPECT job-uri + EXPECT job-state +} diff --git a/test/get-job-attributes2.test b/test/get-job-attributes2.test new file mode 100644 index 00000000..6a8673f8 --- /dev/null +++ b/test/get-job-attributes2.test @@ -0,0 +1,28 @@ +# Test get-job-attributes +{ + # The name of the test... + NAME "get-job-attributes" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION get-job-attributes + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri job-uri $uri + + # What statuses are OK? + STATUS ok + STATUS ok-subst + + # What attributes do we expect? + EXPECT job-uri + EXPECT job-state + EXPECT time-at-creation + EXPECT time-at-completed + EXPECT time-at-processing +} diff --git a/test/get-jobs.test b/test/get-jobs.test new file mode 100644 index 00000000..1b4ed201 --- /dev/null +++ b/test/get-jobs.test @@ -0,0 +1,21 @@ +# Get list of jobs +{ + # The name of the test... + NAME "Get-Jobs" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION Get-Jobs + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri +# ATTR keyword which-jobs completed + + # What statuses are OK? + STATUS successful-ok +} diff --git a/test/get-ppd-printer.test b/test/get-ppd-printer.test new file mode 100644 index 00000000..4f723f88 --- /dev/null +++ b/test/get-ppd-printer.test @@ -0,0 +1,20 @@ +# Get printer PPD file using CUPS-Get-PPD +{ + # The name of the test... + NAME "Get printer PPD file using CUPS-Get-PPD" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION CUPS-Get-PPD + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + + # What statuses are OK? + STATUS successful-ok +} diff --git a/test/get-ppd.test b/test/get-ppd.test new file mode 100644 index 00000000..24a935e4 --- /dev/null +++ b/test/get-ppd.test @@ -0,0 +1,20 @@ +# Get PPD file using CUPS-get-ppd +{ + # The name of the test... + NAME "Get PPD file using CUPS-get-ppd" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION CUPS-get-ppd + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR name ppd-name $ENV[ppd-name] + + # What statuses are OK? + STATUS successful-ok +} diff --git a/test/get-ppds-drv-only.test b/test/get-ppds-drv-only.test new file mode 100644 index 00000000..ccb1828d --- /dev/null +++ b/test/get-ppds-drv-only.test @@ -0,0 +1,24 @@ +# Get drv-based PPD files using CUPS-Get-PPDs +{ + # The name of the test... + NAME "Get drv-based PPD files using CUPS-Get-PPDs" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION CUPS-Get-PPDs + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name include-schemes drv + + # What statuses are OK? + STATUS ok + STATUS ok-subst + + EXPECT ppd-name +} diff --git a/test/get-ppds-language.test b/test/get-ppds-language.test new file mode 100644 index 00000000..2ed01186 --- /dev/null +++ b/test/get-ppds-language.test @@ -0,0 +1,21 @@ +# Get PPD files using CUPS-Get-PPDs and language +{ + # The name of the test... + NAME "Get PPD files using CUPS-Get-PPDs and language" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION CUPS-Get-PPDs + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR language ppd-natural-language $ENV[language] + + # What statuses are OK? + STATUS successful-ok +} diff --git a/test/get-ppds-make-and-model.test b/test/get-ppds-make-and-model.test new file mode 100644 index 00000000..c57b1473 --- /dev/null +++ b/test/get-ppds-make-and-model.test @@ -0,0 +1,21 @@ +# Get PPD files using CUPS-Get-PPDs and model +{ + # The name of the test... + NAME "Get PPD files using CUPS-Get-PPDs and model" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION CUPS-Get-PPDs + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR text ppd-make-and-model $ENV[model] + + # What statuses are OK? + STATUS successful-ok +} diff --git a/test/get-ppds-make.test b/test/get-ppds-make.test new file mode 100644 index 00000000..ac3f736e --- /dev/null +++ b/test/get-ppds-make.test @@ -0,0 +1,21 @@ +# Get PPD files using CUPS-Get-PPDs and make +{ + # The name of the test... + NAME "Get PPD files using CUPS-Get-PPDs and make" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION CUPS-Get-PPDs + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR text ppd-make $ENV[make] + + # What statuses are OK? + STATUS successful-ok +} diff --git a/test/get-ppds-product.test b/test/get-ppds-product.test new file mode 100644 index 00000000..b0535f7e --- /dev/null +++ b/test/get-ppds-product.test @@ -0,0 +1,21 @@ +# Get PPD files using CUPS-Get-PPDs and Product +{ + # The name of the test... + NAME "Get PPD files using CUPS-Get-PPDs and Product" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION CUPS-Get-PPDs + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR text ppd-product $ENV[product] + + # What statuses are OK? + STATUS successful-ok +} diff --git a/test/get-ppds-psversion.test b/test/get-ppds-psversion.test new file mode 100644 index 00000000..b7f93b67 --- /dev/null +++ b/test/get-ppds-psversion.test @@ -0,0 +1,21 @@ +# Get PPD files using CUPS-Get-PPDs and PSVersion +{ + # The name of the test... + NAME "Get PPD files using CUPS-Get-PPDs and PSVersion" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION CUPS-Get-PPDs + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR text ppd-psversion $ENV[psversion] + + # What statuses are OK? + STATUS successful-ok +} diff --git a/test/get-ppds.test b/test/get-ppds.test new file mode 100644 index 00000000..90f59eb6 --- /dev/null +++ b/test/get-ppds.test @@ -0,0 +1,21 @@ +# Get PPD files using CUPS-get-ppds +{ + # The name of the test... + NAME "Get PPD files using CUPS-get-ppds" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION CUPS-get-ppds + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + + # What statuses are OK? + STATUS ok + STATUS ok-subst +} diff --git a/test/get-printer-attributes-2.0.test b/test/get-printer-attributes-2.0.test new file mode 100644 index 00000000..c123c3e1 --- /dev/null +++ b/test/get-printer-attributes-2.0.test @@ -0,0 +1,48 @@ +# Get printer attributes using get-printer-attributes +{ + # The name of the test... + NAME "Get printer attributes using get-printer-attributes" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION get-printer-attributes + + # The version to use + VERSION 2.0 + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR keyword requested-attributes printer-defaults,printer-description,media-col-database + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT charset-configured + EXPECT charset-supported + EXPECT compression-supported + EXPECT document-format-default + EXPECT document-format-supported + EXPECT generated-natural-language-supported + EXPECT ipp-versions-supported + EXPECT media-col-default + EXPECT natural-language-configured + EXPECT operations-supported + EXPECT printer-info + EXPECT printer-is-accepting-jobs + EXPECT printer-location + EXPECT printer-make-and-model + EXPECT printer-more-info + EXPECT printer-name + EXPECT printer-state + EXPECT printer-state-reasons + EXPECT printer-up-time + EXPECT printer-uri-supported + EXPECT uri-authentication-supported + EXPECT uri-security-supported +} diff --git a/test/get-printer-attributes.test b/test/get-printer-attributes.test new file mode 100644 index 00000000..54ce778b --- /dev/null +++ b/test/get-printer-attributes.test @@ -0,0 +1,41 @@ +# Get printer attributes using get-printer-attributes +{ + # The name of the test... + NAME "Get printer attributes using get-printer-attributes" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION get-printer-attributes + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + + # What statuses are OK? + STATUS successful-ok + + # What attributes do we expect? + EXPECT charset-configured + EXPECT charset-supported + EXPECT compression-supported + EXPECT document-format-default + EXPECT document-format-supported + EXPECT generated-natural-language-supported + EXPECT ipp-versions-supported + EXPECT natural-language-configured + EXPECT operations-supported + EXPECT pdl-override-supported + EXPECT printer-is-accepting-jobs + EXPECT printer-name + EXPECT printer-state + EXPECT printer-state-reasons + EXPECT printer-up-time + EXPECT printer-uri-supported + EXPECT queued-job-count + EXPECT uri-authentication-supported + EXPECT uri-security-supported +} diff --git a/test/get-printers.test b/test/get-printers.test new file mode 100644 index 00000000..54f8df4c --- /dev/null +++ b/test/get-printers.test @@ -0,0 +1,19 @@ +# Get printer attributes using get-printer-attributes +{ + # The name of the test... + NAME "CUPS-Get-Printers" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION CUPS-Get-Printers + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + + # What statuses are OK? + STATUS successful-ok +} diff --git a/test/get-subscriptions.test b/test/get-subscriptions.test new file mode 100644 index 00000000..686059df --- /dev/null +++ b/test/get-subscriptions.test @@ -0,0 +1,21 @@ +# Get subscriptions using Get-Subscriptions +{ + # The name of the test... + NAME "Get subscriptions using Get-Subscriptions" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION Get-Subscriptions + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + + # What statuses are OK? + STATUS ok + STATUS ok-subst +} diff --git a/test/ipp-backend.test b/test/ipp-backend.test new file mode 100644 index 00000000..c2642d37 --- /dev/null +++ b/test/ipp-backend.test @@ -0,0 +1,22 @@ +# Get printer attributes using get-printer-attributes +{ + # The name of the test... + NAME "Get printer attributes using get-printer-attributes" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION get-printer-attributes + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR keyword requested-attributes com.apple.print.recoverable-message,copies-supported,document-format-supported,marker-colors,marker-levels,marker-message,marker-names,marker-types,printer-is-accepting-jobs,printer-state,printer-state-message,printer-state-reasons + + # What statuses are OK? + STATUS successful-ok + STATUS successful-ok-ignored-or-substituted-attributes +} diff --git a/test/ipptest.c b/test/ipptest.c new file mode 100644 index 00000000..e95bc656 --- /dev/null +++ b/test/ipptest.c @@ -0,0 +1,1278 @@ +/* + * "$Id: ipptest.c 8929 2009-12-15 22:40:37Z mike $" + * + * IPP test command for the Common UNIX Printing System (CUPS). + * + * Copyright 2007-2009 by Apple Inc. + * Copyright 1997-2007 by Easy Software Products. + * + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * which should have been included with this file. If this file is + * file is missing or damaged, see the license at "http://www.cups.org/". + * + * Contents: + * + * main() - Parse options and do tests. + * do_tests() - Do tests as specified in the test file. + * expect_matches() - Return true if the tag matches the specification. + * get_token() - Get a token from a file. + * print_attr() - Print an attribute on the screen. + * print_col() - Print a collection attribute on the screen. + * usage() - Show program usage. + */ + +/* + * Include necessary headers... + */ + +#include <stdio.h> +#include <stdlib.h> +#include <cups/string.h> +#include <errno.h> +#include <ctype.h> + +#include <cups/cups.h> +#include <cups/language.h> +#include <cups/http-private.h> +#ifndef O_BINARY +# define O_BINARY 0 +#endif /* !O_BINARY */ + + +/* + * Types... + */ + +typedef struct _cups_expect_s /**** Expected attribute info ****/ +{ + int not_expect; /* Don't expect attribute? */ + char *name, /* Attribute name */ + *of_type, /* Type name */ + *same_count_as, /* Parallel attribute name */ + *if_defined; /* Only required if variable defined */ +} _cups_expect_t; + + +/* + * Globals... + */ + +int Chunking = 0; /* Use chunked requests */ +int Verbosity = 0; /* Show all attributes? */ + + +/* + * Local functions... + */ + +static int do_tests(const char *uri, const char *testfile); +static int expect_matches(_cups_expect_t *expect, ipp_tag_t value_tag); +static char *get_token(FILE *fp, char *buf, int buflen, + int *linenum); +static void print_attr(ipp_attribute_t *attr); +static void print_col(ipp_t *col); +static void usage(void); + + +/* + * 'main()' - Parse options and do tests. + */ + +int /* O - Exit status */ +main(int argc, /* I - Number of command-line args */ + char *argv[]) /* I - Command-line arguments */ +{ + int i; /* Looping var */ + int status; /* Status of tests... */ + char *opt; /* Current option */ + const char *uri, /* URI to use */ + *testfile; /* Test file to use */ + int interval; /* Test interval */ + + + /* + * We need at least: + * + * testipp URL testfile + */ + + uri = NULL; + testfile = NULL; + status = 0; + interval = 0; + + for (i = 1; i < argc; i ++) + { + if (argv[i][0] == '-') + { + for (opt = argv[i] + 1; *opt; opt ++) + { + switch (*opt) + { + case 'c' : /* Enable HTTP chunking */ + Chunking = 1; + break; + + case 'd' : /* Define a variable */ + i ++; + + if (i >= argc) + { + fputs("ipptest: Missing name=value for \"-d\"!\n", stderr); + usage(); + } + else + putenv(argv[i]); + break; + + case 'i' : /* Test every N seconds */ + i++; + + if (i >= argc) + { + fputs("ipptest: Missing seconds for \"-i\"!\n", stderr); + usage(); + } + else + interval = atoi(argv[i]); + break; + + case 'v' : /* Be verbose */ + Verbosity ++; + break; + + default : + fprintf(stderr, "ipptest: Unknown option \"-%c\"!\n", *opt); + usage(); + break; + } + } + } + else if (!strncmp(argv[i], "ipp://", 6) || + !strncmp(argv[i], "http://", 7) || + !strncmp(argv[i], "https://", 8)) + { + /* + * Set URI... + */ + + if (!testfile && uri) + { + fputs("ipptest: May only specify a single URI before a test!\n", + stderr); + usage(); + } + + uri = argv[i]; + testfile = NULL; + } + else + { + /* + * Run test... + */ + + testfile = argv[i]; + + if (!do_tests(uri, testfile)) + status ++; + } + } + + if (!uri || !testfile) + usage(); + + /* + * Loop if the interval is set... + */ + + if (interval) + { + for (;;) + { + sleep(interval); + do_tests(uri, testfile); + } + } + + /* + * Exit... + */ + + return (status); +} + + +/* + * 'do_tests()' - Do tests as specified in the test file. + */ + +static int /* 1 = success, 0 = failure */ +do_tests(const char *uri, /* I - URI to connect on */ + const char *testfile) /* I - Test file to use */ +{ + int i; /* Looping var */ + int linenum; /* Current line number */ + int version; /* IPP version number to use */ + http_t *http; /* HTTP connection to server */ + char scheme[HTTP_MAX_URI], /* URI scheme */ + userpass[HTTP_MAX_URI], /* username:password */ + server[HTTP_MAX_URI], /* Server */ + resource[HTTP_MAX_URI]; /* Resource path */ + int port; /* Port number */ + FILE *fp; /* Test file */ + char token[1024], /* Token from file */ + *tokenptr, /* Pointer into token */ + temp[1024], /* Temporary string */ + *tempptr; /* Pointer into temp string */ + ipp_t *request; /* IPP request */ + ipp_t *response; /* IPP response */ + ipp_op_t op; /* Operation */ + ipp_tag_t group; /* Current group */ + ipp_tag_t value; /* Current value type */ + ipp_attribute_t *attrptr, /* Attribute pointer */ + *found; /* Found attribute */ + char attr[128]; /* Attribute name */ + int num_statuses; /* Number of valid status codes */ + ipp_status_t statuses[100]; /* Valid status codes */ + int num_expects; /* Number of expected attributes */ + _cups_expect_t expects[100], /* Expected attributes */ + *expect, /* Current expected attribute */ + *last_expect; /* Last EXPECT (for predicates) */ + int num_displayed; /* Number of displayed attributes */ + char *displayed[100]; /* Displayed attributes */ + char name[1024]; /* Name of test */ + char filename[1024]; /* Filename */ + int pass; /* Did we pass the test? */ + int job_id; /* Job ID from last operation */ + int subscription_id; /* Subscription ID from last operation */ + + + /* + * Open the test file... + */ + + if ((fp = fopen(testfile, "r")) == NULL) + { + printf("Unable to open test file %s - %s\n", testfile, strerror(errno)); + return (0); + } + + /* + * Connect to the server... + */ + + httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme), userpass, + sizeof(userpass), server, sizeof(server), &port, resource, + sizeof(resource)); + if ((http = httpConnect(server, port)) == NULL) + { + printf("Unable to connect to %s on port %d - %s\n", server, port, + strerror(errno)); + fclose(fp); + return (0); + } + + /* + * Loop on tests... + */ + + printf("\"%s\":\n", testfile); + pass = 1; + job_id = 0; + subscription_id = 0; + version = 11; + linenum = 1; + + while (get_token(fp, token, sizeof(token), &linenum) != NULL) + { + /* + * Expect an open brace... + */ + + if (strcmp(token, "{")) + { + printf("Unexpected token %s seen on line %d - aborting test!\n", token, + linenum); + httpClose(http); + return (0); + } + + /* + * Initialize things... + */ + + httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme), userpass, + sizeof(userpass), server, sizeof(server), &port, resource, + sizeof(resource)); + + request = ippNew(); + op = (ipp_op_t)0; + group = IPP_TAG_ZERO; + num_statuses = 0; + num_expects = 0; + num_displayed = 0; + last_expect = NULL; + filename[0] = '\0'; + + strcpy(name, testfile); + if (strrchr(name, '.') != NULL) + *strrchr(name, '.') = '\0'; + + /* + * Parse until we see a close brace... + */ + + while (get_token(fp, token, sizeof(token), &linenum) != NULL) + { + if (strcasecmp(token, "EXPECT") && + strcasecmp(token, "IF-DEFINED") && + strcasecmp(token, "OF-TYPE") && + strcasecmp(token, "SAME-COUNT-AS")) + last_expect = NULL; + + if (!strcmp(token, "}")) + break; + else if (!strcasecmp(token, "NAME")) + { + /* + * Name of test... + */ + + get_token(fp, name, sizeof(name), &linenum); + } + else if (!strcasecmp(token, "VERSION")) + { + /* + * IPP version number for test... + */ + + int major, minor; /* Major/minor IPP version */ + + + get_token(fp, temp, sizeof(temp), &linenum); + if (sscanf(temp, "%d.%d", &major, &minor) == 2 && + major >= 0 && minor >= 0 && minor < 10) + version = major * 10 + minor; + else + { + printf("Bad version %s seen on line %d - aborting test!\n", token, + linenum); + httpClose(http); + ippDelete(request); + return (0); + } + } + else if (!strcasecmp(token, "RESOURCE")) + { + /* + * Resource name... + */ + + get_token(fp, resource, sizeof(resource), &linenum); + } + else if (!strcasecmp(token, "OPERATION")) + { + /* + * Operation... + */ + + get_token(fp, token, sizeof(token), &linenum); + op = ippOpValue(token); + } + else if (!strcasecmp(token, "GROUP")) + { + /* + * Attribute group... + */ + + get_token(fp, token, sizeof(token), &linenum); + value = ippTagValue(token); + + if (value == group) + ippAddSeparator(request); + + group = value; + } + else if (!strcasecmp(token, "DELAY")) + { + /* + * Delay before operation... + */ + + int delay; + + get_token(fp, token, sizeof(token), &linenum); + if ((delay = atoi(token)) > 0) + sleep(delay); + } + else if (!strcasecmp(token, "ATTR")) + { + /* + * Attribute... + */ + + get_token(fp, token, sizeof(token), &linenum); + value = ippTagValue(token); + get_token(fp, attr, sizeof(attr), &linenum); + get_token(fp, temp, sizeof(temp), &linenum); + + token[sizeof(token) - 1] = '\0'; + + for (tempptr = temp, tokenptr = token; + *tempptr && tokenptr < (token + sizeof(token) - 1);) + if (*tempptr == '$') + { + /* + * Substitute a string/number... + */ + + if (!strncasecmp(tempptr + 1, "uri", 3)) + { + strlcpy(tokenptr, uri, sizeof(token) - (tokenptr - token)); + tempptr += 4; + } + else if (!strncasecmp(tempptr + 1, "scheme", 6) || + !strncasecmp(tempptr + 1, "method", 6)) + { + strlcpy(tokenptr, scheme, sizeof(token) - (tokenptr - token)); + tempptr += 7; + } + else if (!strncasecmp(tempptr + 1, "username", 8)) + { + strlcpy(tokenptr, userpass, sizeof(token) - (tokenptr - token)); + tempptr += 9; + } + else if (!strncasecmp(tempptr + 1, "hostname", 8)) + { + strlcpy(tokenptr, server, sizeof(token) - (tokenptr - token)); + tempptr += 9; + } + else if (!strncasecmp(tempptr + 1, "port", 4)) + { + snprintf(tokenptr, sizeof(token) - (tokenptr - token), + "%d", port); + tempptr += 5; + } + else if (!strncasecmp(tempptr + 1, "resource", 8)) + { + strlcpy(tokenptr, resource, sizeof(token) - (tokenptr - token)); + tempptr += 9; + } + else if (!strncasecmp(tempptr + 1, "job-id", 6)) + { + snprintf(tokenptr, sizeof(token) - (tokenptr - token), + "%d", job_id); + tempptr += 7; + } + else if (!strncasecmp(tempptr + 1, "notify-subscription-id", 22)) + { + snprintf(tokenptr, sizeof(token) - (tokenptr - token), + "%d", subscription_id); + tempptr += 23; + } + else if (!strncasecmp(tempptr + 1, "user", 4)) + { + strlcpy(tokenptr, cupsUser(), sizeof(token) - (tokenptr - token)); + tempptr += 5; + } + else if (!strncasecmp(tempptr + 1, "ENV[", 4)) + { + char *end; /* End of $ENV[name] */ + + + if ((end = strchr(tempptr + 5, ']')) != NULL) + { + *end++ = '\0'; + strlcpy(tokenptr, + getenv(tempptr + 5) ? getenv(tempptr + 5) : tempptr + 5, + sizeof(token) - (tokenptr - token)); + tempptr = end; + } + else + { + *tokenptr++ = *tempptr++; + *tokenptr = '\0'; + } + } + else + { + *tokenptr++ = *tempptr++; + *tokenptr = '\0'; + } + + tokenptr += strlen(tokenptr); + } + else + { + *tokenptr++ = *tempptr++; + *tokenptr = '\0'; + } + + switch (value) + { + case IPP_TAG_BOOLEAN : + if (!strcasecmp(token, "true")) + ippAddBoolean(request, group, attr, 1); + else + ippAddBoolean(request, group, attr, atoi(token)); + break; + + case IPP_TAG_INTEGER : + case IPP_TAG_ENUM : + ippAddInteger(request, group, value, attr, atoi(token)); + break; + + case IPP_TAG_RESOLUTION : + puts(" ERROR: resolution tag not yet supported!"); + break; + + case IPP_TAG_RANGE : + puts(" ERROR: range tag not yet supported!"); + break; + + default : + if (!strchr(token, ',')) + ippAddString(request, group, value, attr, NULL, token); + else + { + /* + * Multiple string values... + */ + + int num_values; /* Number of values */ + char *values[100], /* Values */ + *ptr; /* Pointer to next value */ + + + values[0] = token; + num_values = 1; + + for (ptr = strchr(token, ','); ptr; ptr = strchr(ptr, ',')) + { + *ptr++ = '\0'; + values[num_values] = ptr; + num_values ++; + } + + ippAddStrings(request, group, value, attr, num_values, + NULL, (const char **)values); + } + break; + } + } + else if (!strcasecmp(token, "FILE")) + { + /* + * File... + */ + + get_token(fp, filename, sizeof(filename), &linenum); + } + else if (!strcasecmp(token, "STATUS") && + num_statuses < (int)(sizeof(statuses) / sizeof(statuses[0]))) + { + /* + * Status... + */ + + get_token(fp, token, sizeof(token), &linenum); + statuses[num_statuses] = ippErrorValue(token); + num_statuses ++; + } + else if (!strcasecmp(token, "EXPECT")) + { + /* + * Expected attributes... + */ + + if (num_expects >= (int)(sizeof(expects) / sizeof(expects[0]))) + { + fprintf(stderr, "ipptest: Too many EXPECT's on line %d\n", linenum); + httpClose(http); + ippDelete(request); + return (0); + } + + get_token(fp, token, sizeof(token), &linenum); + + last_expect = expects + num_expects; + num_expects ++; + + if (token[0] == '!') + { + last_expect->not_expect = 1; + last_expect->name = strdup(token + 1); + } + else + { + last_expect->not_expect = 0; + last_expect->name = strdup(token); + } + + last_expect->of_type = NULL; + last_expect->same_count_as = NULL; + last_expect->if_defined = NULL; + } + else if (!strcasecmp(token, "OF-TYPE")) + { + get_token(fp, token, sizeof(token), &linenum); + + if (last_expect) + last_expect->of_type = strdup(token); + else + { + fprintf(stderr, + "ipptest: OF-TYPE without a preceding EXPECT on line %d\n", + linenum); + httpClose(http); + ippDelete(request); + return (0); + } + } + else if (!strcasecmp(token, "SAME-COUNT-AS")) + { + get_token(fp, token, sizeof(token), &linenum); + + if (last_expect) + last_expect->same_count_as = strdup(token); + else + { + fprintf(stderr, + "ipptest: SAME-COUNT-AS without a preceding EXPECT on line " + "%d\n", linenum); + httpClose(http); + ippDelete(request); + return (0); + } + } + else if (!strcasecmp(token, "IF-DEFINED")) + { + get_token(fp, token, sizeof(token), &linenum); + + if (last_expect) + last_expect->if_defined = strdup(token); + else + { + fprintf(stderr, + "ipptest: IF-DEFINED without a preceding EXPECT on line %d\n", + linenum); + httpClose(http); + ippDelete(request); + return (0); + } + } + else if (!strcasecmp(token, "DISPLAY") && + num_displayed < (int)(sizeof(displayed) / sizeof(displayed[0]))) + { + /* + * Display attributes... + */ + + get_token(fp, token, sizeof(token), &linenum); + displayed[num_displayed] = strdup(token); + num_displayed ++; + } + else + { + fprintf(stderr, + "ipptest: Unexpected token %s seen on line %d - aborting " + "test!\n", token, linenum); + httpClose(http); + ippDelete(request); + return (0); + } + } + + /* + * Submit the IPP request... + */ + + request->request.op.version[0] = version / 10; + request->request.op.version[1] = version % 10; + request->request.op.operation_id = op; + request->request.op.request_id = 1; + + if (Verbosity) + { + printf(" %s:\n", ippOpString(op)); + + for (attrptr = request->attrs; attrptr; attrptr = attrptr->next) + print_attr(attrptr); + } + + printf(" %-60.60s [", name); + fflush(stdout); + + if (Chunking) + { + http_status_t status = cupsSendRequest(http, request, resource, 0); + + if (status == HTTP_CONTINUE && filename[0]) + { + int fd; /* File to send */ + char buffer[8192]; /* Copy buffer */ + ssize_t bytes; /* Bytes read/written */ + + + if ((fd = open(filename, O_RDONLY | O_BINARY)) >= 0) + { + while ((bytes = read(fd, buffer, sizeof(buffer))) > 0) + if ((status = cupsWriteRequestData(http, buffer, + bytes)) != HTTP_CONTINUE) + break; + } + else + status = HTTP_ERROR; + } + + ippDelete(request); + + if (status == HTTP_CONTINUE) + response = cupsGetResponse(http, resource); + else + response = NULL; + } + else if (filename[0]) + response = cupsDoFileRequest(http, request, resource, filename); + else + response = cupsDoIORequest(http, request, resource, -1, + Verbosity ? 1 : -1); + + if (response == NULL) + { + time_t curtime; + + curtime = time(NULL); + + puts("FAIL]"); + printf(" ERROR %04x (%s) @ %s\n", cupsLastError(), + cupsLastErrorString(), ctime(&curtime)); + pass = 0; + } + else + { + if (http->version != HTTP_1_1) + pass = 0; + + if ((attrptr = ippFindAttribute(response, "job-id", + IPP_TAG_INTEGER)) != NULL) + job_id = attrptr->values[0].integer; + + if ((attrptr = ippFindAttribute(response, "notify-subscription-id", + IPP_TAG_INTEGER)) != NULL) + subscription_id = attrptr->values[0].integer; + + for (i = 0; i < num_statuses; i ++) + if (response->request.status.status_code == statuses[i]) + break; + + if (i == num_statuses && num_statuses > 0) + pass = 0; + else + { + for (i = num_expects, expect = expects; i > 0; i --, expect ++) + { + if (expect->if_defined && !getenv(expect->if_defined)) + continue; + + found = ippFindAttribute(response, expect->name, IPP_TAG_ZERO); + + if ((found == NULL) != expect->not_expect || + (found && !expect_matches(expect, found->value_tag))) + { + pass = 0; + break; + } + + if (found && expect->same_count_as) + { + attrptr = ippFindAttribute(response, expect->same_count_as, + IPP_TAG_ZERO); + + if (!attrptr || attrptr->num_values != found->num_values) + { + pass = 0; + break; + } + } + } + } + + if (pass) + { + puts("PASS]"); + printf(" RECEIVED: %lu bytes in response\n", + (unsigned long)ippLength(response)); + + if (Verbosity) + { + for (attrptr = response->attrs; + attrptr != NULL; + attrptr = attrptr->next) + { + print_attr(attrptr); + } + } + else if (num_displayed > 0) + { + for (attrptr = response->attrs; + attrptr != NULL; + attrptr = attrptr->next) + { + if (attrptr->name) + { + for (i = 0; i < num_displayed; i ++) + { + if (!strcmp(displayed[i], attrptr->name)) + { + print_attr(attrptr); + break; + } + } + } + } + } + } + else + { + puts("FAIL]"); + printf(" RECEIVED: %lu bytes in response\n", + (unsigned long)ippLength(response)); + + if (http->version != HTTP_1_1) + printf(" BAD HTTP VERSION (%d.%d)\n", http->version / 100, + http->version % 100); + + for (i = 0; i < num_statuses; i ++) + if (response->request.status.status_code == statuses[i]) + break; + + if (i == num_statuses && num_statuses > 0) + puts(" BAD STATUS"); + + printf(" status-code = %04x (%s)\n", + cupsLastError(), ippErrorString(cupsLastError())); + + for (i = num_expects, expect = expects; i > 0; i --, expect ++) + { + if (expect->if_defined && !getenv(expect->if_defined)) + continue; + + found = ippFindAttribute(response, expect->name, IPP_TAG_ZERO); + + if ((found == NULL) != expect->not_expect) + { + if (expect->not_expect) + printf(" NOT EXPECTED: %s\n", expect->name); + else + printf(" EXPECTED: %s\n", expect->name); + } + else if (found) + { + if (!expect_matches(expect, found->value_tag)) + printf(" EXPECTED: %s of type %s but got %s\n", + expect->name, expect->of_type, + ippTagString(found->value_tag)); + else if (expect->same_count_as) + { + attrptr = ippFindAttribute(response, expect->same_count_as, + IPP_TAG_ZERO); + + if (!attrptr) + printf(" EXPECTED: %s (%d values) same count as %s " + "(not returned)\n", + expect->name, found->num_values, expect->same_count_as); + else if (attrptr->num_values != found->num_values) + printf(" EXPECTED: %s (%d values) same count as %s " + "(%d values)\n", + expect->name, found->num_values, expect->same_count_as, + attrptr->num_values); + } + } + } + + for (attrptr = response->attrs; attrptr != NULL; attrptr = attrptr->next) + print_attr(attrptr); + } + + ippDelete(response); + } + + for (i = num_expects, expect = expects; i > 0; i --, expect ++) + { + free(expect->name); + if (expect->of_type) + free(expect->of_type); + if (expect->same_count_as) + free(expect->same_count_as); + if (expect->if_defined) + free(expect->if_defined); + } + if (!pass) + break; + } + + fclose(fp); + httpClose(http); + + return (pass); +} + + +/* + * 'expect_matches()' - Return true if the tag matches the specification. + */ + +static int /* O - 1 if matches, 0 otherwise */ +expect_matches( + _cups_expect_t *expect, /* I - Expected attribute */ + ipp_tag_t value_tag) /* I - Value tag for attribute */ +{ + int match; /* Match? */ + char *of_type, /* Type name to match */ + *next; /* Next name to match */ + + + /* + * If we don't expect a particular type, return immediately... + */ + + if (!expect->of_type) + return (1); + + /* + * Parse the "of_type" value since the string can contain multiple attribute + * types separated by "|"... + */ + + for (of_type = expect->of_type, match = 0; !match && of_type; of_type = next) + { + /* + * Find the next separator, and set it (temporarily) to nul if present. + */ + + if ((next = strchr(of_type, '|')) != NULL) + *next = '\0'; + + /* + * Support some meta-types to make it easier to write the test file. + */ + + if (!strcmp(of_type, "text")) + match = value_tag == IPP_TAG_TEXTLANG || value_tag == IPP_TAG_TEXT; + else if (!strcmp(of_type, "name")) + match = value_tag == IPP_TAG_NAMELANG || value_tag == IPP_TAG_NAME; + else if (!strcmp(of_type, "collection")) + match = value_tag == IPP_TAG_BEGIN_COLLECTION; + else + match = value_tag == ippTagValue(of_type); + + /* + * Restore the separator if we have one... + */ + + if (next) + *next++ = '|'; + } + + return (match); +} + + +/* + * 'get_token()' - Get a token from a file. + */ + +static char * /* O - Token from file or NULL on EOF */ +get_token(FILE *fp, /* I - File to read from */ + char *buf, /* I - Buffer to read into */ + int buflen, /* I - Length of buffer */ + int *linenum) /* IO - Current line number */ +{ + int ch, /* Character from file */ + quote; /* Quoting character */ + char *bufptr, /* Pointer into buffer */ + *bufend; /* End of buffer */ + + + for (;;) + { + /* + * Skip whitespace... + */ + + while (isspace(ch = getc(fp))) + { + if (ch == '\n') + (*linenum) ++; + } + + /* + * Read a token... + */ + + if (ch == EOF) + return (NULL); + else if (ch == '\'' || ch == '\"') + { + /* + * Quoted text... + */ + + quote = ch; + bufptr = buf; + bufend = buf + buflen - 1; + + while ((ch = getc(fp)) != EOF) + if (ch == quote) + break; + else if (bufptr < bufend) + *bufptr++ = ch; + + *bufptr = '\0'; + return (buf); + } + else if (ch == '#') + { + /* + * Comment... + */ + + while ((ch = getc(fp)) != EOF) + if (ch == '\n') + break; + + (*linenum) ++; + } + else + { + /* + * Whitespace delimited text... + */ + + ungetc(ch, fp); + + bufptr = buf; + bufend = buf + buflen - 1; + + while ((ch = getc(fp)) != EOF) + if (isspace(ch) || ch == '#') + break; + else if (bufptr < bufend) + *bufptr++ = ch; + + if (ch == '#') + ungetc(ch, fp); + + *bufptr = '\0'; + return (buf); + } + } +} + + +/* + * 'print_attr()' - Print an attribute on the screen. + */ + +static void +print_attr(ipp_attribute_t *attr) /* I - Attribute to print */ +{ + int i; /* Looping var */ + + + if (attr->name == NULL) + { + puts(" -- separator --"); + return; + } + + printf(" %s (%s%s) = ", attr->name, + attr->num_values > 1 ? "1setOf " : "", + ippTagString(attr->value_tag)); + + switch (attr->value_tag) + { + case IPP_TAG_INTEGER : + case IPP_TAG_ENUM : + for (i = 0; i < attr->num_values; i ++) + printf("%d ", attr->values[i].integer); + break; + + case IPP_TAG_BOOLEAN : + for (i = 0; i < attr->num_values; i ++) + if (attr->values[i].boolean) + printf("true "); + else + printf("false "); + break; + + case IPP_TAG_NOVALUE : + printf("novalue"); + break; + + case IPP_TAG_RANGE : + for (i = 0; i < attr->num_values; i ++) + printf("%d-%d ", attr->values[i].range.lower, + attr->values[i].range.upper); + break; + + case IPP_TAG_RESOLUTION : + for (i = 0; i < attr->num_values; i ++) + printf("%dx%d%s ", attr->values[i].resolution.xres, + attr->values[i].resolution.yres, + attr->values[i].resolution.units == IPP_RES_PER_INCH ? + "dpi" : "dpc"); + break; + + case IPP_TAG_STRING : + case IPP_TAG_TEXT : + case IPP_TAG_NAME : + case IPP_TAG_KEYWORD : + case IPP_TAG_CHARSET : + case IPP_TAG_URI : + case IPP_TAG_MIMETYPE : + case IPP_TAG_LANGUAGE : + for (i = 0; i < attr->num_values; i ++) + printf("\"%s\" ", attr->values[i].string.text); + break; + + case IPP_TAG_TEXTLANG : + case IPP_TAG_NAMELANG : + for (i = 0; i < attr->num_values; i ++) + printf("\"%s\",%s ", attr->values[i].string.text, + attr->values[i].string.charset); + break; + + case IPP_TAG_BEGIN_COLLECTION : + for (i = 0; i < attr->num_values; i ++) + { + if (i) + putchar(' '); + + print_col(attr->values[i].collection); + } + break; + + default : + break; /* anti-compiler-warning-code */ + } + + putchar('\n'); +} + + +/* + * 'print_col()' - Print a collection attribute on the screen. + */ + +static void +print_col(ipp_t *col) /* I - Collection attribute to print */ +{ + int i; /* Looping var */ + ipp_attribute_t *attr; /* Current attribute in collection */ + + + putchar('{'); + for (attr = col->attrs; attr; attr = attr->next) + { + printf("%s(%s%s)=", attr->name, attr->num_values > 1 ? "1setOf " : "", + ippTagString(attr->value_tag)); + + switch (attr->value_tag) + { + case IPP_TAG_INTEGER : + case IPP_TAG_ENUM : + for (i = 0; i < attr->num_values; i ++) + printf("%d ", attr->values[i].integer); + break; + + case IPP_TAG_BOOLEAN : + for (i = 0; i < attr->num_values; i ++) + if (attr->values[i].boolean) + printf("true "); + else + printf("false "); + break; + + case IPP_TAG_NOVALUE : + printf("novalue"); + break; + + case IPP_TAG_RANGE : + for (i = 0; i < attr->num_values; i ++) + printf("%d-%d ", attr->values[i].range.lower, + attr->values[i].range.upper); + break; + + case IPP_TAG_RESOLUTION : + for (i = 0; i < attr->num_values; i ++) + printf("%dx%d%s ", attr->values[i].resolution.xres, + attr->values[i].resolution.yres, + attr->values[i].resolution.units == IPP_RES_PER_INCH ? + "dpi" : "dpc"); + break; + + case IPP_TAG_STRING : + case IPP_TAG_TEXT : + case IPP_TAG_NAME : + case IPP_TAG_KEYWORD : + case IPP_TAG_CHARSET : + case IPP_TAG_URI : + case IPP_TAG_MIMETYPE : + case IPP_TAG_LANGUAGE : + for (i = 0; i < attr->num_values; i ++) + printf("\"%s\" ", attr->values[i].string.text); + break; + + case IPP_TAG_TEXTLANG : + case IPP_TAG_NAMELANG : + for (i = 0; i < attr->num_values; i ++) + printf("\"%s\",%s ", attr->values[i].string.text, + attr->values[i].string.charset); + break; + + case IPP_TAG_BEGIN_COLLECTION : + for (i = 0; i < attr->num_values; i ++) + { + print_col(attr->values[i].collection); + putchar(' '); + } + break; + + default : + break; /* anti-compiler-warning-code */ + } + } + + putchar('}'); +} + + +/* + * 'usage()' - Show program usage. + */ + +static void +usage(void) +{ + fputs("Usage: ipptest [options] URL testfile [ ... testfileN ]\n", stderr); + fputs("Options:\n", stderr); + fputs("\n", stderr); + fputs("-c Send requests using chunking.\n", stderr); + fputs("-d name=value Define variable.\n", stderr); + fputs("-i seconds Repeat the last test file with the given interval.\n", + stderr); + fputs("-v Show all attributes in response, even on success.\n", + stderr); + + exit(1); +} + + +/* + * End of "$Id: ipptest.c 8929 2009-12-15 22:40:37Z mike $". + */ diff --git a/test/print-job-hold.test b/test/print-job-hold.test new file mode 100644 index 00000000..6bdaa838 --- /dev/null +++ b/test/print-job-hold.test @@ -0,0 +1,33 @@ +# Test print-job and job-hold-until attribute +{ + # The name of the test... + NAME "Print with print-job + job-hold-until" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION print-job + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + ATTR mimetype document-format application/postscript + ATTR keyword job-hold-until indefinite + + GROUP job + ATTR integer copies 1 + + FILE ../data/testprint.ps + + # What statuses are OK? + STATUS ok + STATUS ok-subst + + # What attributes do we expect? + EXPECT job-id + EXPECT job-uri +} diff --git a/test/print-job-media-col.test b/test/print-job-media-col.test new file mode 100644 index 00000000..373825ab --- /dev/null +++ b/test/print-job-media-col.test @@ -0,0 +1,39 @@ +# Print a test page using Print-Job + media-col +# +# Usage: +# +# ./ipptest -f filename ipp://... print-job-media-col.test +{ + # The name of the test... + NAME "Print test page using Print-Job + media-col" + + # The operation to use + OPERATION Print-Job + + # Attributes, starting in the operation group... + GROUP operation-attributes-tag + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + ATTR mimetype document-format application/octet-stream + + GROUP job-attributes-tag + ATTR collection media-col { + MEMBER collection media-size { + # 4x6 + MEMBER integer x-dimension 10160 + MEMBER integer y-dimension 15240 + } + } + + FILE $filename + + # What statuses are OK? + STATUS successful-ok + STATUS successful-ok-ignored-or-substituted-attributes + + # What attributes do we expect? + EXPECT job-id OF-TYPE integer WITH-VALUE >0 + EXPECT job-uri OF-TYPE uri +} diff --git a/test/print-job.test b/test/print-job.test new file mode 100644 index 00000000..a0c814e5 --- /dev/null +++ b/test/print-job.test @@ -0,0 +1,32 @@ +# Print a test page using print-job +{ + # The name of the test... + NAME "Print test page using print-job" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION print-job + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + ATTR mimetype document-format application/postscript + + GROUP job + ATTR integer copies 1 + + FILE testfile.ps + + # What statuses are OK? + STATUS successful-ok + STATUS successful-ok-ignored-or-substituted-attributes + + # What attributes do we expect? + EXPECT job-id + EXPECT job-uri +} diff --git a/test/run-stp-tests.sh b/test/run-stp-tests.sh new file mode 100755 index 00000000..5f5147a9 --- /dev/null +++ b/test/run-stp-tests.sh @@ -0,0 +1,856 @@ +#!/bin/sh +# +# "$Id: run-stp-tests.sh 9165 2010-06-17 18:20:39Z mike $" +# +# Perform the complete set of IPP compliance tests specified in the +# CUPS Software Test Plan. +# +# Copyright 2007-2010 by Apple Inc. +# Copyright 1997-2007 by Easy Software Products, all rights reserved. +# +# These coded instructions, statements, and computer programs are the +# property of Apple Inc. and are protected by Federal copyright +# law. Distribution and use rights are outlined in the file "LICENSE.txt" +# which should have been included with this file. If this file is +# file is missing or damaged, see the license at "http://www.cups.org/". +# + +argcount=$# + +# +# Make the IPP test program... +# + +make + +# +# Figure out the proper echo options... +# + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + ac_n=-n + ac_c= +else + ac_n= + ac_c='\c' +fi + +# +# Greet the tester... +# + +echo "Welcome to the CUPS Automated Test Script." +echo "" +echo "Before we begin, it is important that you understand that the larger" +echo "tests require significant amounts of RAM and disk space. If you" +echo "attempt to run one of the big tests on a system that lacks sufficient" +echo "disk and virtual memory, the UNIX kernel might decide to kill one or" +echo "more system processes that you've grown attached to, like the X" +echo "server. The question you may want to ask yourself before running a" +echo "large test is: Do you feel lucky?" +echo "" +echo "OK, now that we have the Dirty Harry quote out of the way, please" +echo "choose the type of test you wish to perform:" +echo "" +echo "0 - No testing, keep the scheduler running for me (all systems)" +echo "1 - Basic conformance test, no load testing (all systems)" +echo "2 - Basic conformance test, some load testing (minimum 256MB VM, 50MB disk)" +echo "3 - Basic conformance test, extreme load testing (minimum 1GB VM, 500MB disk)" +echo "4 - Basic conformance test, torture load testing (minimum 2GB VM, 1GB disk)" +echo "" +echo $ac_n "Enter the number of the test you wish to perform: [1] $ac_c" + +if test $# -gt 0; then + testtype=$1 + shift +else + read testtype +fi +echo "" + +case "$testtype" in + 0) + echo "Running in test mode (0)" + nprinters1=0 + nprinters2=0 + pjobs=0 + pprinters=0 + ;; + 2) + echo "Running the medium tests (2)" + nprinters1=10 + nprinters2=20 + pjobs=20 + pprinters=10 + ;; + 3) + echo "Running the extreme tests (3)" + nprinters1=500 + nprinters2=1000 + pjobs=100 + pprinters=50 + ;; + 4) + echo "Running the torture tests (4)" + nprinters1=10000 + nprinters2=20000 + pjobs=200 + pprinters=100 + ;; + *) + echo "Running the timid tests (1)" + nprinters1=0 + nprinters2=0 + pjobs=10 + pprinters=0 + ;; +esac + +# +# See if we want to do SSL testing... +# + +echo "" +echo "Now you can choose whether to create a SSL/TLS encryption key and" +echo "certificate for testing; these tests currently require the OpenSSL" +echo "tools:" +echo "" +echo "0 - Do not do SSL/TLS encryption tests" +echo "1 - Test but do not require encryption" +echo "2 - Test and require encryption" +echo "" +echo $ac_n "Enter the number of the SSL/TLS tests to perform: [0] $ac_c" + +if test $# -gt 0; then + ssltype=$1 + shift +else + read ssltype +fi +echo "" + +case "$ssltype" in + 1) + echo "Will test but not require encryption (1)" + ;; + 2) + echo "Will test and require encryption (2)" + ;; + *) + echo "Not using SSL/TLS (0)" + ssltype=0 + ;; +esac + +# +# Information for the server/tests... +# + +user="$USER" +if test -z "$user"; then + if test -x /usr/ucb/whoami; then + user=`/usr/ucb/whoami` + else + user=`whoami` + fi + + if test -z "$user"; then + user="unknown" + fi +fi + +port=8631 +cwd=`pwd` +root=`dirname $cwd` + +# +# Make sure that the LPDEST and PRINTER environment variables are +# not included in the environment that is passed to the tests. These +# will usually cause tests to fail erroneously... +# + +unset LPDEST +unset PRINTER + +# +# See if we want to use valgrind... +# + +echo "" +echo "This test script can use the Valgrind software from:" +echo "" +echo " http://developer.kde.org/~sewardj/" +echo "" +echo $ac_n "Enter Y to use Valgrind or N to not use Valgrind: [N] $ac_c" + +if test $# -gt 0; then + usevalgrind=$1 + shift +else + read usevalgrind +fi +echo "" + +case "$usevalgrind" in + Y* | y*) + valgrind="valgrind --tool=memcheck --log-file=/tmp/cups-$user/log/valgrind.%p --error-limit=no --leak-check=yes --trace-children=yes --read-var-info=yes" + echo "Using Valgrind; log files can be found in /tmp/cups-$user/log..." + ;; + + *) + valgrind="" + ;; +esac + +# +# Start by creating temporary directories for the tests... +# + +echo "Creating directories for test..." + +rm -rf /tmp/cups-$user +mkdir /tmp/cups-$user +mkdir /tmp/cups-$user/bin +mkdir /tmp/cups-$user/bin/backend +mkdir /tmp/cups-$user/bin/driver +mkdir /tmp/cups-$user/bin/filter +mkdir /tmp/cups-$user/certs +mkdir /tmp/cups-$user/share +mkdir /tmp/cups-$user/share/banners +mkdir /tmp/cups-$user/share/drv +mkdir /tmp/cups-$user/share/locale +for file in ../locale/cups_*.po; do + loc=`basename $file .po | cut -c 6-` + mkdir /tmp/cups-$user/share/locale/$loc + ln -s $root/locale/cups_$loc.po /tmp/cups-$user/share/locale/$loc + ln -s $root/locale/ppdc_$loc.po /tmp/cups-$user/share/locale/$loc +done +mkdir /tmp/cups-$user/share/mime +mkdir /tmp/cups-$user/share/model +mkdir /tmp/cups-$user/share/ppdc +mkdir /tmp/cups-$user/interfaces +mkdir /tmp/cups-$user/log +mkdir /tmp/cups-$user/ppd +mkdir /tmp/cups-$user/spool +mkdir /tmp/cups-$user/spool/temp +mkdir /tmp/cups-$user/ssl + +ln -s $root/backend/dnssd /tmp/cups-$user/bin/backend +ln -s $root/backend/http /tmp/cups-$user/bin/backend +ln -s $root/backend/ipp /tmp/cups-$user/bin/backend +ln -s $root/backend/lpd /tmp/cups-$user/bin/backend +ln -s $root/backend/mdns /tmp/cups-$user/bin/backend +ln -s $root/backend/parallel /tmp/cups-$user/bin/backend +ln -s $root/backend/serial /tmp/cups-$user/bin/backend +ln -s $root/backend/snmp /tmp/cups-$user/bin/backend +ln -s $root/backend/socket /tmp/cups-$user/bin/backend +ln -s $root/backend/usb /tmp/cups-$user/bin/backend +ln -s $root/cgi-bin /tmp/cups-$user/bin +ln -s $root/monitor /tmp/cups-$user/bin +ln -s $root/notifier /tmp/cups-$user/bin +ln -s $root/scheduler /tmp/cups-$user/bin/daemon +ln -s $root/filter/bannertops /tmp/cups-$user/bin/filter +ln -s $root/filter/commandtops /tmp/cups-$user/bin/filter +ln -s $root/filter/gziptoany /tmp/cups-$user/bin/filter +ln -s $root/filter/hpgltops /tmp/cups-$user/bin/filter +ln -s $root/filter/pstops /tmp/cups-$user/bin/filter +ln -s $root/filter/rastertoepson /tmp/cups-$user/bin/filter +ln -s $root/filter/rastertohp /tmp/cups-$user/bin/filter +ln -s $root/filter/texttops /tmp/cups-$user/bin/filter + +ln -s $root/data/classified /tmp/cups-$user/share/banners +ln -s $root/data/confidential /tmp/cups-$user/share/banners +ln -s $root/data/secret /tmp/cups-$user/share/banners +ln -s $root/data/standard /tmp/cups-$user/share/banners +ln -s $root/data/topsecret /tmp/cups-$user/share/banners +ln -s $root/data/unclassified /tmp/cups-$user/share/banners +ln -s $root/data /tmp/cups-$user/share/charmaps +ln -s $root/data /tmp/cups-$user/share/charsets +ln -s $root/data /tmp/cups-$user/share +ln -s $root/fonts /tmp/cups-$user/share +ln -s $root/ppdc/sample.drv /tmp/cups-$user/share/drv +ln -s $root/conf/mime.types /tmp/cups-$user/share/mime +ln -s $root/conf/mime.convs /tmp/cups-$user/share/mime +ln -s $root/data/*.h /tmp/cups-$user/share/ppdc +ln -s $root/data/*.defs /tmp/cups-$user/share/ppdc +ln -s $root/templates /tmp/cups-$user/share + +# +# Mac OS X filters and configuration files... +# + +if test `uname` = Darwin; then + ln -s /usr/libexec/cups/filter/cgpdfto* /tmp/cups-$user/bin/filter + ln -s /usr/libexec/cups/filter/cgbannertopdf /tmp/cups-$user/bin/filter + ln -s /usr/libexec/cups/filter/cgimagetopdf /tmp/cups-$user/bin/filter + ln -s /usr/libexec/cups/filter/cgtexttopdf /tmp/cups-$user/bin/filter + ln -s /usr/libexec/cups/filter/nsimagetopdf /tmp/cups-$user/bin/filter + ln -s /usr/libexec/cups/filter/nstexttopdf /tmp/cups-$user/bin/filter + ln -s /usr/libexec/cups/filter/pictwpstops /tmp/cups-$user/bin/filter + ln -s /usr/libexec/cups/filter/pstoappleps /tmp/cups-$user/bin/filter + ln -s /usr/libexec/cups/filter/pstocupsraster /tmp/cups-$user/bin/filter + ln -s /usr/libexec/cups/filter/pstopdffilter /tmp/cups-$user/bin/filter + + if test -f /private/etc/cups/apple.types; then + ln -s /private/etc/cups/apple.* /tmp/cups-$user/share/mime + elif test -f /usr/share/cups/mime/apple.types; then + ln -s /usr/share/cups/mime/apple.* /tmp/cups-$user/share/mime + fi +else + ln -s $root/filter/imagetops /tmp/cups-$user/bin/filter + ln -s $root/filter/imagetoraster /tmp/cups-$user/bin/filter + ln -s $root/filter/pdftops /tmp/cups-$user/bin/filter +fi + +# +# Then create the necessary config files... +# + +echo "Creating cupsd.conf for test..." + +if test $ssltype = 2; then + encryption="Encryption Required" +else + encryption="" +fi + +cat >/tmp/cups-$user/cupsd.conf <<EOF +Browsing Off +FileDevice yes +Printcap +Listen 127.0.0.1:$port +User $user +ServerRoot /tmp/cups-$user +StateDir /tmp/cups-$user +ServerBin /tmp/cups-$user/bin +CacheDir /tmp/cups-$user/share +DataDir /tmp/cups-$user/share +FontPath /tmp/cups-$user/share/fonts +PassEnv LOCALEDIR +DocumentRoot $root/doc +RequestRoot /tmp/cups-$user/spool +TempDir /tmp/cups-$user/spool/temp +MaxSubscriptions 3 +MaxLogSize 0 +AccessLog /tmp/cups-$user/log/access_log +ErrorLog /tmp/cups-$user/log/error_log +PageLog /tmp/cups-$user/log/page_log +AccessLogLevel actions +LogLevel debug2 +LogTimeFormat usecs +PreserveJobHistory Yes +<Policy default> +<Limit All> +Order Deny,Allow +Deny from all +Allow from 127.0.0.1 +$encryption +</Limit> +</Policy> +EOF + +# +# Setup lots of test queues - half with PPD files, half without... +# + +echo "Creating printers.conf for test..." + +i=1 +while test $i -le $nprinters1; do + cat >>/tmp/cups-$user/printers.conf <<EOF +<Printer test-$i> +Accepting Yes +DeviceURI file:/dev/null +Info Test PS printer $i +JobSheets none none +Location CUPS test suite +State Idle +StateMessage Printer $1 is idle. +</Printer> +EOF + + cp testps.ppd /tmp/cups-$user/ppd/test-$i.ppd + + i=`expr $i + 1` +done + +while test $i -le $nprinters2; do + cat >>/tmp/cups-$user/printers.conf <<EOF +<Printer test-$i> +Accepting Yes +DeviceURI file:/dev/null +Info Test raw printer $i +JobSheets none none +Location CUPS test suite +State Idle +StateMessage Printer $1 is idle. +</Printer> +EOF + + i=`expr $i + 1` +done + +if test -f /tmp/cups-$user/printers.conf; then + cp /tmp/cups-$user/printers.conf /tmp/cups-$user/printers.conf.orig +else + touch /tmp/cups-$user/printers.conf.orig +fi + +# +# Setup the paths... +# + +echo "Setting up environment variables for test..." + +if test "x$LD_LIBRARY_PATH" = x; then + LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc" +else + LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$LD_LIBRARY_PATH" +fi + +export LD_LIBRARY_PATH + +LD_PRELOAD="$root/cups/libcups.so.2:$root/filter/libcupsimage.so.2:$root/cgi-bin/libcupscgi.so.1:$root/scheduler/libcupsmime.so.1:$root/driver/libcupsdriver.so.1:$root/ppdc/libcupsppdc.so.1" +if test `uname` = SunOS -a -r /usr/lib/libCrun.so.1; then + LD_PRELOAD="/usr/lib/libCrun.so.1:$LD_PRELOAD" +fi +export LD_PRELOAD + +if test "x$DYLD_LIBRARY_PATH" = x; then + DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc" +else + DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$DYLD_LIBRARY_PATH" +fi + +export DYLD_LIBRARY_PATH + +if test "x$SHLIB_PATH" = x; then + SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc" +else + SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$SHLIB_PATH" +fi + +export SHLIB_PATH + +CUPS_DISABLE_APPLE_DEFAULT=yes; export CUPS_DISABLE_APPLE_DEFAULT +CUPS_SERVER=localhost:8631; export CUPS_SERVER +CUPS_SERVERROOT=/tmp/cups-$user; export CUPS_SERVERROOT +CUPS_STATEDIR=/tmp/cups-$user; export CUPS_STATEDIR +CUPS_DATADIR=/tmp/cups-$user/share; export CUPS_DATADIR +LOCALEDIR=/tmp/cups-$user/share/locale; export LOCALEDIR + +# +# Set a new home directory to avoid getting user options mixed in... +# + +HOME=/tmp/cups-$user +export HOME + +# +# Force POSIX locale for tests... +# + +LANG=C +export LANG + +# +# Start the server; run as foreground daemon in the background... +# + +echo "Starting scheduler:" +echo " $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &" +echo "" + +if test `uname` = Darwin -a "x$valgrind" = x; then + DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib \ + $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 & +else + $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 & +fi + +cupsd=$! + +if test "x$testtype" = x0; then + # Not running tests... + echo "Scheduler is PID $cupsd and is listening on port 8631." + echo "" + + # Create a helper script to run programs with... + runcups="/tmp/cups-$user/runcups" + + echo "#!/bin/sh" >$runcups + echo "# Helper script for running CUPS test instance." >>$runcups + echo "" >>$runcups + echo "# Set required environment variables..." >>$runcups + echo "CUPS_DATADIR=\"$CUPS_DATADIR\"; export CUPS_DATADIR" >>$runcups + echo "CUPS_SERVER=\"$CUPS_SERVER\"; export CUPS_SERVER" >>$runcups + echo "CUPS_SERVERROOT=\"$CUPS_SERVERROOT\"; export CUPS_SERVERROOT" >>$runcups + echo "CUPS_STATEDIR=\"$CUPS_STATEDIR\"; export CUPS_STATEDIR" >>$runcups + echo "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"; export DYLD_LIBRARY_PATH" >>$runcups + echo "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"; export LD_LIBRARY_PATH" >>$runcups + echo "LD_PRELOAD=\"$LD_PRELOAD\"; export LD_PRELOAD" >>$runcups + echo "LOCALEDIR=\"$LOCALEDIR\"; export LOCALEDIR" >>$runcups + echo "SHLIB_PATH=\"$SHLIB_PATH\"; export SHLIB_PATH" >>$runcups + echo "" >>$runcups + echo "# Run command..." >>$runcups + echo "exec \"\$@\"" >>$runcups + + chmod +x $runcups + + echo "The $runcups helper script can be used to test programs" + echo "with the server." + exit 0 +fi + +if test $argcount -eq 0; then + echo "Scheduler is PID $cupsd; run debugger now if you need to." + echo "" + echo $ac_n "Press ENTER to continue... $ac_c" + read junk +else + echo "Scheduler is PID $cupsd." + sleep 2 +fi + +IPP_PORT=$port; export IPP_PORT + +while true; do + running=`../systemv/lpstat -r 2>/dev/null` + if test "x$running" = "xscheduler is running"; then + break + fi + + echo "Waiting for scheduler to become ready..." + sleep 10 +done + +# +# Create the test report source file... +# + +date=`date "+%Y-%m-%d"` +strfile=/tmp/cups-$user/cups-str-1.4-$date-$user.html + +rm -f $strfile +cat str-header.html >$strfile + +# +# Run the IPP tests... +# + +echo "" +echo "Running IPP compliance tests..." + +echo "<H1>1 - IPP Compliance Tests</H1>" >>$strfile +echo "<P>This section provides the results to the IPP compliance tests" >>$strfile +echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile +echo `date "+%Y-%m-%d"` by $user on `hostname`. >>$strfile +echo "<PRE>" >>$strfile + +fail=0 +for file in 4*.test; do + echo "Performing $file..." + echo "" >>$strfile + + ./ipptest ipp://localhost:$port/printers $file | tee -a $strfile + status=$? + + if test $status != 0; then + echo Test failed. + fail=`expr $fail + 1` + fi +done + +echo "</PRE>" >>$strfile + +# +# Run the command tests... +# + +echo "" +echo "Running command tests..." + +echo "<H1>2 - Command Tests</H1>" >>$strfile +echo "<P>This section provides the results to the command tests" >>$strfile +echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile +echo $date by $user on `hostname`. >>$strfile +echo "<PRE>" >>$strfile + +for file in 5*.sh; do + echo "Performing $file..." + echo "" >>$strfile + echo "\"$file\":" >>$strfile + + sh $file $pjobs $pprinters | tee -a $strfile + status=$? + + if test $status != 0; then + echo Test failed. + fail=`expr $fail + 1` + fi +done + +echo "</PRE>" >>$strfile + +# +# Stop the server... +# + +kill $cupsd + +# +# Append the log files for post-mortim... +# + +echo "<H1>3 - Log Files</H1>" >>$strfile + +# +# Verify counts... +# + +echo "Test Summary" +echo "" +echo "<H2>Summary</H2>" >>$strfile + +# Job control files +count=`ls -1 /tmp/cups-$user/spool | wc -l` +count=`expr $count - 1` +if test $count != 0; then + echo "FAIL: $count job control files were not purged." + echo "<P>FAIL: $count job control files were not purged.</P>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: All job control files purged." + echo "<P>PASS: All job control files purged.</P>" >>$strfile +fi + +# Pages printed on Test1 (within 1 page for timing-dependent cancel issues) +count=`grep '^Test1 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` +expected=`expr $pjobs \* 2 + 34` +expected2=`expr $expected + 2` +if test $count -lt $expected -a $count -gt $expected2; then + echo "FAIL: Printer 'Test1' produced $count page(s), expected $expected." + echo "<P>FAIL: Printer 'Test1' produced $count page(s), expected $expected.</P>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: Printer 'Test1' correctly produced $count page(s)." + echo "<P>PASS: Printer 'Test1' correctly produced $count page(s).</P>" >>$strfile +fi + +# Paged printed on Test2 +count=`grep '^Test2 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` +expected=`expr $pjobs \* 2 + 3` +if test $count != $expected; then + echo "FAIL: Printer 'Test2' produced $count page(s), expected $expected." + echo "<P>FAIL: Printer 'Test2' produced $count page(s), expected $expected.</P>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: Printer 'Test2' correctly produced $count page(s)." + echo "<P>PASS: Printer 'Test2' correctly produced $count page(s).</P>" >>$strfile +fi + +# Requests logged +count=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'` +expected=`expr 39 + 18 + $pjobs \* 8 + $pprinters \* $pjobs \* 4` +if test $count != $expected; then + echo "FAIL: $count requests logged, expected $expected." + echo "<P>FAIL: $count requests logged, expected $expected.</P>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: $count requests logged." + echo "<P>PASS: $count requests logged.</P>" >>$strfile +fi + +# Did CUPS-Get-Default get logged? +if grep -q CUPS-Get-Default /tmp/cups-$user/log/access_log; then + echo "FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'" + echo "<P>FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'</P>" >>$strfile + echo "<PRE>" >>$strfile + grep CUPS-Get-Default /tmp/cups-$user/log/access_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile + echo "</PRE>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: CUPS-Get-Default not logged." + echo "<P>PASS: CUPS-Get-Default not logged.</P>" >>$strfile +fi + +# Emergency log messages +count=`grep '^X ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +if test $count != 0; then + echo "FAIL: $count emergency messages, expected 0." + grep '^X ' /tmp/cups-$user/log/error_log + echo "<P>FAIL: $count emergency messages, expected 0.</P>" >>$strfile + echo "<PRE>" >>$strfile + grep '^X ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile + echo "</PRE>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: $count emergency messages." + echo "<P>PASS: $count emergency messages.</P>" >>$strfile +fi + +# Alert log messages +count=`grep '^A ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +if test $count != 0; then + echo "FAIL: $count alert messages, expected 0." + grep '^A ' /tmp/cups-$user/log/error_log + echo "<P>FAIL: $count alert messages, expected 0.</P>" >>$strfile + echo "<PRE>" >>$strfile + grep '^A ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile + echo "</PRE>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: $count alert messages." + echo "<P>PASS: $count alert messages.</P>" >>$strfile +fi + +# Critical log messages +count=`grep '^C ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +if test $count != 0; then + echo "FAIL: $count critical messages, expected 0." + grep '^C ' /tmp/cups-$user/log/error_log + echo "<P>FAIL: $count critical messages, expected 0.</P>" >>$strfile + echo "<PRE>" >>$strfile + grep '^C ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile + echo "</PRE>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: $count critical messages." + echo "<P>PASS: $count critical messages.</P>" >>$strfile +fi + +# Error log messages +count=`grep '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +if test $count != 18; then + echo "FAIL: $count error messages, expected 18." + grep '^E ' /tmp/cups-$user/log/error_log + echo "<P>FAIL: $count error messages, expected 18.</P>" >>$strfile + echo "<PRE>" >>$strfile + grep '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile + echo "</PRE>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: $count error messages." + echo "<P>PASS: $count error messages.</P>" >>$strfile +fi + +# Warning log messages +count=`grep '^W ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +if test $count != 0; then + echo "FAIL: $count warning messages, expected 0." + grep '^W ' /tmp/cups-$user/log/error_log + echo "<P>FAIL: $count warning messages, expected 0.</P>" >>$strfile + echo "<PRE>" >>$strfile + grep '^W ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile + echo "</PRE>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: $count warning messages." + echo "<P>PASS: $count warning messages.</P>" >>$strfile +fi + +# Notice log messages +count=`grep '^N ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +if test $count != 0; then + echo "FAIL: $count notice messages, expected 0." + grep '^N ' /tmp/cups-$user/log/error_log + echo "<P>FAIL: $count notice messages, expected 0.</P>" >>$strfile + echo "<PRE>" >>$strfile + grep '^N ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile + echo "</PRE>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: $count notice messages." + echo "<P>PASS: $count notice messages.</P>" >>$strfile +fi + +# Info log messages +count=`grep '^I ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +if test $count = 0; then + echo "FAIL: $count info messages, expected more than 0." + echo "<P>FAIL: $count info messages, expected more than 0.</P>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: $count info messages." + echo "<P>PASS: $count info messages.</P>" >>$strfile +fi + +# Debug log messages +count=`grep '^D ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +if test $count = 0; then + echo "FAIL: $count debug messages, expected more than 0." + echo "<P>FAIL: $count debug messages, expected more than 0.</P>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: $count debug messages." + echo "<P>PASS: $count debug messages.</P>" >>$strfile +fi + +# Debug2 log messages +count=`grep '^d ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +if test $count = 0; then + echo "FAIL: $count debug2 messages, expected more than 0." + echo "<P>FAIL: $count debug2 messages, expected more than 0.</P>" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: $count debug2 messages." + echo "<P>PASS: $count debug2 messages.</P>" >>$strfile +fi + +# Page log file... +if grep -iq 'testfile.pdf na_letter_8.5x11in' /tmp/cups-$user/log/page_log; then + echo "PASS: page_log formatted correctly." + echo "<P>PASS: page_log formatted correctly.</P>" >>$strfile +else + echo "WARN: page_log formatted incorrectly." + echo "<P>WARN: page_log formatted incorrectly.</P>" >>$strfile +# fail=`expr $fail + 1` +fi + +# Log files... +echo "<H2>access_log</H2>" >>$strfile +echo "<PRE>" >>$strfile +sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp/cups-$user/log/access_log >>$strfile +echo "</PRE>" >>$strfile + +echo "<H2>error_log</H2>" >>$strfile +echo "<PRE>" >>$strfile +grep -v '^d' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile +echo "</PRE>" >>$strfile + +echo "<H2>page_log</H2>" >>$strfile +echo "<PRE>" >>$strfile +sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp/cups-$user/log/page_log >>$strfile +echo "</PRE>" >>$strfile + +# +# Format the reports and tell the user where to find them... +# + +cat str-trailer.html >>$strfile + +echo "" + +if test $fail != 0; then + echo "$fail tests failed." + cp /tmp/cups-$user/log/error_log error_log-$date-$user + cp $strfile . +else + echo "All tests were successful." +fi + +echo "Log files can be found in /tmp/cups-$user/log." +echo "A HTML report was created in $strfile." +echo "" + +if test $fail != 0; then + echo "Copies of the error_log and `basename $strfile` files are in" + echo "`pwd`." + echo "" + + exit 1 +fi + +# +# End of "$Id: run-stp-tests.sh 9165 2010-06-17 18:20:39Z mike $" +# diff --git a/test/set-attrs-hold.test b/test/set-attrs-hold.test new file mode 100644 index 00000000..377819ae --- /dev/null +++ b/test/set-attrs-hold.test @@ -0,0 +1,180 @@ +# Test print-job and later job-hold-until attribute +{ + # The name of the test... + NAME "Disable printer..." + + # The resource to use for the POST + RESOURCE /admin/ + + # The operation to use + OPERATION pause-printer + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + + # What statuses are OK? + STATUS ok + STATUS ok-subst +} + +{ + # The name of the test... + NAME "Print job" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION print-job + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + ATTR mimetype document-format application/postscript + + GROUP job + ATTR integer copies 1 + + FILE ../data/testprint.ps + + # What statuses are OK? + STATUS ok + STATUS ok-subst + + # What attributes do we expect? + EXPECT job-id + EXPECT job-uri +} + +{ + # The name of the test... + NAME "Get job attrs" + + # The resource to use for the POST + RESOURCE / + + # The operation to use + OPERATION get-job-attributes + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR integer job-id $job-id + + # What statuses are OK? + STATUS ok + STATUS ok-subst + + # What attributes do we expect? + EXPECT job-state + EXPECT job-hold-until +} + +{ + # The name of the test... + NAME "Set job attrs with job-hold-until" + + # The resource to use for the POST + # RESOURCE /admin + + # The operation to use + OPERATION set-job-attributes + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR integer job-id $job-id + ATTR name requesting-user-name $user + + GROUP job + ATTR name job-hold-until 00:30:00 + + # What statuses are OK? + STATUS ok + STATUS ok-subst +} + +{ + # The name of the test... + NAME "Get job attrs again" + + # The resource to use for the POST + RESOURCE / + + # The operation to use + OPERATION get-job-attributes + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR integer job-id $job-id + + # What statuses are OK? + STATUS ok + STATUS ok-subst + + # What attributes do we expect? + EXPECT job-state + EXPECT job-hold-until +} + +{ + # The name of the test... + NAME "Enable printer..." + + # The resource to use for the POST + RESOURCE /admin/ + + # The operation to use + OPERATION resume-printer + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR name requesting-user-name $user + + # What statuses are OK? + STATUS ok + STATUS ok-subst +} + +{ + # The name of the test... + NAME "Get job attrs (last time)" + + # The resource to use for the POST + RESOURCE / + + # The operation to use + OPERATION get-job-attributes + + # Attributes, starting in the operation group... + GROUP operation + ATTR charset attributes-charset utf-8 + ATTR language attributes-natural-language en + ATTR uri printer-uri $uri + ATTR integer job-id $job-id + + # What statuses are OK? + STATUS ok + STATUS ok-subst + + # What attributes do we expect? + EXPECT job-state + EXPECT job-hold-until +} diff --git a/test/str-header.html b/test/str-header.html new file mode 100644 index 00000000..ff53adb8 --- /dev/null +++ b/test/str-header.html @@ -0,0 +1,31 @@ +<HTML> +<HEAD> + <META NAME="Description" CONTENT="CUPS Test Report"> + <META NAME="COPYRIGHT" CONTENT="Copyright 2007-2010, All Rights Reserved"> + <META NAME="DOCNUMBER" CONTENT="CUPS-STR-1.4"> + <META NAME="Author" CONTENT="Apple Inc."> + <TITLE>CUPS 1.4 Software Test Report</TITLE> + <STYLE TYPE="text/css"><!-- + PRE { + font-size: 80%; + margin-left: 2em; + } + --></STYLE> +</HEAD> +<BODY> + +<H1>CUPS 1.4 Software Test Report</H1> + +<P>This software test report provides detailed test results that +are used to evaluate the stability and compliance of the Common +UNIX Printing System ("CUPS") Version 1.4. + +<H2>Document Overview</H2> + +<P>This software test plan is organized into the following sections: + +<UL> + <LI>1 - IPP Compliance Tests</LI> + <LI>2 - Command Tests</LI> + <LI>3 - Log Files</LI> +</UL> diff --git a/test/str-trailer.html b/test/str-trailer.html new file mode 100644 index 00000000..e04310fd --- /dev/null +++ b/test/str-trailer.html @@ -0,0 +1,2 @@ +</BODY> +</HTML> diff --git a/test/testfile.jpg b/test/testfile.jpg Binary files differnew file mode 100644 index 00000000..418cb935 --- /dev/null +++ b/test/testfile.jpg diff --git a/test/testfile.pdf b/test/testfile.pdf Binary files differnew file mode 100644 index 00000000..43357717 --- /dev/null +++ b/test/testfile.pdf diff --git a/test/testfile.ps b/test/testfile.ps new file mode 100644 index 00000000..bce9c917 --- /dev/null +++ b/test/testfile.ps @@ -0,0 +1,598 @@ +%!PS-Adobe-3.0 +%%BoundingBox: 0 0 612 792 +%%Pages: 1 +%%LanguageLevel: 1 +%%DocumentData: Clean7Bit +%%DocumentSuppliedResources: procset testprint/1.3 +%%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman +%%Creator: Michael Sweet, Apple Inc. +%%CreationDate: D:20070606214000+0500 +%%Title: Test Page +%%EndComments +%%BeginProlog +%%BeginResource procset testprint 1.3 0 +% +% PostScript test page for the Common UNIX Printing System ("CUPS"). +% +% Copyright 2007 Apple Inc. +% Copyright 1993-2007 Easy Software Products +% +% These coded instructions, statements, and computer programs are the +% property of Apple Inc. and are protected by Federal copyright law. +% Distribution and use rights are outlined in the file "LICENSE.txt" +% which is included with the CUPS source distribution. +% +/SEXTANT { % Draw a color wheel sextant... + % (name) white radius r g b SEXTANT - + % Loop through 100 shades... + 0 0.010101 0.98 { + % Set the color... + dup 0.75 le { % Get "white" value + % Start from black + dup 0.75 div % val2 = val / 0.75 + + 0 index 5 index mul % R = R * val2 + 1 index 5 index mul % G = G * val2 + 2 index 5 index mul % B = B * val2 + + 4 -1 roll pop % Discard val2 + } { + % Fade to white + dup neg 1 add 4 mul % val2 = (1 - val) * 4 + + 0 index 5 index mul % R = R * val2 + 1 index neg 1 add add % + (1 - val2) + 1 index 5 index mul % G = G * val2 + 2 index neg 1 add add % + (1 - val2) + 2 index 5 index mul % B = B * val2 + 3 index neg 1 add add % + (1 - val2) + + 4 -1 roll pop % Discard val2 + } ifelse + setrgbcolor % Set the color... + + % Draw the polygon... + newpath % Start a new path... + dup 5 index mul % r1 = radius * val + 0 0 3 -1 roll 0 60 arc % Draw the inner arc + + dup 0.010101 add 5 index mul% r2 = (radius + 0.010101) * val + 0 0 3 -1 roll 60 0 arcn % Draw the outer arc + + closepath % Close the path + fill % Fill it... + + pop % Pop value... + } for + + % Draw a line around the polygons... + pop pop pop dup % Pop R, G, B, start + 0 setgray % Black + newpath + 0 0 moveto % Center + 0 0 3 -1 roll 0 60 arc % Arc around octant + closepath % Back to center + stroke % Stroke it... + + % Draw the label... + dup % Save radius + dup 30 cos mul % X = radius * cos(30) + exch 30 sin mul % Y = radius * sin(30) + moveto % Position label + + gsave + 30 rotate % Rotate label + dup 0.05 mul % Offset to the right + exch -0.05 mul % and down... + rmoveto % Offset label + show % Show label + grestore +} bind def +/CENTER { % Draw centered text + % (name) CENTER - + dup stringwidth pop % Get the width of the string + 0.5 mul neg 0 rmoveto % Shift left 1/2 of the distance + show % Show the string +} bind def +/RIGHT { % Draw right-justified text + % (name) RIGHT - + dup stringwidth pop % Get the width of the string + neg 0 rmoveto % Shift left the entire distance + show % Show the string +} bind def +/NUMBER { % Draw a number + % power n NUMBER - + 1 index 1 eq { % power == 1? + round cvi exch pop % Convert "n" to integer + } { + 1 index mul round exch div % Truncate extra decimal places + } ifelse + 100 string cvs show % Convert to a string and show it... +} bind def +/CUPSLOGO { % Draw the CUPS logo + % height CUPSLOGO + % Start with a big C... + /Helvetica findfont 1 index scalefont setfont + 0 setgray + 0 0 moveto + (C) show + + % Then "UNIX Printing System" much smaller... + /Helvetica-Bold findfont 1 index 9 div scalefont setfont + 0.25 mul + dup dup 2.0 mul moveto + (UNIX) show + dup dup 1.6 mul moveto + (Printing) show + dup 1.2 mul moveto + (System) show +} bind def +%%EndResource +%%EndProlog +%%Page: 1 1 +gsave + + % Determine the imageable area and device resolution... + initclip newpath clippath pathbbox % Get bounding rectangle + 72 div /pageTop exch def % Get top margin in inches + 72 div /pageRight exch def % Get right margin in inches + 72 div /pageBottom exch def % Get bottom margin in inches + 72 div /pageLeft exch def % Get left margin in inches + + 4 setlinewidth % Draw wide lines + 0 setgray closepath stroke % Draw a clipping rectangle + + /pageWidth pageRight pageLeft sub def % pageWidth = pageRight - pageLeft + /pageHeight pageTop pageBottom sub def% pageHeight = pageTop - pageBottom + + 72 72 dtransform % Get device resolution per inch + /yResolution exch abs def % yResolution = abs(yres) + /xResolution exch abs def % xResolution = abs(xres) + + % Figure out the sizes of things... + /wheelSize % size of wheels + pageWidth pageHeight lt + { pageWidth 9 mul } + { pageHeight 7 mul } + ifelse def + + % Create fonts... + /bigFont /Helvetica-Bold findfont % bigFont = Helvetica-Bold + pageHeight 3 mul scalefont def % size = pageHeight * 3 (nominally 33) + + /mediumFont /Helvetica findfont % mediumFont = Helvetica + pageHeight 1.5 mul scalefont def % size = pageHeight * 1.5 (nominally 16.5) + + /smallFont /Times-Roman findfont % smallFont = Times-Roman + pageHeight scalefont def % size = pageHeight (nominally 11) + + % Draw rulers along the edges... + /CENTIMETER 72 2.54 div def + /MILLIMETER 72 25.4 div def + + /Times-Roman findfont % Font for ruler numbers + 11 scalefont setfont % 11 points + + gsave % Left side inches + pageLeft 72 mul 0 translate % Offset left edge + + 1 setlinewidth % Draw normal lines + 72 72 pageTop 72 mul { % Height inches + dup dup + 0 exch moveto 24 0 rlineto stroke % Draw tic mark + 24 exch pageHeight sub moveto % Draw number + 72 div cvi 10 string cvs RIGHT + } for + + 0.5 setlinewidth % Draw thin lines + 18 18 pageTop 72 mul { % 1/4 inches + 0 exch moveto 15 0 rlineto stroke % Draw tic mark + } for + + 9 9 pageTop 72 mul { % 1/8 inches + 0 exch moveto 6 0 rlineto stroke % Draw tic mark + } for + grestore + + gsave % Bottom inches + 0 pageBottom 72 mul translate % Offset bottom edge + + 1 setlinewidth % Draw normal lines + 72 72 pageRight 72 mul { % Width inches + dup dup + 0 moveto 0 24 rlineto stroke % Draw tic mark + 3 add 27 pageHeight sub moveto % Draw number + 72 div cvi 10 string cvs show + } for + + 0.5 setlinewidth % Draw thin lines + 18 18 pageRight 72 mul { % 1/4 inches + 0 moveto 0 15 rlineto stroke % Draw tic mark + } for + + 9 9 pageRight 72 mul { % 1/8 inches + 0 moveto 0 6 rlineto stroke % Draw tic mark + } for + grestore + + gsave % Right side centimeters + pageRight 72 mul 0 translate % Offset right edge + + 1 setlinewidth % Draw normal lines + CENTIMETER CENTIMETER + pageTop 72 mul { % Height centimeters + 0 exch moveto -24 0 rlineto stroke% Draw tic mark + } for + 1 1 pageTop 2.54 mul { % Height labels + dup + -24 exch CENTIMETER mul + pageHeight sub moveto % Draw number + cvi 10 string cvs show + } for + + 0.5 setlinewidth % Draw thin lines + 0 0.5 CENTIMETER mul + pageTop 72 mul { % 1/2 centimeters + 0 exch moveto -15 0 rlineto stroke% Draw tic mark + } for + 0 MILLIMETER pageTop 72 mul { % Millimeters + 0 exch moveto -6 0 rlineto stroke % Draw tic mark + } for + grestore + + gsave % Top centimeters + 0 pageTop 72 mul translate % Offset top edge + + 1 setlinewidth % Draw normal lines + CENTIMETER CENTIMETER + pageRight 72 mul { % Width centimeters + 0 moveto 0 -24 rlineto stroke % Draw tic mark + } for + 1 1 pageRight 2.54 mul { % Width labels + dup + CENTIMETER mul 3 add -24 moveto % Draw number + cvi 10 string cvs show + } for + + 0.5 setlinewidth % Draw thin lines + 0 0.5 CENTIMETER mul + pageRight 72 mul { % 1/2 centimeters + 0 moveto 0 -15 rlineto stroke % Draw tic mark + } for + 0 MILLIMETER pageRight 72 mul { % Millimeters + 0 moveto 0 -6 rlineto stroke % Draw tic mark + } for + grestore + + % Offset page to account for lower-left margin... + pageLeft 72 mul + pageBottom 72 mul + translate + + % Set text font and color... + mediumFont setfont % Font + 0 setgray % Color + 1 setlinewidth % Draw normal lines + + % Draw the color wheel... + gsave + % Position the wheel on the left side... + pageWidth 18 mul % x = pageWidth * 1/4 * 72 + pageHeight 54 mul % y = pageHeight * 3/4 * 72 + translate + + % Size the wheel... + wheelSize + + % Draw the colors... + dup (C) 3 -1 roll 0 1 1 SEXTANT 60 rotate + dup (M) 3 -1 roll 1 0 1 SEXTANT 60 rotate + dup (Y) 3 -1 roll 1 1 0 SEXTANT 60 rotate + dup (R) 3 -1 roll 1 0 0 SEXTANT 60 rotate + dup (G) 3 -1 roll 0 1 0 SEXTANT 60 rotate + dup (B) 3 -1 roll 0 0 1 SEXTANT 60 rotate + + pop + grestore + + % Label the color wheel... + pageWidth 18 mul % x = pageWidth * 1/4 * 72 + pageHeight 43 mul % y = pageHeight * 19/32 * 72 + moveto % Position the text + (Color Wheel) CENTER % Show the text centered + + % Draw the gray ramp... + gsave + % Position the gray ramp in the center... + pageWidth 36 mul % x = pageWidth * 1/2 * 72 + pageHeight 54 mul % y = pageHeight * 3/4 * 72 + wheelSize sub % - wheelSize + translate + + % Loop through 100 shades... + 0 0.010101 0.98 { + % Set the color... + dup setgray % Set the grayscale... + + % Draw the polygon... + newpath % Start a new path... + + wheelSize -0.2 mul % X = -wheelSize / 5 + 1 index 2 mul wheelSize mul % Y = val * 2 * wheelSize + moveto % Move there... + + wheelSize 0.4 mul 0 rlineto % Right side... + + wheelSize 0.2 mul % X = wheelSize / 5 + 1 index 0.010101 add 2 mul wheelSize mul + % Y = (val + 0.010101) * 2 * wheelSize + lineto % Move there... + + wheelSize -0.4 mul 0 rlineto % Left side... + + closepath % Close the path + fill % Fill it... + + pop % Pop value... + } for + + 0 setgray % Black + + newpath % Start a new path + wheelSize -0.2 mul 0 moveto % Bottom left + wheelSize 0.4 mul 0 rlineto % Bottom right + 0 wheelSize 2 mul rlineto % Upper right + wheelSize -0.4 mul 0 rlineto % Upper left + closepath % Close the path + stroke % Stroke it... + + 0 wheelSize -0.2 mul moveto % Center bottom for label + (K) CENTER % Center K at bottom + + 0 wheelSize 2.05 mul moveto % Center top for label + (W) CENTER % Center W at top + grestore + + % Label the gray ramp... + pageWidth 36 mul % x = pageWidth * 1/2 * 72 + pageHeight 43 mul % y = pageHeight * 19/32 * 72 + moveto % Position the text + (Gray Ramp) CENTER % Show the text centered + + + % Draw radial lines... + gsave + 0 setlinewidth % 1 pixel lines + + % Position the lines on the left side... + pageWidth 54 mul % x = pageWidth * 3/4 * 72 + pageHeight 54 mul % y = pageHeight * 3/4 * 72 + translate + + % Size the wheel... + wheelSize + + % Loop at 1 degree increments + 0 1 359 { + pop % Discard angle - not used + 0 0 moveto % Start line at the center + dup 0 lineto % Draw to the radius + 1 rotate % Rotate 1 degree + } for + + pop % Discard radius - not needed anymore + stroke % Draw lines... + + grestore + + % Label the lines... + pageWidth 54 mul % x = pageWidth * 3/4 * 72 + pageHeight 43 mul % y = pageHeight * 19/32 * 72 + moveto % Position the text + (1 Degree Radial Lines) CENTER % Show the text centered + + % Imageable area... + pageHeight 15 mul % Height of imageable area + + pageWidth 4.5 mul % x = pageWidth * 1/16 * 72 + pageHeight 35.5 mul % y = pageHeight * 1/2 * 72 + 2 index sub % y -= height + pageWidth 28 mul % width = pageWidth * 1/4 * 72 + 3 index % height + 0.5 setgray rectfill % Draw a shadow + + pageWidth 4 mul % x = pageWidth * 1/16 * 72 + pageHeight 36 mul % y = pageHeight * 1/2 * 72 + 2 index sub % y -= height + pageWidth 28 mul % width = pageWidth * 3/8 * 72 + 3 index % height + 4 copy 1 setgray rectfill % Clear the box to white + 0 setgray rectstroke % Draw a black box around it... + + pop % Discard height + + % Label the imageable area... + pageWidth 4 mul % x = pageWidth * 1/16 * 72 + pageHeight 37 mul % y = pageHeight * 1/2 * 72 + moveto % Position the text + mediumFont setfont % Font + (Imageable Area) show % Show the text + + smallFont setfont % Font + pageWidth 14 mul % x = pageWidth * 3/16 * 72 + pageHeight 36 mul % y = pageWidth * 1/2 * 72 + pageHeight -2 mul add % y -= 2 * smallFont height + + % Page Size inches + 2 copy moveto % Move to x & y + (Page Size: ) RIGHT % Label + 100 pageWidth NUMBER % pageWidth + (x) show % "x" + 100 pageHeight NUMBER % pageHeight + (in) show % "in" + + % Page Size millimeters + pageHeight sub % Move down... + + 2 copy moveto % Move to x & y + 10 pageWidth 25.4 mul NUMBER % pageWidth + (x) show % "x" + 10 pageHeight 25.4 mul NUMBER % pageHeight + (mm) show % "mm" + + % Lower-left inches + pageHeight 2 mul sub % Move down... + + 2 copy moveto % Move to x & y + (Lower-Left: ) RIGHT % Label + 100 pageLeft NUMBER % pageLeft + (x) show % "x" + 100 pageBottom NUMBER % pageBottom + (in) show % "in" + + % Lower-left millimeters + pageHeight sub % Move down... + + 2 copy moveto % Move to x & y + 10 pageLeft 25.4 mul NUMBER % pageLeft + (x) show % "x" + 10 pageBottom 25.4 mul NUMBER % pageBottom + (mm) show % "mm" + + % Upper-right inches + pageHeight 2 mul sub % Move down... + + 2 copy moveto % Move to x & y + (Upper-Right: ) RIGHT % Label + 100 pageRight NUMBER % pageRight + (x) show % "x" + 100 pageTop NUMBER % pageTop + (in) show % "in" + + % Upper-right millimeters + pageHeight sub % Move down... + + 2 copy moveto % Move to x & y + 10 pageRight 25.4 mul NUMBER % pageRight + (x) show % "x" + 10 pageTop 25.4 mul NUMBER % pageTop + (mm) show % "mm" + + % Resolution dots-per-inch + pageHeight 2 mul sub % Move down... + + 2 copy moveto % Move to x & y + (Resolution: ) RIGHT % Label + 1 xResolution NUMBER % xResolution + (x) show % "x" + 1 yResolution NUMBER % yResolution + (dpi) show % "dpi" + + % Resolution dots-per-meter + pageHeight sub % Move down... + + moveto % Move to x & y + 1 xResolution 39.27 mul NUMBER % xResolution + (x) show % "x" + 1 yResolution 39.27 mul NUMBER % yResolution + (dpm) show % "dpm" + + % Interpreter Information... + pageHeight 15 mul % Height of interpreter information + + pageWidth 40.5 mul % x = pageWidth * 9/16 * 72 + pageHeight 35.5 mul % y = pageHeight * 1/2 * 72 + 2 index sub % y -= height + pageWidth 28 mul % width = pageWidth * 1/4 * 72 + 3 index % height + 0.5 setgray rectfill % Draw a shadow + + pageWidth 40 mul % x = pageWidth * 9/16 * 72 + pageHeight 36 mul % y = pageHeight * 1/2 * 72 + 2 index sub % y -= height + pageWidth 28 mul % width = pageWidth * 3/8 * 72 + 3 index % height + 4 copy 1 setgray rectfill % Clear the box to white + 0 setgray rectstroke % Draw a black box around it... + + pop % Discard height + + % Label the interpreter info... + pageWidth 40 mul % x = pageWidth * 9/16 * 72 + pageHeight 37 mul % y = pageHeight * 1/2 * 72 + moveto % Position the text + mediumFont setfont % Font + (Interpreter Information) show % Show the text + + smallFont setfont % Font + pageWidth 49 mul % x = pageWidth * 11/16 * 72 + pageHeight 36 mul % y = pageWidth * 1/2 * 72 + pageHeight 2 mul sub % y -= 2 * smallFont height + + % Language level + 2 copy moveto % Move to x & y + (PostScript: ) RIGHT % Label + (Level ) show % "Level " + 1 languagelevel NUMBER % Language level + + % Version + pageHeight 2 mul sub % Move down... + 2 copy moveto % Move to x & y + (Version: ) RIGHT % Label + version show % Version + ( \() show % " (" + 1 revision NUMBER % Revision + (\)) show % ")" + + % Product + pageHeight 2 mul sub % Move down... + 2 copy moveto % Move to x & y + (Product: ) RIGHT % Label + product show % Product name + + % Serial Number + pageHeight 2 mul sub % Move down... + moveto % Move to x & y + (Serial #: ) RIGHT % Label + 1 serialnumber NUMBER % S/N + + % Draw the label at the top... + pageWidth 36 mul % Center of page + pageHeight 66 mul % Top of page (11/12ths) + moveto % Position text + bigFont setfont % Font + (Printer Test Page) CENTER % Show text centered + + % Draw the copyright notice at the bottom... + pageWidth 17 mul % Center of page + pageHeight 10 mul % Bottom of page + moveto % Position text + (Printed Using CUPS v1.3.x) show + + pageWidth 17 mul % Left side of page + pageHeight 8 mul % Move down... + 2 copy moveto % Position text + smallFont setfont % Font + (Copyright 2007 Apple Inc., All Rights Reserved. CUPS and the CUPS logo are the trademark) show + pageHeight 2 add sub % Move down... + 2 copy moveto % Position text + (property of Apple Inc., 1 Infinite Loop, Cupertino, CA 95014, USA.) show + pageHeight 2 mul 4 add sub % Move down... + moveto % Position text + (Need help? Contact your operating system vendor or visit "http://www.cups.org/".) show + + % Then the CUPS logo.... + gsave + pageWidth 4 mul + pageHeight 4 mul + translate + pageWidth 15 mul CUPSLOGO + grestore + +% Show the page... +grestore +showpage +% +% End of "$Id: testfile.ps 6649 2007-07-11 21:46:42Z mike $". +% +%%EOF diff --git a/test/testfile.txt b/test/testfile.txt new file mode 100644 index 00000000..46bbf084 --- /dev/null +++ b/test/testfile.txt @@ -0,0 +1,60 @@ +All work and no play makes Johhny a dull boy. All work and no +play makes Johhny a dull boy. All work and no play makes Johhny +a dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. All +work and no play makes Johhny a dull boy. All work and no play +makes Johhny a dull boy. All work and no play makes Johhny a +dull boy. All work and no play makes Johhny a dull boy. diff --git a/test/testhp.ppd b/test/testhp.ppd new file mode 100644 index 00000000..7392bc29 --- /dev/null +++ b/test/testhp.ppd @@ -0,0 +1,186 @@ +*PPD-Adobe: "4.3" +*% +*% "$Id: testhp.ppd 6649 2007-07-11 21:46:42Z mike $" +*% +*% Test HP PPD file for the Common UNIX Printing System (CUPS). +*% +*% Copyright 2007 by Apple Inc. +*% Copyright 1997-2005 by Easy Software Products. +*% +*% These coded instructions, statements, and computer programs are the +*% property of Apple Inc. and are protected by Federal copyright +*% law. Distribution and use rights are outlined in the file "LICENSE.txt" +*% which should have been included with this file. If this file is +*% file is missing or damaged, see the license at "http://www.cups.org/". +*% +*FormatVersion: "4.3" +*FileVersion: "1.1" +*LanguageVersion: English +*LanguageEncoding: ISOLatin1 +*PCFileName: "TESTHP.PPD" +*Manufacturer: "ESP" +*Product: "(CUPS v1.1)" +*cupsVersion: 1.1 +*cupsManualCopies: True +*cupsFilter: "application/vnd.cups-raster 50 rastertohp" +*ModelName: "Test HP Printer" +*ShortNickName: "Test HP Printer" +*NickName: "Test HP Printer CUPS v1.1" +*PSVersion: "(3010.000) 550" +*LanguageLevel: "3" +*ColorDevice: True +*DefaultColorSpace: RGB +*FileSystem: False +*Throughput: "1" +*LandscapeOrientation: Plus90 +*VariablePaperSize: False +*TTRasterizer: Type42 + +*UIConstraints: *PageSize Executive *InputSlot Envelope +*UIConstraints: *PageSize Letter *InputSlot Envelope +*UIConstraints: *PageSize Legal *InputSlot Envelope +*UIConstraints: *PageSize Tabloid *InputSlot Envelope +*UIConstraints: *PageSize A3 *InputSlot Envelope +*UIConstraints: *PageSize A4 *InputSlot Envelope +*UIConstraints: *PageSize A5 *InputSlot Envelope +*UIConstraints: *PageSize B5 *InputSlot Envelope +*UIConstraints: *Resolution 600dpi *ColorModel CMYK + +*OpenUI *PageSize/Media Size: PickOne +*OrderDependency: 10 AnySetup *PageSize +*DefaultPageSize: Letter +*PageSize Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice" +*PageSize Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice" +*PageSize Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice" +*PageSize Tabloid/US Tabloid: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice" +*PageSize A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice" +*PageSize A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice" +*PageSize A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice" +*PageSize B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice" +*PageSize EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice" +*PageSize Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice" +*PageSize EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice" +*PageSize EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice" +*PageSize EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice" +*CloseUI: *PageSize + +*OpenUI *PageRegion: PickOne +*OrderDependency: 10 AnySetup *PageRegion +*DefaultPageRegion: Letter +*PageRegion Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice" +*PageRegion Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice" +*PageRegion Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice" +*PageRegion Tabloid/US Tabloid: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice" +*PageRegion A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice" +*PageRegion A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice" +*PageRegion A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice" +*PageRegion B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice" +*PageRegion EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice" +*PageRegion Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice" +*PageRegion EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice" +*PageRegion EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice" +*PageRegion EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice" +*CloseUI: *PageRegion + +*DefaultImageableArea: Letter +*ImageableArea Letter/US Letter: "18 36 594 756" +*ImageableArea Legal/US Legal: "18 36 594 972" +*ImageableArea Executive/US Executive: "18 36 504 684" +*ImageableArea Tabloid/US Tabloid: "18 36 774 1188" +*ImageableArea A3/A3: "18 36 824 1155" +*ImageableArea A4/A4: "18 36 577 806" +*ImageableArea A5/A5: "18 36 403 559" +*ImageableArea B5/JIS B5: "18 36 498 693" +*ImageableArea EnvISOB5/B5 (ISO): "18 36 463 673" +*ImageableArea Env10/Com-10: "18 36 279 648" +*ImageableArea EnvC5/EnvC5: "18 36 441 613" +*ImageableArea EnvDL/EnvDL: "18 36 294 588" +*ImageableArea EnvMonarch/Envelope Monarch: "18 36 261 504" + +*DefaultPaperDimension: Letter +*PaperDimension Letter/US Letter: "612 792" +*PaperDimension Legal/US Legal: "612 1008" +*PaperDimension Executive/US Executive: "522 756" +*PaperDimension Tabloid/US Tabloid: "792 1224" +*PaperDimension A3/A3: "842 1191" +*PaperDimension A4/A4: "595 842" +*PaperDimension A5/A5: "421 595" +*PaperDimension B5/B5 (JIS): "516 729" +*PaperDimension EnvISOB5/Envelope B5: "499 709" +*PaperDimension Env10/Envelope #10: "297 684" +*PaperDimension EnvC5/Envelope C5: "459 649" +*PaperDimension EnvDL/Envelope DL: "312 624" +*PaperDimension EnvMonarch/Envelope Monarch: "279 540" + +*OpenUI *MediaType/Media Type: PickOne +*OrderDependency: 10 AnySetup *MediaType +*DefaultMediaType: Plain +*MediaType Plain/Plain Paper: "<</MediaType(Plain)/cupsMediaType 0>>setpagedevice" +*MediaType Bond/Bond Paper: "<</MediaType(Bond)/cupsMediaType 1>>setpagedevice" +*MediaType Special/Special Paper: "<</MediaType(Special)/cupsMediaType 2>>setpagedevice" +*MediaType Transparency/Transparency: "<</MediaType(Transparency)/cupsMediaType 3>>setpagedevice" +*MediaType Glossy/Glossy Paper: "<</MediaType(Glossy)/cupsMediaType 4>>setpagedevice" +*CloseUI: *MediaType + +*OpenUI *InputSlot/Media Source: PickOne +*OrderDependency: 10 AnySetup *InputSlot +*DefaultInputSlot: Tray +*InputSlot Tray/Tray: "<</cupsMediaPosition 1>>setpagedevice" +*InputSlot Manual/Manual Feed: "<</cupsMediaPosition 2>>setpagedevice" +*InputSlot Envelope/Envelope Feed: "<</cupsMediaPosition 3>>setpagedevice" +*CloseUI: *InputSlot + +*OpenUI *Resolution/Output Resolution: PickOne +*OrderDependency: 20 AnySetup *Resolution +*DefaultResolution: 100dpi +*Resolution 75dpi/75 DPI: "<</HWResolution[75 75]>>setpagedevice" +*Resolution 100dpi/100 DPI: "<</HWResolution[100 100]>>setpagedevice" +*CloseUI: *Resolution + +*OpenUI *ColorModel/Output Mode: PickOne +*OrderDependency: 10 AnySetup *ColorModel +*DefaultColorModel: CMYK +*ColorModel CMYK/CMYK Color: "<</cupsColorOrder 1/cupsColorSpace 8/cupsCompression 2>>setpagedevice" +*ColorModel RGB/CMY Color: "<</cupsColorOrder 1/cupsColorSpace 4/cupsCompression 2>>setpagedevice" +*ColorModel Gray/Grayscale: "<</cupsColorOrder 0/cupsColorSpace 3/cupsCompression 2>>setpagedevice" +*CloseUI: *ColorModel + +*DefaultFont: Courier +*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM +*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM +*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM +*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM +*Font Bookman-Demi: Standard "(001.004S)" Standard ROM +*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM +*Font Bookman-Light: Standard "(001.004S)" Standard ROM +*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM +*Font Courier: Standard "(002.004S)" Standard ROM +*Font Courier-Bold: Standard "(002.004S)" Standard ROM +*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM +*Font Courier-Oblique: Standard "(002.004S)" Standard ROM +*Font Helvetica: Standard "(001.006S)" Standard ROM +*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM +*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM +*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM +*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM +*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM +*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM +*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM +*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM +*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM +*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM +*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM +*Font Palatino-Bold: Standard "(001.005S)" Standard ROM +*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM +*Font Palatino-Italic: Standard "(001.005S)" Standard ROM +*Font Palatino-Roman: Standard "(001.005S)" Standard ROM +*Font Symbol: Special "(001.007S)" Special ROM +*Font Times-Bold: Standard "(001.007S)" Standard ROM +*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM +*Font Times-Italic: Standard "(001.007S)" Standard ROM +*Font Times-Roman: Standard "(001.007S)" Standard ROM +*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM +*Font ZapfDingbats: Special "(001.004S)" Standard ROM +*% +*% End of "$Id: testhp.ppd 6649 2007-07-11 21:46:42Z mike $". +*% diff --git a/test/testps.ppd b/test/testps.ppd new file mode 100644 index 00000000..77c8ca62 --- /dev/null +++ b/test/testps.ppd @@ -0,0 +1,183 @@ +*PPD-Adobe: "4.3" +*% +*% "$Id: testps.ppd 6649 2007-07-11 21:46:42Z mike $" +*% +*% Test PS PPD file for the Common UNIX Printing System (CUPS). +*% +*% Copyright 2007 by Apple Inc. +*% Copyright 1997-2005 by Easy Software Products. +*% +*% These coded instructions, statements, and computer programs are the +*% property of Apple Inc. and are protected by Federal copyright +*% law. Distribution and use rights are outlined in the file "LICENSE.txt" +*% which should have been included with this file. If this file is +*% file is missing or damaged, see the license at "http://www.cups.org/". +*% +*FormatVersion: "4.3" +*FileVersion: "1.1" +*LanguageVersion: English +*LanguageEncoding: ISOLatin1 +*PCFileName: "TESTPS.PPD" +*Manufacturer: "ESP" +*Product: "(CUPS v1.1)" +*ModelName: "Test PS Printer" +*ShortNickName: "Test PS Printer" +*NickName: "Test PS Printer CUPS v1.1" +*PSVersion: "(3010.000) 550" +*LanguageLevel: "3" +*ColorDevice: True +*DefaultColorSpace: RGB +*FileSystem: False +*Throughput: "1" +*LandscapeOrientation: Plus90 +*VariablePaperSize: False +*TTRasterizer: Type42 + +*UIConstraints: *PageSize Executive *InputSlot Envelope +*UIConstraints: *PageSize Letter *InputSlot Envelope +*UIConstraints: *PageSize Legal *InputSlot Envelope +*UIConstraints: *PageSize Tabloid *InputSlot Envelope +*UIConstraints: *PageSize A3 *InputSlot Envelope +*UIConstraints: *PageSize A4 *InputSlot Envelope +*UIConstraints: *PageSize A5 *InputSlot Envelope +*UIConstraints: *PageSize B5 *InputSlot Envelope +*UIConstraints: *Resolution 600dpi *ColorModel CMYK + +*OpenUI *PageSize/Media Size: PickOne +*OrderDependency: 10 AnySetup *PageSize +*DefaultPageSize: Letter +*PageSize Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice" +*PageSize Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice" +*PageSize Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice" +*PageSize Tabloid/US Tabloid: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice" +*PageSize A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice" +*PageSize A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice" +*PageSize A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice" +*PageSize B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice" +*PageSize EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice" +*PageSize Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice" +*PageSize EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice" +*PageSize EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice" +*PageSize EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice" +*CloseUI: *PageSize + +*OpenUI *PageRegion: PickOne +*OrderDependency: 10 AnySetup *PageRegion +*DefaultPageRegion: Letter +*PageRegion Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice" +*PageRegion Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice" +*PageRegion Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice" +*PageRegion Tabloid/US Tabloid: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice" +*PageRegion A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice" +*PageRegion A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice" +*PageRegion A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice" +*PageRegion B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice" +*PageRegion EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice" +*PageRegion Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice" +*PageRegion EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice" +*PageRegion EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice" +*PageRegion EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice" +*CloseUI: *PageRegion + +*DefaultImageableArea: Letter +*ImageableArea Letter/US Letter: "18 36 594 756" +*ImageableArea Legal/US Legal: "18 36 594 972" +*ImageableArea Executive/US Executive: "18 36 504 684" +*ImageableArea Tabloid/US Tabloid: "18 36 774 1188" +*ImageableArea A3/A3: "18 36 824 1155" +*ImageableArea A4/A4: "18 36 577 806" +*ImageableArea A5/A5: "18 36 403 559" +*ImageableArea B5/JIS B5: "18 36 498 693" +*ImageableArea EnvISOB5/B5 (ISO): "18 36 463 673" +*ImageableArea Env10/Com-10: "18 36 279 648" +*ImageableArea EnvC5/EnvC5: "18 36 441 613" +*ImageableArea EnvDL/EnvDL: "18 36 294 588" +*ImageableArea EnvMonarch/Envelope Monarch: "18 36 261 504" + +*DefaultPaperDimension: Letter +*PaperDimension Letter/US Letter: "612 792" +*PaperDimension Legal/US Legal: "612 1008" +*PaperDimension Executive/US Executive: "522 756" +*PaperDimension Tabloid/US Tabloid: "792 1224" +*PaperDimension A3/A3: "842 1191" +*PaperDimension A4/A4: "595 842" +*PaperDimension A5/A5: "421 595" +*PaperDimension B5/B5 (JIS): "516 729" +*PaperDimension EnvISOB5/Envelope B5: "499 709" +*PaperDimension Env10/Envelope #10: "297 684" +*PaperDimension EnvC5/Envelope C5: "459 649" +*PaperDimension EnvDL/Envelope DL: "312 624" +*PaperDimension EnvMonarch/Envelope Monarch: "279 540" + +*OpenUI *MediaType/Media Type: PickOne +*OrderDependency: 10 AnySetup *MediaType +*DefaultMediaType: Plain +*MediaType Plain/Plain Paper: "<</MediaType(Plain)/cupsMediaType 0>>setpagedevice" +*MediaType Bond/Bond Paper: "<</MediaType(Bond)/cupsMediaType 1>>setpagedevice" +*MediaType Special/Special Paper: "<</MediaType(Special)/cupsMediaType 2>>setpagedevice" +*MediaType Transparency/Transparency: "<</MediaType(Transparency)/cupsMediaType 3>>setpagedevice" +*MediaType Glossy/Glossy Paper: "<</MediaType(Glossy)/cupsMediaType 4>>setpagedevice" +*CloseUI: *MediaType + +*OpenUI *InputSlot/Media Source: PickOne +*OrderDependency: 10 AnySetup *InputSlot +*DefaultInputSlot: Tray +*InputSlot Tray/Tray: "<</cupsMediaPosition 1>>setpagedevice" +*InputSlot Manual/Manual Feed: "<</cupsMediaPosition 2>>setpagedevice" +*InputSlot Envelope/Envelope Feed: "<</cupsMediaPosition 3>>setpagedevice" +*CloseUI: *InputSlot + +*OpenUI *Resolution/Output Resolution: PickOne +*OrderDependency: 20 AnySetup *Resolution +*DefaultResolution: 100dpi +*Resolution 75dpi/75 DPI: "<</HWResolution[75 75]>>setpagedevice" +*Resolution 100dpi/100 DPI: "<</HWResolution[100 100]>>setpagedevice" +*CloseUI: *Resolution + +*OpenUI *ColorModel/Output Mode: PickOne +*OrderDependency: 10 AnySetup *ColorModel +*DefaultColorModel: CMYK +*ColorModel CMYK/CMYK Color: "<</cupsColorOrder 1/cupsColorSpace 8/cupsCompression 2>>setpagedevice" +*ColorModel RGB/CMY Color: "<</cupsColorOrder 1/cupsColorSpace 4/cupsCompression 2>>setpagedevice" +*ColorModel Gray/Grayscale: "<</cupsColorOrder 0/cupsColorSpace 3/cupsCompression 2>>setpagedevice" +*CloseUI: *ColorModel + +*DefaultFont: Courier +*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM +*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM +*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM +*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM +*Font Bookman-Demi: Standard "(001.004S)" Standard ROM +*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM +*Font Bookman-Light: Standard "(001.004S)" Standard ROM +*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM +*Font Courier: Standard "(002.004S)" Standard ROM +*Font Courier-Bold: Standard "(002.004S)" Standard ROM +*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM +*Font Courier-Oblique: Standard "(002.004S)" Standard ROM +*Font Helvetica: Standard "(001.006S)" Standard ROM +*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM +*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM +*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM +*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM +*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM +*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM +*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM +*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM +*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM +*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM +*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM +*Font Palatino-Bold: Standard "(001.005S)" Standard ROM +*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM +*Font Palatino-Italic: Standard "(001.005S)" Standard ROM +*Font Palatino-Roman: Standard "(001.005S)" Standard ROM +*Font Symbol: Special "(001.007S)" Special ROM +*Font Times-Bold: Standard "(001.007S)" Standard ROM +*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM +*Font Times-Italic: Standard "(001.007S)" Standard ROM +*Font Times-Roman: Standard "(001.007S)" Standard ROM +*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM +*Font ZapfDingbats: Special "(001.004S)" Standard ROM +*% +*% End of "$Id: testps.ppd 6649 2007-07-11 21:46:42Z mike $". +*% diff --git a/test/waitjobs.sh b/test/waitjobs.sh new file mode 100755 index 00000000..b3dec929 --- /dev/null +++ b/test/waitjobs.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# +# "$Id: waitjobs.sh 8393 2009-02-25 23:24:18Z mike $" +# +# Script to wait for jobs to complete. +# +# Copyright 2008-2009 by Apple Inc. +# +# These coded instructions, statements, and computer programs are the +# property of Apple Inc. and are protected by Federal copyright +# law. Distribution and use rights are outlined in the file "LICENSE.txt" +# which should have been included with this file. If this file is +# file is missing or damaged, see the license at "http://www.cups.org/". +# + +# +# Get timeout from command-line +# + +if test $# = 1; then + timeout=$1 +else + timeout=360 +fi + +# +# Figure out the proper echo options... +# + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + ac_n=-n + ac_c= +else + ac_n= + ac_c='\c' +fi + +echo $ac_n "Waiting for jobs to complete...$ac_c" +oldjobs=0 + +while test $timeout -gt 0; do + jobs=`../systemv/lpstat 2>/dev/null | wc -l | tr -d ' '` + if test $jobs = 0; then + break + fi + + if test $jobs != $oldjobs; then + echo $ac_n "$jobs...$ac_c" + oldjobs=$jobs + fi + + sleep 5 + timeout=`expr $timeout - 5` +done + +echo "" + +# +# End of "$Id: waitjobs.sh 8393 2009-02-25 23:24:18Z mike $". +# |