summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDidier Raboud <didier@raboud.com>2010-05-23 00:05:04 +0200
committerDidier Raboud <didier@raboud.com>2010-05-23 00:05:04 +0200
commit014f0e14a3c6a044d99a67c8f4e1c4065452479e (patch)
tree300200f9bf0f3ebb0878741ddb287caf2e0d862e /test
parent6fefeecb6abbb1f7dfe07ade1a0abef06dac5d32 (diff)
Imported Upstream version 4.0-20090301upstream/4.0-20090301
Diffstat (limited to 'test')
-rw-r--r--test/foomatic-test-input-ps.ps54
-rwxr-xr-xtest/foomatic-test-renderer53
-rw-r--r--test/foomatic-test.ppd419
-rwxr-xr-xtest/lsbfuncs.sh387
-rwxr-xr-xtest/shfuncs.sh187
-rwxr-xr-xtest/tcm.sh571
-rwxr-xr-xtest/testfoomaticrip564
-rwxr-xr-xtest/tetapi.sh313
8 files changed, 2548 insertions, 0 deletions
diff --git a/test/foomatic-test-input-ps.ps b/test/foomatic-test-input-ps.ps
new file mode 100644
index 0000000..a03c8fa
--- /dev/null
+++ b/test/foomatic-test-input-ps.ps
@@ -0,0 +1,54 @@
+%!PS-Adobe-3.0
+%%BoundingBox: 0 0 612 792
+%%Pages: 4
+%%LanguageLevel: 1
+%%DocumentData: Clean7Bit
+%%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman
+%%Creator: Till Kamppeter, The Linux Foundation
+%%CreationDate: D:20071017174200+0100
+%%Title: PostScript test file for testing/debugging foomatic-rip
+%%EndComments
+%%BeginProlog
+/PAGE {
+/pagenumber exch def
+% Black frame magic from CUPS test page
+initclip newpath clippath pathbbox
+/pageTop exch def
+/pageRight exch def
+/pageBottom exch def
+/pageLeft exch def
+4 setlinewidth
+0 setgray closepath stroke
+% "Test Page N" in upper left corner
+pageLeft 4 add pageTop 30 sub moveto
+/Helvetica-Bold findfont
+24 scalefont setfont
+( Test Page ) show
+pagenumber 1 string cvs show
+} bind def
+%%EndProlog
+% The content of the page is kept simple, so that one sees insertions done
+% by foomatic-rip or any pre filter easily. Simply make a black frame around
+% the imageable area and write "Test page N" in Helvetica Bold 24pt in the upper
+% left corner of each page
+%%Page: 1 1
+gsave
+1 PAGE
+grestore
+showpage
+%%Page: 2 2
+gsave
+2 PAGE
+grestore
+showpage
+%%Page: 3 3
+gsave
+3 PAGE
+grestore
+showpage
+%%Page: 4 4
+gsave
+4 PAGE
+grestore
+showpage
+%%EOF
diff --git a/test/foomatic-test-renderer b/test/foomatic-test-renderer
new file mode 100755
index 0000000..de3401e
--- /dev/null
+++ b/test/foomatic-test-renderer
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# This is foomatic-test-renderer, a dummy renderer executable for testing
+# and debugging foomatic-rip.
+
+# To use it, create a test PPD file with lines like
+#
+# *cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip"
+# *FoomaticRIPCommandLine: "foomatic-test-renderer%A%B%C%Z"
+#
+# and use foomatic-rip with this PPD file. If you do this via a print queue
+# point the output of the queue into a file
+#
+# This program does nothing more than outputting the unchanged input data
+# and after that the command line with which it was called in a PostScript
+# comment (so one can still display the output as PostScript if the input
+# was PostScript).
+#
+# With the option "-p OPTION=VALUE" supplied one or more times, a PJL
+# header with appropriate options and also PJL to close the job will be added
+# Supply "-p" in the end of the command line to generate a PJL header
+# without option settings
+
+commandline=$*
+
+output="`cat`
+% $0 $commandline"
+
+pjl=0
+while [ -n "$*" ]; do
+ arg=$1
+ shift
+ if [ "$arg" = "-p" ]; then
+ if [ "$pjl" = "0" ]; then
+ pjl=1
+ printf "\033%%-12345X"
+ #printf "@PJL\r\n"
+ fi
+ if [ -n "$1" ]; then
+ printf "@PJL SET $1\r\n"
+ shift
+ fi
+ fi
+done
+if [ "$pjl" = "1" ]; then
+ printf "@PJL ENTER LANGUAGE=POSTSCRIPT\r\n"
+fi
+
+echo "$output"
+
+if [ "$pjl" = "1" ]; then
+ printf "\033%%-12345X@PJL EOJ\r\n"
+fi
diff --git a/test/foomatic-test.ppd b/test/foomatic-test.ppd
new file mode 100644
index 0000000..31aef02
--- /dev/null
+++ b/test/foomatic-test.ppd
@@ -0,0 +1,419 @@
+*PPD-Adobe: "4.3"
+*%
+*% For information on using this, and to obtain the required backend
+*% script, consult http://www.openprinting.org/
+*%
+*% This file is published under the GNU General Public License
+*%
+*% PPD-O-MATIC (3.0.0 or newer) generated this PPD file. It is for use with
+*% all programs and environments which use PPD files for dealing with
+*% printer capability information. The printer must be configured with the
+*% "foomatic-rip" backend filter script of Foomatic 3.0.0 or newer. This
+*% file and "foomatic-rip" work together to support PPD-controlled printer
+*% driver option access with arbitrary free software printer drivers and
+*% printing spoolers.
+*%
+*% To save this file on your disk, wait until the download has completed
+*% (the animation of the browser logo must stop) and then use the
+*% "Save as..." command in the "File" menu of your browser or in the
+*% pop-up manu when you click on this document with the right mouse button.
+*% DO NOT cut and paste this file into an editor with your mouse. This can
+*% introduce additional line breaks which lead to unexpected results.
+*%
+*% You may save this file as 'foomatic-test.ppd'
+*%
+*%
+*FormatVersion: "4.3"
+*FileVersion: "1.1"
+*LanguageVersion: English
+*LanguageEncoding: ISOLatin1
+*PCFileName: "TEST.PPD"
+*Manufacturer: "Test"
+*Product: "(Testprinter)"
+*cupsVersion: 1.0
+*cupsManualCopies: True
+*cupsModelNumber: 2
+*cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip"
+*%pprRIP: foomatic-rip other
+*ModelName: "Test Testprinter"
+*ShortNickName: "Test Testprinter testdriver"
+*NickName: "Test Testprinter Foomatic/testdriver"
+*PSVersion: "(3010.000) 550"
+*PSVersion: "(3010.000) 651"
+*PSVersion: "(3010.000) 652"
+*PSVersion: "(3010.000) 653"
+*PSVersion: "(3010.000) 704"
+*PSVersion: "(3010.000) 705"
+*PSVersion: "(3010.000) 800"
+*LanguageLevel: "3"
+*ColorDevice: False
+*DefaultColorSpace: Gray
+*FileSystem: False
+*Throughput: "1"
+*LandscapeOrientation: Plus90
+*TTRasterizer: Type42
+*1284DeviceID: "MFG:Test;MDL:Testprinter;DES:Test Testprinter;CMD:POSTSCRIPT;CLS:PRINTER;DRV:Dtestdriver,R0,M0;"
+
+*driverName testdriver/testdriver: ""
+*driverUrl: "http://www.openprinting.org/"
+*driverObsolete: False
+
+
+
+
+*HWMargins: 18 36 18 36
+*VariablePaperSize: True
+*MaxMediaWidth: 100000
+*MaxMediaHeight: 100000
+*NonUIOrderDependency: 100 AnySetup *CustomPageSize
+*CustomPageSize True: "pop pop pop
+<</PageSize [ 5 -2 roll ] /ImagingBBox null>>setpagedevice"
+*End
+*ParamCustomPageSize Width: 1 points 36 100000
+*ParamCustomPageSize Height: 2 points 36 100000
+*ParamCustomPageSize Orientation: 3 int 0 0
+*ParamCustomPageSize WidthOffset: 4 points 0 0
+*ParamCustomPageSize HeightOffset: 5 points 0 0
+
+*FoomaticIDs: Test-Testprinter testdriver
+*FoomaticRIPCommandLine: "%Afoomatic-test-renderer %B %C %D %E %F %Z"
+
+*OpenGroup: General/General
+
+*OpenUI *PageSize/Page Size: PickOne
+*OrderDependency: 100 AnySetup *PageSize
+*DefaultPageSize: Letter
+*PageSize Letter/Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
+*PageSize A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
+*PageSize Legal/Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+*CloseUI: *PageSize
+
+*OpenUI *PageRegion: PickOne
+*OrderDependency: 100 AnySetup *PageRegion
+*DefaultPageRegion: Letter
+*PageRegion Letter/Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
+*PageRegion A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
+*PageRegion Legal/Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+*CloseUI: *PageRegion
+
+*DefaultImageableArea: Letter
+*ImageableArea Letter/Letter: "18 36 594 756"
+*ImageableArea A4/A4: "18 36 577 806"
+*ImageableArea Legal/Legal: "18 36 594 972"
+
+*DefaultPaperDimension: Letter
+*PaperDimension Letter/Letter: "612 792"
+*PaperDimension A4/A4: "595 842"
+*PaperDimension Legal/Legal: "612 1008"
+
+*CloseGroup: General
+
+*OpenGroup: FilterHandling/Filter Handling
+
+*OpenUI *FilterPath/Filter Path: PickOne
+*FoomaticRIPOption FilterPath: string CmdLine A
+*FoomaticRIPOptionMaxLength FilterPath:255
+*FoomaticRIPOptionAllowedChars FilterPath: "./A-Za-z0-9_-"
+*OrderDependency: 150 AnySetup *FilterPath
+*FoomaticRIPOptionPrototype FilterPath: "%s"
+*DefaultFilterPath: Current
+*FilterPath None/None: ""
+*FilterPath Current/Current directory: "%% FoomaticRIPOptionSetting: FilterPath=Current"
+*FoomaticRIPOptionSetting FilterPath=Current: "./"
+*CloseUI: *FilterPath
+
+*CloseGroup: FilterHandling
+
+*OpenGroup: PSTest/Standard PostScript test options
+
+*OpenUI *Option1/Option 1: PickOne
+*OrderDependency: 200 DocumentSetup *Option1
+*DefaultOption1: Choice2
+*Option1 Choice1/Choice 1: "<</HWResolution [1200 1200]>> setpagedevice % Option1: Choice1"
+*Option1 Choice2/Choice 2: "<</HWResolution [1200 600]>> setpagedevice % Option1: Choice2"
+*Option1 Choice3/Choice 3: "
+ % Option1: Choice3
+ <</HWResolution [ 600 600]>> setpagedevice"
+*End
+*CloseUI: *Option1
+
+*OpenUI *Option2/Option 2: PickOne
+*OrderDependency: 210 DocumentSetup *Option2
+*DefaultOption2: Choice3
+*Option2 Choice1/Choice 1: "<</Test [Example1]>> setpagedevice % Option2: Choice1"
+*Option2 Choice2/Choice 2: "<</Test [Example2]>> setpagedevice % Option2: Choice2"
+*Option2 Choice3/Choice 3: "
+ % Option2: Choice3
+ <</Test [Example3]>> setpagedevice"
+*End
+*CloseUI: *Option2
+
+*OpenUI *Option3/Option 3: PickOne
+*OrderDependency: 250 AnySetup *Option3
+*DefaultOption3: Choice1
+*Option3 Choice1/Choice 1: "% Option3: Choice1"
+*Option3 Choice2/Choice 2: "% Option3: Choice2"
+*Option3 Choice3/Choice 3: "% Option3: Choice3"
+*CloseUI: *Option3
+
+*OpenUI *Option4/Option 4: PickOne
+*OrderDependency: 260 PageSetup *Option4
+*DefaultOption4: Choice1
+*Option4 Choice1/Choice 1: "% Option4: Choice1"
+*Option4 Choice2/Choice 2: "% Option4: Choice2"
+*Option4 Choice3/Choice 3: "% Option4: Choice3"
+*CloseUI: *Option4
+
+*OpenUI *Option5/Option 5: PickOne
+*OrderDependency: 270 Prolog *Option5
+*DefaultOption5: Choice1
+*Option5 Choice1/Choice 1: "% Option5: Choice1"
+*Option5 Choice2/Choice 2: "% Option5: Choice2"
+*Option5 Choice3/Choice 3: "% Option5: Choice3"
+*CloseUI: *Option5
+
+*OpenUI *Option6/Option 6: PickOne
+*OrderDependency: 280 JCLSetup *Option6
+*DefaultOption6: Choice1
+*Option6 Choice1/Choice 1: "@PJL SET TEST6=CHOICE1<0A>"
+*Option6 Choice2/Choice 2: "@PJL SET TEST6=CHOICE2<0A>"
+*Option6 Choice3/Choice 3: "@PJL SET TEST6=CHOICE3<0A>"
+*CloseUI: *Option6
+
+*OpenUI *Option7/Option 7: Boolean
+*OrderDependency: 205 AnySetup *Option7
+*DefaultOption7: True
+*Option7 True: "% Option7: True"
+*Option7 False: "% Option7: False"
+*CloseUI: *Option7
+
+*OpenUI *Option8/Option 8: Boolean
+*OrderDependency: 206 AnySetup *Option8
+*DefaultOption8: False
+*Option8 True: "% Option8: True"
+*Option8 False: "% Option8: False"
+*CloseUI: *Option8
+
+*CloseGroup: PSTest
+
+*OpenGroup: FoomaticTest/Test options with Foomatic keywords
+
+*OpenUI *FoomaticOption1/Foomatic Option 1: PickOne
+*FoomaticRIPOption FoomaticOption1: enum CmdLine B
+*OrderDependency: 300 AnySetup *FoomaticOption1
+*DefaultFoomaticOption1: Choice1
+*FoomaticOption1 Choice1/Choice 1: "%% FoomaticRIPOptionSetting: FoomaticOption1=Choice1"
+*FoomaticRIPOptionSetting FoomaticOption1=Choice1: " --option1=choice1"
+*FoomaticOption1 Choice2/Choice 2: "%% FoomaticRIPOptionSetting: FoomaticOption1=Choice2"
+*FoomaticRIPOptionSetting FoomaticOption1=Choice2: " --option1=choice2"
+*FoomaticOption1 Choice3/Choice 3: "%% FoomaticRIPOptionSetting: FoomaticOption1=Choice3"
+*FoomaticRIPOptionSetting FoomaticOption1=Choice3: " --option1=choice3"
+*CloseUI: *FoomaticOption1
+
+*OpenUI *FoomaticOption2/Foomatic Option 2: PickOne
+*FoomaticRIPOption FoomaticOption2: enum JCL B
+*OrderDependency: 300 AnySetup *FoomaticOption2
+*DefaultFoomaticOption2: Choice1
+*FoomaticOption2 Choice1/Choice 1: "%% FoomaticRIPOptionSetting: FoomaticOption2=Choice1"
+*FoomaticRIPOptionSetting FoomaticOption2=Choice1: "SET TEST2=CHOICE1"
+*FoomaticOption2 Choice2/Choice 2: "%% FoomaticRIPOptionSetting: FoomaticOption2=Choice2"
+*FoomaticRIPOptionSetting FoomaticOption2=Choice2: "SET TEST2=CHOICE2"
+*FoomaticOption2 Choice3/Choice 3: "%% FoomaticRIPOptionSetting: FoomaticOption2=Choice3"
+*FoomaticRIPOptionSetting FoomaticOption2=Choice3: "SET TEST2=CHOICE3"
+*CloseUI: *FoomaticOption2
+
+*OpenUI *FoomaticPJLMergeTest/Test for PJL Merging: PickOne
+*FoomaticRIPOption FoomaticPJLMergeTest: string CmdLine E
+*FoomaticRIPOptionAllowedChars FoomaticPJLMergeTest: " ./A-Za-z0-9_='-"
+*OrderDependency: 399 AnySetup *FoomaticPJLMergeTest
+*FoomaticRIPOptionPrototype FoomaticPJLMergeTest: "%s"
+*DefaultFoomaticPJLMergeTest: NoDriverPJL
+*FoomaticPJLMergeTest NoDriverPJL/No driver-generated PJL: "%% FoomaticRIPOptionSetting: FoomaticPJLMergeTest=NoDriverPJL"
+*FoomaticRIPOptionSetting FoomaticPJLMergeTest=NoDriverPJL: ""
+*FoomaticPJLMergeTest DriverPJL/Simulate driver-generated PJL: "%% FoomaticRIPOptionSetting: FoomaticPJLMergeTest=DriverPJL"
+*FoomaticRIPOptionSetting FoomaticPJLMergeTest=DriverPJL: " -p 'TEST2=CHOICE3' -p 'TEST6=CHOICE3' -p 'RESOLUTION=600'"
+*CloseUI: *FoomaticPJLMergeTest
+
+
+*OpenUI *FoomaticOption3/Foomatic Option 3: PickOne
+*FoomaticRIPOption FoomaticOption3: string PS Z
+*FoomaticRIPOptionMaxLength FoomaticOption3: 8
+*FoomaticRIPOptionAllowedChars FoomaticOption3: "./A-Za-z0-9_-"
+*OrderDependency: 350 AnySetup *FoomaticOption3
+*FoomaticRIPOptionPrototype FoomaticOption3: "% FoomaticOption3: %s"
+*DefaultFoomaticOption3: Choice1
+*FoomaticOption3 Choice1/Choice 1: "% FoomaticOption3: Choice1"
+*FoomaticOption3 Choice2/Choice 2: "% FoomaticOption3: Choice2"
+*FoomaticOption3 Choice3/Choice 3: "% FoomaticOption3: Choice3"
+*CloseUI: *FoomaticOption3
+
+*OpenUI *FoomaticOption4/Foomatic Option 4: PickOne
+*FoomaticRIPOption FoomaticOption4: password PS Z
+*FoomaticRIPOptionMaxLength FoomaticOption4: 8
+*FoomaticRIPOptionAllowedRegExp FoomaticOption4: "^[A-Za-z0-9]*$"
+*OrderDependency: 360 AnySetup *FoomaticOption4
+*FoomaticRIPOptionPrototype FoomaticOption4: "% FoomaticOption4: %s"
+*DefaultFoomaticOption4: Choice1
+*FoomaticOption4 Choice1/Choice 1: "% FoomaticOption4: Choice1"
+*FoomaticOption4 Choice2/Choice 2: "% FoomaticOption4: Choice2"
+*FoomaticOption4 Choice3/Choice 3: "% FoomaticOption4: Choice3"
+*CloseUI: *FoomaticOption4
+
+*OpenUI *FoomaticOption5/Foomatic Option 5: PickOne
+*FoomaticRIPOption FoomaticOption5: int PS Z
+*FoomaticRIPOptionRange FoomaticOption5: -10 10
+*OrderDependency: 370 AnySetup *FoomaticOption5
+*FoomaticRIPOptionPrototype FoomaticOption5: "% FoomaticOption5: %s"
+*DefaultFoomaticOption5: 2
+*FoomaticRIPDefaultFoomaticOption5: 2
+*FoomaticOption5 -10/-10: "% FoomaticOption5: -10"
+*FoomaticOption5 -8/-8: "% FoomaticOption5: -8"
+*FoomaticOption5 -6/-6: "% FoomaticOption5: -6"
+*FoomaticOption5 -4/-4: "% FoomaticOption5: -4"
+*FoomaticOption5 -2/-2: "% FoomaticOption5: -2"
+*FoomaticOption5 0/0: "% FoomaticOption5: 0"
+*FoomaticOption5 2/2: "% FoomaticOption5: 2"
+*FoomaticOption5 4/4: "% FoomaticOption5: 4"
+*FoomaticOption5 6/6: "% FoomaticOption5: 6"
+*FoomaticOption5 8/8: "% FoomaticOption5: 8"
+*FoomaticOption5 10/10: "% FoomaticOption5: 10"
+*CloseUI: *FoomaticOption5
+
+*OpenUI *FoomaticOption6/Foomatic Option 6: PickOne
+*FoomaticRIPOption FoomaticOption6: float PS Z
+*FoomaticRIPOptionRange FoomaticOption6: -2.5 2.5
+*OrderDependency: 380 AnySetup *FoomaticOption6
+*FoomaticRIPOptionPrototype FoomaticOption6: "% FoomaticOption6: %s"
+*DefaultFoomaticOption6: 1.0
+*FoomaticRIPDefaultFoomaticOption6: 1.2
+*FoomaticOption6 -2.5/-2.5: "% FoomaticOption6: -2.5"
+*FoomaticOption6 -2.0/-2.0: "% FoomaticOption6: -2.0"
+*FoomaticOption6 -1.5/-1.5: "% FoomaticOption6: -1.5"
+*FoomaticOption6 -1.0/-1.0: "% FoomaticOption6: -1.0"
+*FoomaticOption6 -0.5/-0.5: "% FoomaticOption6: -0.5"
+*FoomaticOption6 0/0: "% FoomaticOption6: 0"
+*FoomaticOption6 0.5/0.5: "% FoomaticOption6: 0.5"
+*FoomaticOption6 1.0/1.0: "% FoomaticOption6: 1.0"
+*FoomaticOption6 1.5/1.5: "% FoomaticOption6: 1.5"
+*FoomaticOption6 2.0/2.0: "% FoomaticOption6: 2.0"
+*FoomaticOption6 2.5/2.5: "% FoomaticOption6: 2.5"
+*CloseUI: *FoomaticOption6
+
+*FoomaticRIPOption FoomaticOption7: enum CmdLine B 390
+*FoomaticRIPOptionSetting FoomaticOption7=TheOnlyChoice: " --FoomaticOption7"
+
+*OpenUI *FoomaticOption8/Foomatic Option 8: PickOne
+*FoomaticRIPOption FoomaticOption8: enum Composite C
+*OrderDependency: 392 AnySetup *FoomaticOption8
+*DefaultFoomaticOption8: Choice3
+*FoomaticOption8 Choice1/Choice 1: "%% FoomaticRIPOptionSetting: FoomaticOption8=Choice1"
+*FoomaticRIPOptionSetting FoomaticOption8=Choice1: "FoomaticOption9=ChoiceA FoomaticOptionA=ChoiceD"
+*FoomaticOption8 Choice2/Choice 2: "%% FoomaticRIPOptionSetting: FoomaticOption8=Choice2"
+*FoomaticRIPOptionSetting FoomaticOption8=Choice2: "FoomaticOption9=ChoiceB FoomaticOptionA=ChoiceE"
+*FoomaticOption8 Choice3/Choice 3: "%% FoomaticRIPOptionSetting: FoomaticOption8=Choice3"
+*FoomaticRIPOptionSetting FoomaticOption8=Choice3: "FoomaticOption9=ChoiceC FoomaticOptionA=ChoiceF"
+*CloseUI: *FoomaticOption8
+
+*OpenUI *FoomaticOptionB/Foomatic Option B: PickOne
+*FoomaticRIPOption FoomaticOptionB: enum Composite C
+*OrderDependency: 395 AnySetup *FoomaticOptionB
+*DefaultFoomaticOptionB: Choice2
+*FoomaticOptionB Choice1/Choice 1: "%% FoomaticRIPOptionSetting: FoomaticOptionB=Choice1"
+*FoomaticRIPOptionSetting FoomaticOptionB=Choice1: "FoomaticOptionC=ChoiceA FoomaticOptionD=ChoiceD"
+*FoomaticOptionB Choice2/Choice 2: "%% FoomaticRIPOptionSetting: FoomaticOptionB=Choice2"
+*FoomaticRIPOptionSetting FoomaticOptionB=Choice2: "FoomaticOptionC=ChoiceB FoomaticOptionD=ChoiceE"
+*FoomaticOptionB Choice3/Choice 3: "%% FoomaticRIPOptionSetting: FoomaticOptionB=Choice3"
+*FoomaticRIPOptionSetting FoomaticOptionB=Choice3: "FoomaticOptionC=ChoiceC FoomaticOptionD=ChoiceF"
+*CloseUI: *FoomaticOptionB
+
+*FoomaticRIPOption FoomaticOptionE: enum CmdLine D 398
+*FoomaticRIPOptionSetting FoomaticOptionE=TheOnlyChoice: " --Foomatic&&
+OptionE --user='&user;' --host='&host;' --title='&title;' --copies='&&&
+copies;' --options='(&options;)' --date='&month;/&date;/&year;' --time='&&&
+hour;:&min;:&sec;' --special='&amp;&lt;&gt;&quot;&apos;"
+*End
+
+*CloseGroup: FoomaticTest
+
+*OpenGroup: FoomaticOption8/Foomatic Option 8
+
+*OpenUI *FoomaticOption9/Foomatic Option 9: PickOne
+*FoomaticRIPOption FoomaticOption9: enum CmdLine D
+*OrderDependency: 393 AnySetup *FoomaticOption9
+*DefaultFoomaticOption9: FromFoomaticOption8
+*FoomaticOption9 FromFoomaticOption8/Controlled by 'Foomatic Option 8': "%% FoomaticRIPOptionSetting: FoomaticOption9=@FoomaticOption8"
+*FoomaticOption9 ChoiceA/Choice A: "%% FoomaticRIPOptionSetting: FoomaticOption9=ChoiceA"
+*FoomaticRIPOptionSetting FoomaticOption9=ChoiceA: " --option9=choiceA"
+*FoomaticOption9 ChoiceB/Choice B: "%% FoomaticRIPOptionSetting: FoomaticOption9=ChoiceB"
+*FoomaticRIPOptionSetting FoomaticOption9=ChoiceB: " --option9=choiceB"
+*FoomaticOption9 ChoiceC/Choice C: "%% FoomaticRIPOptionSetting: FoomaticOption9=ChoiceC"
+*FoomaticRIPOptionSetting FoomaticOption9=ChoiceC: " --option9=choiceC"
+*CloseUI: *FoomaticOption9
+
+*OpenUI *FoomaticOptionA/Foomatic Option A: PickOne
+*FoomaticRIPOption FoomaticOptionA: enum CmdLine D
+*OrderDependency: 394 AnySetup *FoomaticOptionA
+*DefaultFoomaticOptionA: FromFoomaticOption8
+*FoomaticOptionA FromFoomaticOption8/Controlled by 'Foomatic Option 8': "%% FoomaticRIPOptionSetting: FoomaticOption9=@FoomaticOption8"
+*FoomaticOptionA ChoiceD/Choice D: "%% FoomaticRIPOptionSetting: FoomaticOptionA=ChoiceD"
+*FoomaticRIPOptionSetting FoomaticOptionA=ChoiceD: " --optionA=choiceD"
+*FoomaticOptionA ChoiceE/Choice E: "%% FoomaticRIPOptionSetting: FoomaticOptionA=ChoiceE"
+*FoomaticRIPOptionSetting FoomaticOptionA=ChoiceE: " --optionA=choiceE"
+*FoomaticOptionA ChoiceF/Choice F: "%% FoomaticRIPOptionSetting: FoomaticOptionA=ChoiceF"
+*FoomaticRIPOptionSetting FoomaticOptionA=ChoiceF: " --optionA=choiceF"
+*CloseUI: *FoomaticOptionA
+
+*CloseGroup: FoomaticOption8
+
+*FoomaticRIPOption FoomaticOptionC: enum CmdLine D 396
+*FoomaticRIPOptionSetting FoomaticOptionC=FromFoomaticOptionB: ""
+*FoomaticRIPOptionSetting FoomaticOptionC=ChoiceA: " --optionC=choiceA"
+*FoomaticRIPOptionSetting FoomaticOptionC=ChoiceB: " --optionC=choiceB"
+*FoomaticRIPOptionSetting FoomaticOptionC=ChoiceC: " --optionC=choiceC"
+
+*FoomaticRIPOption FoomaticOptionD: enum CmdLine D 397
+*FoomaticRIPOptionSetting FoomaticOptionD=FromFoomaticOptionB: ""
+*FoomaticRIPOptionSetting FoomaticOptionD=ChoiceD: " --optionD=choiceD"
+*FoomaticRIPOptionSetting FoomaticOptionD=ChoiceE: " --optionD=choiceE"
+*FoomaticRIPOptionSetting FoomaticOptionD=ChoiceF: " --optionD=choiceF"
+
+
+*% Generic boilerplate PPD stuff as standard PostScript fonts and so on
+
+*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
+
diff --git a/test/lsbfuncs.sh b/test/lsbfuncs.sh
new file mode 100755
index 0000000..7ff8fb7
--- /dev/null
+++ b/test/lsbfuncs.sh
@@ -0,0 +1,387 @@
+# lsbfuncs.sh : LSB test suite specific common shell functions
+#
+##########################################################################
+# (C) Copyright 1998-2001 The Open Group
+#
+# All rights reserved. No part of this source code may be reproduced,
+# stored in a retrieval system, or transmitted, in any form or by any
+# means, electronic, mechanical, photocopying, recording or otherwise,
+# except as stated in the end-user licence agreement, without the prior
+# permission of the copyright owners.
+#
+# X/Open and the 'X' symbol are trademarks of X/Open Company Limited in
+# the UK and other countries.
+#
+# PROJECT: LSB-FHS
+# PRODUCT: LSB.fhs/SRC/lsblib/lsbfuncs.sh
+# AUTHOR: Andrew Josey, The Open Group
+# DATE CREATED: 21 Dec 1998
+##########################################################################
+
+# This is $Revision: 1.6 $
+#
+# $Log: lsbfuncs.sh,v $
+# Revision 1.6 2002/01/17 02:21:24 cyeoh
+# modifies lsb_test_symlink soboth symlink "from" and "to" are followed
+# for symlinks. This changes the behaviour such that if the "to" is
+# a symlink but "from" does point to what "to" points to then it returns
+# true.
+#
+# Revision 1.5 2001/07/20 11:49:47 ajosey
+# add further diagnostics
+#
+# Revision 1.4 2001/07/20 11:27:33 ajosey
+# add in more diagnostics to lsb_test_file
+#
+# Revision 1.3 2001/07/20 11:20:08 ajosey
+# add in diagnostic to lsb_test_file
+#
+# Revision 1.2 2001/07/18 06:58:55 ajosey
+# add header, and cvs revision stuff
+#
+#
+#Current contents
+# lsb_setarch()
+# lsb_test_symlink()
+# lsb_test_dir()
+# lsb_test_dir_searchable()
+# lsb_test_file()
+# lsb_test_exec
+# lsb_test_device_by_name()
+# These functions return the following codes
+#
+# PASS=0
+# FAIL=1
+# WARNING=2
+# UNRESOLVED=3
+#
+
+# lsb_setarch: sets the $lsb_arch environment variable to the
+# current architecture
+lsb_setarch()
+{
+ lsb_arch=`uname -m`
+ case $lsb_arch in
+ i?86) lsb_arch=i386;;
+ sparc) lsb_arch=sparc;;
+ *) lsb_arch=unknown;;
+ esac
+}
+
+# lsb_test_symlink symlink destination
+# Argument 1: symlink from name
+# Argument 2: to name
+# Returns
+# 0 = PASS, yes symlink points to destination
+# 1 = FAIL,
+# 3 = UNRESOLVED,Setup problem
+#
+# On a failure or setup problem a diagnostic message is omitted
+#
+# Calls lsblib routines:
+# lsb_realpath, lsb_issymlink
+#
+lsb_test_symlink() {
+ func_name=lsb_is_symlink
+ # validate that we have two arguments
+ if test $# -lt 2
+ then
+ echo "$func_name: Missing argument"; return 3 # unresolved
+ fi
+ from="$1"
+ to="$2"
+
+ # cannot use test -L as not in POSIX.2 so call wrapper
+ # that does an lstat()
+ lsb_issymlink $from
+ rval=$?
+ if test $rval -eq 3 # unresolved
+ then
+ return 3 # unresolved
+ fi
+ if ! test $rval -eq 0
+ then
+ if ! test -e $from
+ then
+ echo "$from does not exist (expected symlink to $to)"
+ return 1 # fail
+ else
+ echo "$from expected to be symlink to $to, returned non-symlink"
+ return 1 # fail
+ fi
+ else
+ # its a symlink so lets validate where it points to
+ # need to call realpath , which is a c program wrapping on realpath3c
+ pathptr=`lsb_realpath $from`
+ if test $? -ne 0
+ then
+ return 3 # unresolved
+ fi
+ pathptr_to=`lsb_realpath $to`
+ if test $? -ne 0
+ then
+ # Destination does not point anywhere
+ return 3 # unresolved
+ fi
+ if test "$pathptr" = "$pathptr_to"
+ then
+ return 0 # pass
+ else
+ echo "$from expected to be symlink to $to, pointed to $pathptr"
+ return 1 # fail
+ fi
+ fi
+}
+
+# lsb_test_dir filename
+# test for presence of a directory called filename
+# Argument: filename to test if its a directory
+# Returns: 0 PASS , it's a directory
+# 1 FAIL, its not a directory or a symlink
+# 2 WARNING its a symlink
+# 3 UNRESOLVED error
+lsb_test_dir() {
+ func_name=lsb_test_dir
+ # validate that we have one arguments
+ if test $# -lt 1
+ then
+ echo "$func_name: Missing argument"
+ return 3 # unresolved
+ fi
+
+ _fname=$1
+ # if it does not exist then fail
+ if ! test -e $_fname
+ then
+ tet_infoline "$_fname: directory not found"
+ return 1 # fail
+ fi
+
+ # since test -d will follow the symlink, we should check
+ # for a symlink using the lstat wrapper first
+ lsb_issymlink $_fname
+ rval=$?
+ if test $rval -eq 3 # unresolved
+ then
+ return 3 # unresolved
+ fi
+ if ! test $rval -eq 0
+ then
+ # not a symlink
+ if test -d $_fname
+ then
+ # success
+ return 0 # pass
+ else
+ # not a symlink and not a directory
+ tet_infoline "$_fname: not a directory or a symlink"
+ return 1 # fail
+ fi
+ else
+ # warning , its a symlink when we expected a directory
+ return 2 # warning
+ fi
+}
+# lsb_test_dir_searchable filename
+# test for presence of a directory and that it can be searched
+# Argument: filename
+# Returns: 0 PASS , it's a file and it exists
+# 1 FAIL, its not a file or a symlink
+# 3 UNRESOLVED error
+lsb_test_dir_searchable() {
+ func_name=lsb_test_dir_searchable
+ # validate that we have one arguments
+ if test $# -lt 1
+ then
+ echo "$func_name: Missing argument"
+ return 3
+ fi
+ lsb_test_dir $1
+ funcret=$?
+ if test $funcret -eq 0 -o $funcret -eq 2
+ then
+ ( ls $1 ) > /dev/null 2> _lsb.stderr
+ if test $? -ne 0
+ then
+ echo "$func_name: expected be able to search directory $1, got an error"
+ if test -s _lsb.stderr
+ then
+ cat _lsb.stderr
+ rm _lsb.stderr
+ fi
+ else
+ rm _lsb.stderr
+ return 0
+ fi
+
+ else
+ return $funcret
+ fi
+
+
+
+}
+# lsb_test_file filename
+# test for presence of a filename
+# Argument: filename
+# Returns: 0 PASS , it's a file and it exists
+# 1 FAIL, its not a file or a symlink
+# 2 WARNING its a symlink
+# 3 UNRESOLVED error
+lsb_test_file() {
+ func_name=lsb_test_file
+ # validate that we have one arguments
+ if test $# -lt 1
+ then
+ echo "$func_name: Missing argument"
+ return 3
+ fi
+ _fname=$1
+ # if it does not exist then fail
+ if ! test -e $_fname
+ then
+ tet_infoline "$_fname: file not found"
+ return 1
+ fi
+ # since test -f will follow the symlink, we should check
+ # for a symlink using the lstat wrapper first
+ lsb_issymlink $_fname
+ rval=$?
+ if test $rval -eq 3
+ then
+ return 3
+ fi
+ if ! test $rval -eq 0
+ then
+ # not a symlink
+ if test -f $_fname
+ then
+ # success
+ return 0
+ else
+ # not a symlink and not a file
+ tet_infoline "$_fname: not a file or a symlink"
+ return 1
+ fi
+ else
+ # warning , its a symlink when we expected a file
+ tet_infoline "$_fname: found a symlink"
+ return 2
+ fi
+}
+
+
+# lsb_test_exec:
+# check that a utility can be executed
+# if privilege is needed then an lsb_execwithpriv tool is used.
+#
+# if a utility needs an argument such as a file to parse that should be
+# supplied.
+# Returns:
+# 0 - PASS
+# 1 - Fail
+# 3 - Unresolved
+#
+
+lsb_test_exec()
+{
+
+test $# -eq 0 && return 3 # unresolved
+
+_ExecWithPriv=""
+if test "$1" = "lsb_execwithpriv"
+then
+ _ExecWithPriv="$1" ; shift
+ case "$1"
+ in
+ *) _ExecWithPriv="$_ExecWithPriv IGNORED_ARG" ; shift ;;
+ esac
+fi
+
+rm -f _ltexec.stderr > /dev/null 2>&1
+#( $_ExecWithPriv exec "$@" ) > /dev/null 2> _ltexec.stderr
+( $_ExecWithPriv exec "$@" )
+return $?
+
+#if test -s _ltexec.stderr
+#then
+# cat _ltexec.stderr
+# rm -f _ltexec.stderr
+# return 1 # fail
+#else
+# rm -f _ltexec.stderr
+# return 0 # pass
+#fi
+}
+
+# lsb_test_device_by_name name b|c major# minor#
+#
+# test whether a device exists, the type and the expected major and
+# minor number
+#
+# Calls :
+# lsb_devstat a wrapper to stat that when called with a device
+# name as the first argument outputs four space separated strings
+# device-name type majorno minorno
+#
+# Returns:
+# 0 PASS
+# 1 FAIL
+# 3 Unresolved
+
+lsb_test_device_by_name() {
+ func_name=lsb_test_device_by_name
+ # validate that we have one arguments
+ if test $# -lt 4
+ then
+ echo "$func_name: Missing argument(s)"
+ return 3 # unresolved
+ fi
+ _devname=$1
+ _devtype=$2
+ _major=$3
+ _minor=$4
+
+ case $_devtype in
+ b)
+ if ! test -b $_devname
+ then
+ return 1 # fail
+ fi ;;
+ c)
+ if ! test -c $_devname
+ then
+ return 1 # fail
+ fi ;;
+ *)
+ echo "$func_name: unknown device type argument ($_devtype)"
+ return 3 # unresolved
+ ;;
+ esac
+
+ _retval=`lsb_devstat $_devname`
+ set $_retval
+ if test "$1" = "$_devname" -a "$2" = "$_devtype" -a "$3" = "$_major" -a "$4" = "$_minor"
+ then
+ return 0 # pass
+ else
+ if ! test "$1" = "$_devname"
+ then
+ echo "$func_name: expected device name:\"$_devname\" got \"$1\""
+ fi
+ if ! test "$2" = "$_devtype"
+ then
+ echo "$func_name: expected device type: \"$_devtype\" got \"$2\""
+ fi
+ if ! test "$3" = "$_major"
+ then
+ echo "$func_name: expected major number: \"$_major\" got \"$3\""
+ fi
+ if ! test "$4" = "$_minor"
+ then
+ echo "$func_name: expected minor number: \"$_minor\" got \"$4\""
+ fi
+ return 1 # fail
+ fi
+
+}
diff --git a/test/shfuncs.sh b/test/shfuncs.sh
new file mode 100755
index 0000000..572273d
--- /dev/null
+++ b/test/shfuncs.sh
@@ -0,0 +1,187 @@
+# shfuncs : test suite common shell functions
+
+##########################################################################
+# (C) Copyright 1998-2001 The Open Group
+#
+# All rights reserved. No part of this source code may be reproduced,
+# stored in a retrieval system, or transmitted, in any form or by any
+# means, electronic, mechanical, photocopying, recording or otherwise,
+# except as stated in the end-user licence agreement, without the prior
+# permission of the copyright owners.
+#
+# X/Open and the 'X' symbol are trademarks of X/Open Company Limited in
+# the UK and other countries.
+#
+# PROJECT: LSB-FHS
+# PRODUCT: LSB.fhs/SRC/common/lsblib/shfuncs.sh
+# AUTHOR: Andrew Josey, The Open Group
+# DATE CREATED: 21 Dec 1998
+#
+# Derived from the TET demo test suites
+##########################################################################
+
+# This is $Revision: 1.2 $
+#
+# $Log: shfuncs.sh,v $
+# Revision 1.2 2001/07/18 06:58:55 ajosey
+# add header, and cvs revision stuff
+#
+
+
+tpstart() # write test purpose banner and initialise variables
+{
+ tet_infoline "$*"
+ FAIL=N
+}
+
+tpresult() # give test purpose result
+{
+ # $1 is result code to give if FAIL=N (default PASS)
+ if [ $FAIL = N ]
+ then
+ tet_result ${1-PASS}
+ else
+ tet_result FAIL
+ fi
+}
+
+check_exit() # execute command (saving output) and check exit code
+{
+ # $1 is command, $2 is expected exit code (0 or "N" for non-zero)
+ eval "$1" > out.stdout 2> out.stderr
+ CODE=$?
+ if [ $2 = 0 -a $CODE -ne 0 ]
+ then
+ tet_infoline "Command ($1) gave exit code $CODE, expected 0"
+ FAIL=Y
+ elif [ $2 != 0 -a $CODE -eq 0 ]
+ then
+ tet_infoline "Command ($1) gave exit code $CODE, expected non-zero"
+ FAIL=Y
+ fi
+}
+
+check_exit_value() # check that $1 equates $2
+{
+ CODE=$1
+ if [ $2 = 0 -a $CODE -ne 0 ]
+ then
+ tet_infoline "exit code $CODE returned, expected 0"
+ FAIL=Y
+ elif [ $2 != 0 -a $CODE -eq 0 ]
+ then
+ tet_infoline "exit code $CODE returned, expected non-zero"
+ FAIL=Y
+ fi
+}
+
+check_prep_exit_value() # check that $2 equates $3
+{
+ CODE=$2
+ if [ $3 = 0 -a $CODE -ne 0 ]
+ then
+ tet_infoline "$1 command returned exit code $CODE, expected 0"
+ FAIL=Y
+ elif [ $3 != 0 -a $CODE -eq 0 ]
+ then
+ tet_infoline "$1 command returned exit code $CODE, expected non-zero"
+ FAIL=Y
+ fi
+}
+
+check_nostdout() # check that nothing went to stdout
+{
+ if [ -s out.stdout ]
+ then
+ tet_infoline "Unexpected output written to stdout, as shown below:"
+ infofile out.stdout stdout:
+ FAIL=Y
+ fi
+}
+
+check_nostderr() # check that nothing went to stderr
+{
+ if [ -s out.stderr ]
+ then
+ tet_infoline "Unexpected output written to stderr, as shown below:"
+ infofile out.stderr stderr:
+ FAIL=Y
+ fi
+}
+
+check_stdout() # check that a string went to stdout
+{
+ case $1 in
+ "")
+ if [ ! -s out.stdout ]
+ then
+ tet_infoline "Expected output to stdout, but none written"
+ FAIL=Y
+ fi
+ ;;
+ *)
+ grep "$1" out.stdout 2>&1 >/dev/null
+ if [ $? -ne 0 ]
+ then
+ tet_infoline "Output written to stdout did not contain \"$1\", got below:"
+ infofile out.stdout stdout:
+ FAIL=Y
+ fi
+ ;;
+ esac
+}
+
+check_stderr() # check that stderr matches expected error
+{
+ # $1 is file containing regexp for expected error
+ # if no argument supplied, just check out.stderr is not empty
+
+ case $1 in
+ "")
+ if [ ! -s out.stderr ]
+ then
+ tet_infoline "Expected output to stderr, but none written"
+ FAIL=Y
+ fi
+ ;;
+ *)
+ expfile="$1"
+ OK=Y
+ exec 4<&0 0< "$expfile" 3< out.stderr
+ while read expline
+ do
+ if read line <&3
+ then
+ if expr "$line" : "$expline" > /dev/null
+ then
+ :
+ else
+ OK=N
+ break
+ fi
+ else
+ OK=N
+ fi
+ done
+ exec 0<&4 3<&- 4<&-
+ if [ $OK = N ]
+ then
+ tet_infoline "Incorrect output written to stderr, as shown below"
+ infofile "$expfile" "expected stderr:"
+ infofile out.stderr "received stderr:"
+ FAIL=Y
+ fi
+ ;;
+ esac
+}
+
+infofile() # write file to journal using tet_infoline
+{
+ # $1 is file name, $2 is prefix for tet_infoline
+
+ prefix=$2
+ while read line
+ do
+ tet_infoline "$prefix$line"
+ done < $1
+}
diff --git a/test/tcm.sh b/test/tcm.sh
new file mode 100755
index 0000000..d8d98cb
--- /dev/null
+++ b/test/tcm.sh
@@ -0,0 +1,571 @@
+#
+# SCCS: @(#)tcm.sh 1.17 (03/03/31)
+#
+# UniSoft Ltd., London, England
+#
+# (C) Copyright 1996 X/Open Company Limited
+#
+# All rights reserved. No part of this source code may be reproduced,
+# stored in a retrieval system, or transmitted, in any form or by any
+# means, electronic, mechanical, photocopying, recording or otherwise,
+# except as stated in the end-user licence agreement, without the prior
+# permission of the copyright owners.
+# A copy of the end-user licence agreement is contained in the file
+# Licence which accompanies this distribution.
+#
+# X/Open and the 'X' symbol are trademarks of X/Open Company Limited in
+# the UK and other countries.
+#
+# ************************************************************************
+
+# Copyright 1990 Open Software Foundation (OSF)
+# Copyright 1990 Unix International (UI)
+# Copyright 1990 X/Open Company Limited (X/Open)
+#
+# Permission to use, copy, modify, and distribute this software and its
+# documentation for any purpose and without fee is hereby granted, provided
+# that the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of OSF, UI or X/Open not be used in
+# advertising or publicity pertaining to distribution of the software
+# without specific, written prior permission. OSF, UI and X/Open make
+# no representations about the suitability of this software for any purpose.
+# It is provided "as is" without express or implied warranty.
+#
+# OSF, UI and X/Open DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+# EVENT SHALL OSF, UI or X/Open BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+#
+# ***********************************************************************
+#
+# SCCS: @(#)tcm.sh 1.17 03/31/03
+# NAME: Shell Test Case Manager
+# PRODUCT: TET (Test Environment Toolkit)
+# as supplied with TETware release 3.7
+# AUTHOR: Andrew Dingwall, UniSoft Ltd.
+# DATE CREATED: 1 November 1990
+#
+# DESCRIPTION:
+# This file contains the support routines for the sequencing and control
+# of invocable components and test purposes.
+# It should be sourced (by means of the shell . command) into a shell
+# script containing definitions of the invocable components and test
+# purposes that may be executed, after those definitions have been made.
+# Test purposes may be written as shell functions or executable
+# shell scripts.
+#
+# This file sources tetapi.sh which contains the shell API functions.
+# Test purposes written as separate shell scripts must also source
+# tetapi.sh in order to use those functions.
+#
+# The user-supplied shell variable iclist should contain a list of all
+# the invocable components in the testset;
+# these are named ic1, ic2 ... etc.
+# For each invocable component thus specified, the user should define
+# a variable whose name is the same as that of the component.
+# Each such variable should contain the names of the test purposes
+# associated with each invocable component; for example:
+# iclist="ic1 ic2"
+# ic1="test1-1 test1-2 test1-3"
+# ic2="test2-1 test2-2"
+#
+# The NUMBERS of the invocable components to be executed are specified
+# on the command line.
+# In addition, the user may define the variables tet_startup and
+# tet_cleanup; if defined, the related functions (or shell scripts)
+# are executed at the start and end of processing, respectively.
+#
+# The TCM makes the NAME of the currently executing test purpose
+# available in the environment variable tet_thistest.
+#
+# The TCM reads configuration variables from the file specified by the
+# TET_CONFIG environment variable; these are placed in the environment
+# and marked as readonly.
+#
+# MODIFICATIONS:
+#
+# Geoff Clare, 11 Oct 1991
+# Replace signal lists with markers to be edited by make INSTALL.
+# Remove local TET_VERSION to avoid conflict with env. variable.
+#
+# Geoff Clare, 29 Jan 1992
+# Implement TET_TRAP_FUNCTION in place of tet_setsigs(), and
+# TET_DEFAULT_SIGS in place of tet_defaultsigs().
+#
+# Andrew Dingwall, 18 Jan 1993
+# Reset block and sequence number to 1 before each
+# test purpose is executed.
+#
+# Geoff Clare, UniSoft Ltd., August 1996
+# Make TP number unique over test case, not just IC.
+# Get default TET_NSIG from makefile.
+#
+# Geoff Clare, UniSoft Ltd., 3 Sept 1996
+# Only give non-existent IC message for requested IC
+# numbers (not for ICs executed via an "all" in the IC list).
+#
+# Andrew Dingwall, UniSoft Ltd., October 1996
+# Port to NT
+#
+# ***********************************************************************
+
+#
+# TCM signal definitions
+# The XXX_SIGNAL_LIST markers are replaced with proper lists by make INSTALL
+#
+
+# standard signals - may not be specified in TET_SIG_IGN and TET_SIG_LEAVE
+TET_STD_SIGNALS="1 2 3 4 6 8 13 14 15 10 12 20 18 21 22"
+
+# signals that are always unhandled
+TET_SPEC_SIGNALS="9 17 19 11"
+
+#
+# TCM global variables
+#
+
+tet_thistest=""; export tet_thistest
+
+#
+# "private" TCM variables
+#
+
+TET_CWD=`pwd`
+TET_OSNAME=`uname -s`; readonly TET_OSNAME; export TET_OSNAME
+TET_DELETES=$TET_CWD/tet_deletes; readonly TET_DELETES; export TET_DELETES
+TET_RESFILE=$TET_CWD/tet_xres; readonly TET_RESFILE; export TET_RESFILE
+TET_STDERR=$TET_CWD/tet_stderr; readonly TET_STDERR; export TET_STDERR
+TET_TESTS=$TET_CWD/tet_tests; readonly TET_TESTS
+TET_TMPFILES=$TET_CWD/tet_tmpfiles; readonly TET_TMPFILES
+TET_TMPRES=$TET_CWD/tet_tmpres; readonly TET_TMPRES; export TET_TMPRES
+
+TET_BLOCK=0; export TET_BLOCK
+TET_CONTEXT=0; export TET_CONTEXT
+TET_EXITVAL=0
+TET_SEQUENCE=0; export TET_SEQUENCE
+TET_TPCOUNT=0; export TET_TPCOUNT
+TET_TPNUMBER=0; export TET_TPNUMBER
+
+TET_TMP1=$TET_CWD/tet1.$$
+TET_TMP2=$TET_CWD/tet2.$$
+
+# ***********************************************************************
+
+#
+# "private" TCM function definitions
+# these interfaces may go away one day
+#
+
+# tet_ismember - return 0 if $1 is in the set $2 ...
+# otherwise return 1
+tet_ismember(){
+ TET_X=${1:?}
+ shift
+ for TET_Y in $*
+ do
+ if test 0$TET_X -eq $TET_Y
+ then
+ return 0
+ fi
+ done
+ return 1
+}
+
+
+# tet_abandon - signal handler used during startup and cleanup
+tet_abandon(){
+ TET_CAUGHTSIG=$1
+ if test 15 -eq ${TET_CAUGHTSIG:?}
+ then
+ tet_sigterm $TET_CAUGHTSIG
+ else
+ tet_error "Abandoning testset: caught unexpected signal $TET_CAUGHTSIG"
+ fi
+ TET_EXITVAL=$TET_CAUGHTSIG exit
+}
+
+# tet_sigterm - signal handler for SIGTERM
+tet_sigterm(){
+ TET_CAUGHTSIG=$1
+ tet_error "Abandoning test case: received signal ${TET_CAUGHTSIG:?}"
+ tet_docleanup
+ TET_EXITVAL=$TET_CAUGHTSIG exit
+}
+
+# tet_sigskip - signal handler used during test execution
+tet_sigskip(){
+ TET_CAUGHTSIG=$1
+ tet_infoline "unexpected signal ${TET_CAUGHTSIG:?} received"
+ tet_result UNRESOLVED
+ if test 15 -eq ${TET_CAUGHTSIG:?}
+ then
+ tet_sigterm $TET_CAUGHTSIG
+ else
+ continue
+ fi
+}
+
+# tet_tpend - report on a test purpose
+tet_tpend(){
+ TET_TPARG1=${1:?}
+ TET_RESULT=
+ eval `(
+ while read TET_NEXTRES
+ do
+ if test -z "$TET_RESULT"
+ then
+ TET_RESULT="$TET_NEXTRES"
+ continue
+ fi
+ case "$TET_NEXTRES" in
+ PASS)
+ ;;
+ FAIL)
+ TET_RESULT="$TET_NEXTRES"
+ ;;
+ UNRESOLVED|UNINITIATED)
+ if test FAIL != "$TET_RESULT"
+ then
+ TET_RESULT="$TET_NEXTRES"
+ fi
+ ;;
+ NORESULT)
+ if test FAIL != "$TET_RESULT" -a \
+ UNRESOLVED != "$TET_RESULT" -a \
+ UNINITIATED != "$TET_RESULT"
+ then
+ TET_RESULT="$TET_NEXTRES"
+ fi
+ ;;
+ UNSUPPORTED|NOTINUSE|UNTESTED)
+ if test PASS = "$TET_RESULT"
+ then
+ TET_RESULT="$TET_NEXTRES"
+ fi
+ ;;
+ *)
+ if test PASS = "$TET_RESULT" -o \
+ UNSUPPORTED = "$TET_RESULT" -o \
+ NOTINUSE = "$TET_RESULT" -o \
+ UNTESTED = "$TET_RESULT"
+ then
+ TET_RESULT="$TET_NEXTRES"
+ fi
+ ;;
+ esac
+ done
+ echo TET_RESULT=\"$TET_RESULT\"
+ ) < $TET_TMPRES`
+
+ > $TET_TMPRES
+
+ TET_ABORT=NO
+ if test -z "$TET_RESULT"
+ then
+ TET_RESULT=NORESULT
+ TET_RESNUM=7
+ elif tet_getcode "$TET_RESULT" # sets TET_RESNUM, TET_ABORT
+ then
+ : ok
+ else
+ TET_RESULT="NO RESULT NAME"
+ TET_RESNUM=-1
+ fi
+
+ tet_output 220 "$TET_TPARG1 $TET_RESNUM `date +%H:%M:%S`" "$TET_RESULT"
+
+ if test YES = "$TET_ABORT"
+ then
+ TET_TRAP_FUNCTION=tet_abandon
+ tet_output 510 "" \
+ "ABORT on result code $TET_RESNUM \"$TET_RESULT\""
+ if test -n "$tet_cleanup"
+ then
+ tet_docleanup
+ fi
+ TET_EXITVAL=1 exit
+ fi
+}
+
+# tet_docleanup - execute the tet_cleanup function
+tet_docleanup(){
+ tet_thistest=
+ TET_TPCOUNT=0
+ TET_BLOCK=0
+ tet_setblock
+ eval $tet_cleanup
+}
+
+# ***********************************************************************
+
+# read in API functions
+. ./tetapi.sh
+
+
+# ***********************************************************************
+
+
+#
+# TCM main flow
+#
+
+# capture command line args before they disappear
+TET_TCM_ARGC=$#
+TET_TCM_ARGS="$*"
+TET_PNAME="$0"; readonly TET_PNAME; export TET_PNAME
+
+# arrange to clean up on exit
+rm -f $TET_TMPFILES
+> $TET_TMPFILES
+trap 'rm -f `cat $TET_TMPFILES` $TET_TMPFILES; exit $TET_EXITVAL' 0
+trap exit 1 2 3 15
+
+# open execution results file
+(umask 0; rm -f $TET_RESFILE; > $TET_RESFILE) || TET_EXITVAL=1 exit
+
+# open other local files
+for TET_A in $TET_DELETES $TET_STDERR $TET_TESTS \
+ $TET_TMP1 $TET_TMPRES
+do
+ rm -f $TET_A
+ echo $TET_A >> $TET_TMPFILES
+ > $TET_A
+done
+
+# read in configuration variables and make them readonly
+# strip comments and other non-variable assignments
+# protect embedded spaces and single quotes in the value part
+if test -n "$TET_CONFIG"
+then
+ if test ! -r "$TET_CONFIG"
+ then
+ tet_error "can't read config file" $TET_CONFIG
+ else
+ sed "/^#/d; /^[ ]*\$/d; /^[^ ][^ ]*=/!d;
+ s/'/'\\\\''/g; s/\([^=]*\)=\(.*\)/\1='\2'/; p;
+ s/\([^=]*\)=.*/readonly \1/" $TET_CONFIG > $TET_TMP1
+ . $TET_TMP1
+ fi
+fi
+
+# set current context to process ID
+tet_setcontext
+
+# set up default results code file if so required
+if test ! -r ${TET_CODE:=tet_code}
+then
+ if test tet_code != "$TET_CODE"
+ then
+ tet_error "could not open results code file" \"$TET_CODE\"
+ fi
+ echo $TET_TMP2 >> $TET_TMPFILES
+ echo "
+0 PASS Continue
+1 FAIL Continue
+2 UNRESOLVED Continue
+3 NOTINUSE Continue
+4 UNSUPPORTED Continue
+5 UNTESTED Continue
+6 UNINITIATED Continue
+7 NORESULT Continue" > $TET_TMP2
+ TET_CODE=$TET_TMP2
+fi
+
+# determine the full path name of the results code file
+case $TET_OSNAME in
+Windows_*)
+ case $TET_CODE in
+ [A-Za-z]:/*)
+ ;;
+ *)
+ TET_CODE=`pwd`/$TET_CODE
+ ;;
+ esac
+ ;;
+*)
+ case $TET_CODE in
+ /*)
+ ;;
+ *)
+ TET_CODE=`pwd`/$TET_CODE
+ ;;
+ esac
+ ;;
+esac
+
+readonly TET_CODE; export TET_CODE
+
+# process command-line args
+if test 1 -gt $TET_TCM_ARGC
+then
+ TET_TCM_ARGS=all
+fi
+TET_ICLAST=-1
+TET_ICLIST="`echo $iclist | tr -cd ' 0123456789'`"
+: ${TET_ICLIST:=0}
+TET_ICFIRST_DEF=`echo $TET_ICLIST | sed 's/ .*//'`
+for TET_A in `echo $TET_TCM_ARGS | tr , ' '`
+do
+ case $TET_A in
+ all*)
+ if test 0 -ge $TET_ICLAST
+ then
+ TET_ICFIRST=$TET_ICFIRST_DEF
+ for TET_B in $TET_ICLIST
+ do
+ if test $TET_B -le $TET_ICFIRST
+ then
+ TET_ICFIRST=$TET_B
+ fi
+ done
+ else
+ TET_ICFIRST=`expr $TET_ICLAST + 1`
+ fi
+ TET_ICLAST=$TET_ICFIRST
+ for TET_B in $TET_ICLIST
+ do
+ if test $TET_B -gt $TET_ICLAST
+ then
+ TET_ICLAST=$TET_B
+ fi
+ done
+ if test $TET_ICLAST -gt ${TET_B:=0}
+ then
+ TET_ICLAST=$TET_B
+ fi
+ ;;
+ *)
+ eval `echo $TET_A | sed 'h; s/^\([0-9]*\).*/TET_ICFIRST=\1/;
+ p; g; s/^[^\-]*-*//; s/^\([0-9]*\).*/TET_ICLAST=\1/'`
+ ;;
+ esac
+ TET_ICNO=${TET_ICFIRST:-$TET_ICFIRST_DEF}
+ while test $TET_ICNO -le ${TET_ICLAST:=$TET_ICNO}
+ do
+ if tet_ismember $TET_ICNO $TET_ICLIST
+ then
+ test -n "`eval echo \\${ic$TET_ICNO}`" && \
+ echo ic$TET_ICNO
+ else
+ # only report if the IC was requested
+ case $TET_A in
+ all*) ;;
+ *) tet_error "IC $TET_ICNO is not defined" \
+ "for this test case"
+ esac
+ fi
+ TET_ICNO=`expr $TET_ICNO + 1`
+ done >> $TET_TESTS
+done
+TET_ICCOUNT=`wc -l < $TET_TESTS | tr -cd 0123456789`
+
+# print startup message to execution results file
+tet_output 15 "3.7 $TET_ICCOUNT" "TCM Start"
+
+# do initial signal list processing
+for TET_A in TET_SIG_LEAVE TET_SIG_IGN
+do
+ echo ${TET_A}2=\"
+ eval echo \$$TET_A | tr , '\012' | while read TET_B TET_JUNK
+ do
+ if test -z "$TET_B"
+ then
+ continue
+ elif tet_ismember $TET_B $TET_STD_SIGNALS $TET_SPEC_SIGNALS
+ then
+ tet_error "warning: illegal entry $TET_B" \
+ "in $TET_A ignored"
+ else
+ echo $TET_B
+ fi
+ done
+ echo \"
+done > $TET_TMP1
+. $TET_TMP1
+TET_SIG_LEAVE2="$TET_SIG_LEAVE2 $TET_SPEC_SIGNALS"
+TET_A=1
+# The NSIG marker is edited by the makefile, but allow TET_NSIG to
+# be overridden from the config file (or environment).
+if test -z "$TET_NSIG"
+then
+ TET_NSIG="32"
+fi
+TET_TRAP_FUNCTION=tet_abandon
+TET_DEFAULT_SIGS=
+while test $TET_A -lt $TET_NSIG
+do
+ if tet_ismember $TET_A $TET_SIG_LEAVE2
+ then
+ :
+ elif tet_ismember $TET_A $TET_SIG_IGN2
+ then
+ trap "" $TET_A
+ else
+ trap "trap \"\" $TET_A; \$TET_TRAP_FUNCTION $TET_A" $TET_A
+ TET_DEFAULT_SIGS="$TET_DEFAULT_SIGS $TET_A"
+ fi
+ TET_A=`expr $TET_A + 1`
+done
+
+# calculate starting TP number for each IC
+TET_A=
+for TET_B in $TET_ICLIST
+do
+ # TET_A holds concatenation of TP lists for all previous ICs
+ set -- $TET_A
+ eval TET_TP_ADDNUM_$TET_B=$#
+ eval TET_A=\"\$TET_A \$ic$TET_B\"
+done
+
+# do startup processing
+eval $tet_startup
+
+# do main loop processing
+for TET_ICNAME in `cat $TET_TESTS`
+do
+ eval TET_TPLIST=\"\$$TET_ICNAME\"
+ TET_ICNUMBER=`echo $TET_ICNAME | tr -cd '0123456789'`
+ TET_TPCOUNT=`(set -- $TET_TPLIST; echo $#)`
+ tet_output 400 "$TET_ICNUMBER $TET_TPCOUNT `date +%H:%M:%S`" "IC Start"
+ TET_TPCOUNT=0
+ for tet_thistest in $TET_TPLIST
+ do
+ TET_BLOCK=1
+ TET_SEQUENCE=1
+ TET_TPCOUNT=`expr $TET_TPCOUNT + 1`
+ eval TET_TPNUMBER=\`expr \$TET_TP_ADDNUM_$TET_ICNUMBER + $TET_TPCOUNT\`
+ tet_output 200 "$TET_TPNUMBER `date +%H:%M:%S`" "TP Start"
+ > $TET_TMPRES
+ TET_REASON="`tet_reason $tet_thistest`"
+ if test $? -eq 0
+ then
+ tet_infoline "$TET_REASON"
+ tet_result UNINITIATED
+ else
+ TET_TRAP_FUNCTION=tet_sigskip
+ (
+ trap $TET_DEFAULT_SIGS
+ unset TET_DEFAULT_SIGS
+ "$tet_thistest"
+ )
+ fi
+ tet_tpend $TET_TPNUMBER
+ done
+ TET_TPNUMBER=0
+ tet_output 410 "$TET_ICNUMBER $TET_TPCOUNT `date +%H:%M:%S`" "IC End"
+done
+
+# do cleanup processing
+TET_TRAP_FUNCTION=tet_abandon
+if test -n "$tet_cleanup"
+then
+ tet_docleanup
+fi
+
+# successful exit
+TET_EXITVAL=0 exit
+
diff --git a/test/testfoomaticrip b/test/testfoomaticrip
new file mode 100755
index 0000000..5de100c
--- /dev/null
+++ b/test/testfoomaticrip
@@ -0,0 +1,564 @@
+#!/bin/sh
+# -------------------------------------------------
+# LSB test for presence and functionality of foomatic-rip
+# -------------------------------------------------
+# Modification History:
+# 11/15/2007 - Till Kamppeter - till.kamppeter@gmail.com
+# -------------------------------------------------
+tet_startup="startup" # startup function
+tet_cleanup="cleanup" # cleanup function
+iclist="ic1 ic2 ic3 ic4 ic5 ic6 ic7 ic8 ic9 ic10 ic11 ic12 ic13"
+ic1="tp1"
+ic2="tp2"
+ic3="tp3"
+ic4="tp4"
+ic5="tp5"
+ic6="tp6"
+ic7="tp7"
+ic8="tp8"
+ic9="tp9"
+ic10="tp10"
+ic11="tp11"
+ic12="tp12"
+ic13="tp13"
+
+FOOMATICRIP=`which foomatic-rip`
+export PPD=`pwd`"/foomatic-test.ppd"
+INPUTFILE=`pwd`"/foomatic-test-input-ps.ps"
+IFILE=$INPUTFILE
+BASECMDLINE="$FOOMATICRIP --ppd $PPD -o FilterPath="`pwd`"/"
+PREVCMDLINE=''
+HOSTNAME=`hostname`
+JOBTITLE="$USER@$HOSTNAME"
+PRIVATECUPSDIR="../../../cups"
+if [ -x $PRIVATECUPSDIR/sbin/cupsd ]; then
+ PSTOPS="$PRIVATECUPSDIR/lib/cups/filter/pstops"
+ CUPSDCONF="$PRIVATECUPSDIR/etc/cups/cupsd.conf"
+ CUPSINIT1="xxx"
+ CUPSINIT2="xxx"
+ CUPSD="cupsd"
+ LPADMIN="$PRIVATECUPSDIR/sbin/lpadmin"
+ LPSTAT="$PRIVATECUPSDIR/bin/lpstat"
+ LPR="$PRIVATECUPSDIR/bin/lpr"
+elif cups-config --version > /dev/null 2>&1; then
+ PSTOPS=`cups-config --serverbin`"/filter/pstops"
+ CUPSDCONF=`cups-config --serverroot`"/cupsd.conf"
+ CUPSINIT1="/etc/init.d/cups"
+ CUPSINIT2="/etc/init.d/cupsys"
+ CUPSD="cupsd"
+ LPADMIN="lpadmin"
+ LPSTAT="lpstat"
+ LPR="lpr"
+else
+ PSTOPS="/usr/lib/cups/filter/pstops"
+ CUPSDCONF="/etc/cups/cupsd.conf"
+ CUPSINIT1="/etc/init.d/cups"
+ CUPSINIT2="/etc/init.d/cupsys"
+ CUPSD="cupsd"
+ LPADMIN="lpadmin"
+ LPSTAT="lpstat"
+ LPR="lpr"
+fi
+if cups-config --version > /dev/null 2>&1; then
+ CUPSFILTER=`cups-config --serverbin`"/filter"
+else
+ CUPSFILTER="/usr/lib/cups/filter"
+fi
+
+tp1() {
+ tpstart "Reference III.8.1"
+ tet_infoline "The implementation provides an exec-able version"
+ tet_infoline "of the foomatic-rip command in the PATH and in"
+ tet_infoline "the system's CUPS filter directory (symlink)"
+ test -x $FOOMATICRIP 2>out.stderr
+ check_exit_value $? 0
+ check_nostderr
+ test -x "$CUPSFILTER/foomatic-rip" 2>out.stderr
+ check_exit_value $? 0
+ check_nostderr
+ tpresult # set result code
+}
+
+tp2() {
+ tpstart "Reference III.8.2"
+ tet_infoline "foomatic-rip inserts standard PPD options correctly into"
+ tet_infoline "the PostScript data stream."
+ test_foomatic_rip 'Option1 (PostScript) inserted' '' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option1\s+Choice2\s*[\n\r]+\s*\<\<\/HWResolution \[1200 600\]\>\> setpagedevice \% Option1: Choice2\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'Option2 (PostScript) inserted' '' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option2\s+Choice3\s*[\n\r]+\s*\% Option2: Choice3[\n\r]+ \<\<\/Test \[Example3\]\>\> setpagedevice[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'Option3 (PostScript) inserted' '' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option3\s+Choice1\s*[\n\r]+\s*\% Option3: Choice1\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'Option4 (PostScript) inserted' '' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option4\s+Choice1\s*[\n\r]+\s*\% Option4: Choice1\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'Option5 (PostScript) inserted' '' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option5\s+Choice1\s*[\n\r]+\s*\% Option5: Choice1\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'Option6 (PJL) inserted' '' \
+ '\@PJL\s+SET\s+TEST6=CHOICE1\s*[\n\r]+'
+ test_foomatic_rip 'Option7 (PostScript) inserted' '' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option7\s+\S+\s*[\n\r]+\s*\% Option7: True\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'Option8 (PostScript) inserted' '' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option8\s+\S+\s*[\n\r]+\s*\% Option8: False\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ tpresult # set result code
+}
+
+tp3() {
+ tpstart "Reference III.8.2"
+ tet_infoline "foomatic-rip inserts standard PPD options into the correct"
+ tet_infoline "sections of a DSC-compliant PostScript file and withing the"
+ tet_infoline "sections also in the correct order."
+ test_foomatic_rip 'JCLSetup: Option6' '' \
+ '\%\-12345X\@PJL' \
+ '\@PJL\s+SET\s+TEST6=CHOICE\d' \
+ '\%\!PS'
+ test_foomatic_rip 'Prolog: Option5' '' \
+ '\%\%BeginProlog' \
+ '\%\%BeginFeature:\s*\*Option5\s+Choice\d' \
+ '\%\%EndProlog'
+ test_foomatic_rip 'Setup: PageSize Option1 Option7 Option8 Option2 Option3' '' \
+ '\%\%BeginSetup' \
+ '\%\%BeginFeature:\s*\*PageSize\s+\S+' \
+ '\%\%BeginFeature:\s*\*Option1\s+\S+' \
+ '\%\%BeginFeature:\s*\*Option7\s+\S+' \
+ '\%\%BeginFeature:\s*\*Option8\s+\S+' \
+ '\%\%BeginFeature:\s*\*Option2\s+\S+' \
+ '\%\%BeginFeature:\s*\*Option3\s+\S+' \
+ '\%\%EndSetup'
+ test_foomatic_rip 'PageSetup: Page 1: Option4, Page 2: Option4, Page 3: Option4, Page 4: Option4' '' \
+ '\%\%Page:\s*1\s+1' \
+ '\%\%BeginFeature:\s*\*Option4\s+Choice\d' \
+ 'gsave' \
+ '\%\%Page:\s*2\s+2' \
+ '\%\%BeginFeature:\s*\*Option4\s+Choice\d' \
+ 'gsave' \
+ '\%\%Page:\s*3\s+3' \
+ '\%\%BeginFeature:\s*\*Option4\s+Choice\d' \
+ 'gsave' \
+ '\%\%Page:\s*4\s+4' \
+ '\%\%BeginFeature:\s*\*Option4\s+Choice\d' \
+ 'gsave'
+ tpresult # set result code
+}
+
+tp4() {
+ tpstart "Reference III.8.2"
+ tet_infoline "foomatic-rip applies user-supplied option settings when"
+ tet_infoline "inserting PPD option code"
+ test_foomatic_rip 'Option1 (PostScript) with setting Choice1 inserted' \
+ '-o Option1=Choice1' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option1\s+Choice1\s*[\n\r]+\s*\<\<\/HWResolution \[1200 1200\]\>\> setpagedevice \% Option1: Choice1\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'Option4 (PostScript) with setting Choice3 inserted for all 4 pages' \
+ '-o Option4=Choice3' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option4\s+Choice3\s*[\n\r]+\s*\% Option4: Choice3\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option4\s+Choice3\s*[\n\r]+\s*\% Option4: Choice3\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option4\s+Choice3\s*[\n\r]+\s*\% Option4: Choice3\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option4\s+Choice3\s*[\n\r]+\s*\% Option4: Choice3\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'Option6 (PJL) with Choice2 inserted' \
+ '-o Option6=Choice2' \
+ '\@PJL\s+SET\s+TEST6=CHOICE2\s*[\n\r]+'
+ test_foomatic_rip 'Option7 (PostScript) with setting False inserted' \
+ '-o Option7=False' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option7\s+\S+\s*[\n\r]+\s*\% Option7: False\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'Option8 (PostScript) with setting True inserted' \
+ '-o Option8=True' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option8\s+\S+\s*[\n\r]+\s*\% Option8: True\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'Option1 (PostScript) inserted, invalid setting Choice4 ignored' \
+ '-o Option1=Choice4' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option1\s+Choice2\s*[\n\r]+\s*\<\<\/HWResolution \[1200 600\]\>\> setpagedevice \% Option1: Choice2\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ tpresult # set result code
+}
+
+tp5() {
+ tpstart "Reference III.8.2"
+ tet_infoline "foomatic-rip applies option settings to the renderer"
+ tet_infoline "command line"
+ test_foomatic_rip 'Renderer command line with arguments controlled by PPD options: FoomaticOption1 FoomaticOption7 FoomaticOption8 FoomaticOptionB FoomaticOptionE, check for presence, correct value, and order' \
+ '' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice1[^\n\r]* --FoomaticOption7[^\n\r]* --option9=choiceC[^\n\r]* --optionA=choiceF[^\n\r]* --optionC=choiceB[^\n\r]* --optionD=choiceE[^\n\r]* --FoomaticOptionE'
+ test_foomatic_rip 'Changed settings: FoomaticOption1=Choice3' \
+ '-o FoomaticOption1=Choice3' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice3[^\n\r]* --FoomaticOption7[^\n\r]* --option9=choiceC[^\n\r]* --optionA=choiceF[^\n\r]* --optionC=choiceB[^\n\r]* --optionD=choiceE[^\n\r]* --FoomaticOptionE'
+ tpresult
+}
+
+tp6() {
+ tpstart "Reference III.8.2"
+ tet_infoline "foomatic-rip supports composite options, where one option"
+ tet_infoline "sets all member options"
+ test_foomatic_rip 'Composite options: FoomaticOption8 (Members FoomaticOption9 FoomaticOptionA), FoomaticOptionB (Members: FoomaticOptionC FoomaticOptionD)' \
+ '' \
+ 'foomatic-test-renderer[^\n\r]* --option9=choiceC[^\n\r]* --optionA=choiceF[^\n\r]* --optionC=choiceB[^\n\r]* --optionD=choiceE'
+ test_foomatic_rip 'Changing FoomaticOption8' \
+ '-o FoomaticOption8=Choice1' \
+ 'foomatic-test-renderer[^\n\r]* --option9=choiceA[^\n\r]* --optionA=choiceD[^\n\r]* --optionC=choiceB[^\n\r]* --optionD=choiceE'
+ test_foomatic_rip 'Changing FoomaticOptionB' \
+ '-o FoomaticOptionB=Choice1' \
+ 'foomatic-test-renderer[^\n\r]* --option9=choiceC[^\n\r]* --optionA=choiceF[^\n\r]* --optionC=choiceA[^\n\r]* --optionD=choiceD'
+ test_foomatic_rip 'FoomaticOption8 is a normal composite option, member options can be set individually' \
+ '-o FoomaticOption9=ChoiceB' \
+ 'foomatic-test-renderer[^\n\r]* --option9=choiceB[^\n\r]* --optionA=choiceF[^\n\r]* --optionC=choiceB[^\n\r]* --optionD=choiceE'
+ test_foomatic_rip 'FoomaticOptionB is a forced composite option, member options exist but are not advertized in GUIs' \
+ '-o FoomaticOptionD=ChoiceF' \
+ 'foomatic-test-renderer[^\n\r]* --option9=choiceC[^\n\r]* --optionA=choiceF[^\n\r]* --optionC=choiceB[^\n\r]* --optionD=choiceF'
+ tpresult
+}
+
+tp7() {
+ tpstart "Reference III.8.2"
+ tet_infoline "String and password options allow (nearly) arbitrary strings"
+ test_foomatic_rip 'FoomaticOption3 is a string option' \
+ '' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption3\s+Choice1\s*[\n\r]+\s*\% FoomaticOption3: Choice1\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'FoomaticOption3: Another predefined choice (Choice2)' \
+ '-o FoomaticOption3=Choice2' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption3\s+Choice2\s*[\n\r]+\s*\% FoomaticOption3: Choice2\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'FoomaticOption3: A freely chosen string (DFhj_3-4)' \
+ '-o FoomaticOption3=DFhj_3-4' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption3\s+DFhj_3-4\s*[\n\r]+\s*\% FoomaticOption3: DFhj_3-4\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'FoomaticOption3: Too many characters (DFhj_3-45)' \
+ '-o FoomaticOption3=DFhj_3-45' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption3\s+Choice1\s*[\n\r]+\s*\% FoomaticOption3: Choice1\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'FoomaticOption3: Invalid characters (DFhj;3:4)' \
+ '-o FoomaticOption3=DFhj;3:4' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption3\s+Choice1\s*[\n\r]+\s*\% FoomaticOption3: Choice1\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'FoomaticOption4 is a password option (same as string, but GUIs hide input)' \
+ '' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption4\s+Choice1\s*[\n\r]+\s*\% FoomaticOption4: Choice1\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'FoomaticOption4: Valid string (DFhj3545)' \
+ '-o FoomaticOption4=DFhj3545' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption4\s+DFhj3545\s*[\n\r]+\s*\% FoomaticOption4: DFhj3545\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'FoomaticOption4: String does not match regexp (DFhj;3:4)' \
+ '-o FoomaticOption4=DFhj;3:4' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption4\s+Choice1\s*[\n\r]+\s*\% FoomaticOption4: Choice1\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ tpresult
+}
+
+tp8() {
+ tpstart "Reference III.8.2"
+ tet_infoline "Numerical options allow any value in the range"
+ test_foomatic_rip 'FoomaticOption6 is a floating point numerical option, default 1.2 is not under the given choices' \
+ '' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption6\s+1.20*\s*[\n\r]+\s*\% FoomaticOption6: \s*1.20*\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'FoomaticOption6 set to -2.2, also not under the given choices' \
+ '-o FoomaticOption6=-2.2' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption6\s+\-2.20*\s*[\n\r]+\s*\% FoomaticOption6: \s*\-2.20*\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'FoomaticOption6 set to -4.6, value out of range, therefore ignored.' \
+ '-o FoomaticOption6=-4.6' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption6\s+1.20*\s*[\n\r]+\s*\% FoomaticOption6: \s*1.20*\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'FoomaticOption6 set to 10, also out of range.' \
+ '-o FoomaticOption6=10' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption6\s+1.20*\s*[\n\r]+\s*\% FoomaticOption6: \s*1.20*\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'FoomaticOption5 is an integer numerical option, default is 2' \
+ '' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption5\s+2\s*[\n\r]+\s*\% FoomaticOption5: \s*2\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'FoomaticOption5 set to -7' \
+ '-o FoomaticOption5=-7' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption5\s+\-7\s*[\n\r]+\s*\% FoomaticOption5: \s*\-7\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_foomatic_rip 'FoomaticOption5 set to 6.7, the digits after the decimal point get cut off.' \
+ '-o FoomaticOption5=6.7' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption5\s+6\S*\s*[\n\r]+\s*\% FoomaticOption5: \s*6\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ tpresult
+}
+
+tp9() {
+ tpstart "Reference III.8.2"
+ tet_infoline "Disabled per Bug 1841 (http://bugs.linuxbase.org/show_bug.cgi?id=1841)"
+ tpresult UNTESTED
+ return
+ tet_infoline "Special entities get substituted by job parameters"
+ test_foomatic_rip 'Job parameters' \
+ '' \
+ 'foomatic-test-renderer[^\n\r]* --FoomaticOptionE --user='$USER' --host='$HOSTNAME' --title='$USER'\@'$HOSTNAME' --copies=1 --options=\(FilterPath=[^\n\r]* \) --date=\d\d\/\d\d\/\d+ --time=\d\d\:\d\d\:\d\d --special=\&\<\>\"'
+ tpresult
+}
+
+tp10() {
+ tpstart "Reference III.8.2"
+ tet_infoline "PJL options from the PPD file get merged into PJL header"
+ tet_infoline "generated by the printer driver"
+ test_foomatic_rip 'FoomaticOption2 (PJL) inserted' '' \
+ '\@PJL\s+SET\s+TEST2=CHOICE1\s*[\n\r]+'
+ test_foomatic_rip 'Option6 and FoomaticOption2 (both PJL) merged into driver-generated PJL header' \
+ '-o FoomaticPJLMergeTest=DriverPJL' \
+ '\%-12345X\@PJL\s+SET\s+TEST2=CHOICE1\s*[\n\r]+\s*\@PJL\s+SET\s+TEST6=CHOICE1\s*[\n\r]+\s*\@PJL\s+SET\s+RESOLUTION=600\s*[\n\r]+\s*\@PJL\s+ENTER\s+LANGUAGE=POSTSCRIPT\s*[\n\r]+'
+ tpresult
+}
+
+tp11() {
+ tpstart "Reference III.8.2"
+ tet_infoline "Option settings can be applied to selected pages"
+ tet_infoline "(page overrides)"
+ test_foomatic_rip 'PageSetup: Page 1: Option4=Choice1, Page 2: Option4=Choice1, Page 3: Option4=Choice3, Page 4: Option4=Choice1' \
+ '-o 3:Option4=Choice3' \
+ '\%\%Page:\s*1\s+1' \
+ '\%\%BeginFeature:\s*\*Option4\s+Choice1' \
+ 'gsave' \
+ '\%\%Page:\s*2\s+2' \
+ '\%\%BeginFeature:\s*\*Option4\s+Choice1' \
+ 'gsave' \
+ '\%\%Page:\s*3\s+3' \
+ '\%\%BeginFeature:\s*\*Option4\s+Choice3' \
+ 'gsave' \
+ '\%\%Page:\s*4\s+4' \
+ '\%\%BeginFeature:\s*\*Option4\s+Choice1' \
+ 'gsave'
+ test_foomatic_rip 'FoomaticOption1=Choice3 for pages 2-4' \
+ '-o 2-4:FoomaticOption1=Choice3' \
+ '\%\%Page:\s*1\s+1' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice1' \
+ '\%\%Page:\s*2\s+2' \
+ '\%\%Page:\s*3\s+3' \
+ '\%\%Page:\s*4\s+4' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice3'
+ test_foomatic_rip 'FoomaticOption1=Choice3 for odd pages' \
+ '-o odd:FoomaticOption1=Choice3' \
+ '\%\%Page:\s*1\s+1' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice3' \
+ '\%\%Page:\s*2\s+2' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice1' \
+ '\%\%Page:\s*3\s+3' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice3' \
+ '\%\%Page:\s*4\s+4' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice1'
+ test_foomatic_rip 'FoomaticOption1=Choice3 for pages 1-2 and 4' \
+ '-o 1-2,4:FoomaticOption1=Choice3' \
+ '\%\%Page:\s*1\s+1' \
+ '\%\%Page:\s*2\s+2' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice3' \
+ '\%\%Page:\s*3\s+3' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice1' \
+ '\%\%Page:\s*4\s+4' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice3'
+ tpresult
+}
+
+tp12() {
+ tpstart "Reference III.8.2"
+ tet_infoline "PostScript code of options in the PostScript data stream"
+ tet_infoline "gets taken into account, foomatic-rip executes Foomatic"
+ tet_infoline "options"
+ IFILE=""
+ # The CUPS filter pstops inserts the PostScript code of the options
+ # of the PPD file given by the $PPD environment variable. Usually
+ # the default option settings are used. Non-default option settings
+ # can be supplied by the fifth command line argument.
+ # Note: The environment variable $PPD to tell pstops which PPD to use
+ # was already set in the beginning of this script
+ $PSTOPS 0 x y 1 "FoomaticOption2=Choice2" \
+ $INPUTFILE 2> /dev/null | \
+ test_foomatic_rip 'FoomaticOption2 with setting Choice2 inserted' \
+ '' \
+ '\@PJL\s+SET\s+TEST2=CHOICE2\s*[\n\r]+'
+ $PSTOPS 0 x y 1 "Option7=False" \
+ $INPUTFILE 2> /dev/null | \
+ test_foomatic_rip 'Option7 (PostScript) with setting False inserted' \
+ '' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option7\s+\S+\s*[\n\r]+\s*\% Option7: False\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ $PSTOPS 0 x y 1 "FoomaticOption8=Choice1" \
+ $INPUTFILE 2> /dev/null | \
+ test_foomatic_rip 'Changing FoomaticOption8 (composite option)' \
+ '' \
+ 'foomatic-test-renderer[^\n\r]* --option9=choiceA[^\n\r]* --optionA=choiceD[^\n\r]* --optionC=choiceB[^\n\r]* --optionD=choiceE'
+ tpresult
+}
+
+tp13() {
+ tpstart "Reference III.8.2"
+ tet_infoline "foomatic-rip acts as a CUPS filter and recognizes if it is"
+ tet_infoline "called as such. Also a test for the full printing workflow."
+ if ! grep -qi "FileDevice *yes" $CUPSDCONF; then
+ tet_infoline "Adding \"FileDevice Yes\" to cupsd.conf"
+ tet_infoline "This is needed so that we can print into a file."
+ echo "FileDevice yes" >> $CUPSDCONF
+ check_exit_value $? 0
+ check_nostderr
+ $CUPSINIT1 restart 2>/dev/null || \
+ $CUPSINIT2 restart 2>/dev/null || \
+ killall -HUP $CUPSD 2>/dev/null
+ check_exit_value $? 0
+ check_nostderr
+ sleep 3
+ FILEDEVICEYESADDED=1
+ fi
+ if [ -x $PRIVATECUPSDIR/sbin/cupsd ]; then
+ ln -s $FOOMATICRIP $PRIVATECUPSDIR/lib/cups/filter/
+ fi
+ if [ -e $HOME/.cupsrc ]; then
+ IPP_PORT=632
+ HOME=/tmp
+ export HOME IPP_PORT
+ fi
+ tet_infoline "Creating test print queue \"testprinter\""
+ $LPADMIN -p testprinter -E -v file:/tmp/out.prn -P $PPD
+ check_exit_value $? 0
+ check_nostderr
+ test_cups_job "Default option settings" \
+ '' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option1\s+Choice2\s*[\n\r]+\s*\<\<\/HWResolution \[1200 600\]\>\> setpagedevice \% Option1: Choice2\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_cups_job "Option setting Option1=Choice1" \
+ '-o Option1=Choice1' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*Option1\s+Choice1\s*[\n\r]+\s*\<\<\/HWResolution \[1200 1200\]\>\> setpagedevice \% Option1: Choice1\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_cups_job 'Changing FoomaticOption8' \
+ '-o FoomaticOption8=Choice1' \
+ 'foomatic-test-renderer[^\n\r]* --option9=choiceA[^\n\r]* --optionA=choiceD[^\n\r]* --optionC=choiceB[^\n\r]* --optionD=choiceE'
+ test_cups_job 'FoomaticOption4: Valid string (DFhj3545)' \
+ '-o FoomaticOption4=DFhj3545' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption4\s+DFhj3545\s*[\n\r]+\s*\% FoomaticOption4: DFhj3545\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ test_cups_job 'FoomaticOption5 set to -7' \
+ '-o FoomaticOption5=-7' \
+ '\[\{\s*[\n\r]+\s*\%\%BeginFeature:\s*\*FoomaticOption5\s+\-7\s*[\n\r]+\s*\% FoomaticOption5: \s*\-7\s*[\n\r]+\s*\%\%EndFeature\s*[\n\r]+\s*\}\s*stopped\s+cleartomark'
+ tet_infoline "Next test is with --user option, does not run on all LSB-compliant systems, see http://bugs.linuxbase.org/show_bug.cgi?id=1841"
+ test_cups_job 'Job parameters' \
+ '' \
+ 'foomatic-test-renderer[^\n\r]* --FoomaticOptionE --user='$USER' --host='$HOSTNAME' --title=TEST --copies=1 --options=\([^\n\r]*\) --date=\d\d\/\d\d\/\d+ --time=\d\d\:\d\d\:\d\d --special=\&\<\>\"'
+ test_cups_job 'FoomaticOption2 (PJL) inserted' '' \
+ '\@PJL\s+SET\s+TEST2=CHOICE1\s*[\n\r]+'
+ test_cups_job 'Option6 and FoomaticOption2 (both PJL) merged into driver-generated PJL header' \
+ '-o FoomaticPJLMergeTest=DriverPJL' \
+ '\%-12345X\@PJL\s+SET\s+TEST2=CHOICE1\s*[\n\r]+\s*\@PJL\s+SET\s+TEST6=CHOICE1\s*[\n\r]+\s*\@PJL\s+SET\s+RESOLUTION=600\s*[\n\r]+\s*\@PJL\s+ENTER\s+LANGUAGE=POSTSCRIPT\s*[\n\r]+'
+ test_cups_job 'FoomaticOption1=Choice3 for pages 1-2 and 4' \
+ '-o 1-2,4:FoomaticOption1=Choice3' \
+ '\%\%Page:\s*1\s+1' \
+ '\%\%Page:\s*2\s+2' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice3' \
+ '\%\%Page:\s*3\s+3' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice1' \
+ '\%\%Page:\s*4\s+4' \
+ 'foomatic-test-renderer[^\n\r]* --option1=choice3'
+ tet_infoline "Removing test print queue \"testprinter\""
+ $LPADMIN -x testprinter
+ check_exit_value $? 0
+ check_nostderr
+ if [ -x $PRIVATECUPSDIR/sbin/cupsd ]; then
+ rm -f $PRIVATECUPSDIR/lib/cups/filter/foomatic-rip
+ fi
+ if [ "$FILEDEVICEYESADDED" = "1" ]; then
+ tet_infoline "Removing \"FileDevice yes\" from cupsd.conf"
+ perl -p -i -e 's/FileDevice yes\n//sm' $CUPSDCONF
+ check_exit_value $? 0
+ check_nostderr
+ $CUPSINIT1 restart 2>/dev/null || \
+ $CUPSINIT2 restart 2>/dev/null || \
+ killall -HUP $CUPSD 2>/dev/null
+ check_exit_value $? 0
+ check_nostderr
+ fi
+ tpresult
+}
+
+test_foomatic_rip() {
+ COMMENT=$1
+ shift
+ EXTRAOPTS=$1
+ shift
+ CMDLINE="$BASECMDLINE $EXTRAOPTS $IFILE"
+ if [ "$CMDLINE" != "$PREVCMDLINE" ]
+ then
+ tet_infoline "Executing $CMDLINE"
+ $CMDLINE > out.stdout 2>out.stderr
+ PREVCMDLINE="$CMDLINE"
+ fi
+ check_exit_value $? 0
+ check_nostderr
+ SEARCHTERM=''
+ while [ -n "$1" ]
+ do
+ if [ -n "$SEARCHTERM" ]
+ then
+ SEARCHTERM=$SEARCHTERM'.*'
+ fi
+ SEARCHTERM=$SEARCHTERM`/bin/echo "$1" | sed 's/ /\\\\x20/g'`
+ shift
+ done
+ tet_infoline "Checking: $COMMENT"
+ check_stdout_binary_P $SEARCHTERM
+}
+
+test_cups_job () {
+ COMMENT=$1
+ shift
+ EXTRAOPTS=$1
+ shift
+ SEARCHTERM=''
+ while [ -n "$1" ]
+ do
+ if [ -n "$SEARCHTERM" ]
+ then
+ SEARCHTERM=$SEARCHTERM'.*'
+ fi
+ SEARCHTERM=$SEARCHTERM`/bin/echo "$1" | sed 's/ /\\\\x20/g'`
+ shift
+ done
+ tet_infoline "$COMMENT"
+ tet_infoline "Sending print job with option settings \"$EXTRAOPTS\""
+ $LPR -P testprinter -J "TEST" -o FilterPath=`pwd`'/' $EXTRAOPTS $INPUTFILE
+ check_exit_value $? 0
+ check_nostderr
+ counter=30
+ while [ "`$LPSTAT -o testprinter | wc -l`" != "0" ]; do
+ counter=$(($counter - 1))
+ if [ "$counter" = "0" ]; then
+ tet_infoline "Print job timeout"
+ FAIL=Y
+ break
+ fi
+ sleep 1
+ done
+ chown $USER out.stdout
+ check_exit_value $? 0
+ check_nostderr
+ cat /tmp/out.prn | perl -e 'my $a = join("",<>); exit !($a =~ /'$SEARCHTERM'/sm)'
+ if [ $? -ne 0 ]
+ then
+ tet_infoline "Output written to stdout did not contain \""`echo $SEARCHTERM | perl -p -e 's/\\\\/\\\\\\\\/g'`"\""
+ FAIL=Y
+ fi
+}
+
+# This is a derived function from LIB/shfuncs.sh/check_stdout()
+# It checks whether string $1 is present in file out.stdout
+# Differences:
+# 1. It does not output file when check_stdout failed
+# 2. It's using Perl rather than grep (grep -P is not available in all distros)
+check_stdout_binary_P() # check that a string went to stdout
+{
+ case $1 in
+ "")
+ if [ ! -s out.stdout ]
+ then
+ tet_infoline "Expected output to stdout, but none written"
+ FAIL=Y
+ fi
+ ;;
+ *)
+ cat out.stdout | perl -e 'my $a = join("",<>); exit !($a =~ /'$1'/sm)'
+ if [ $? -ne 0 ]
+ then
+ tet_infoline "Output written to stdout did not contain \""`echo $1 | perl -p -e 's/\\\\/\\\\\\\\/g'`"\""
+ FAIL=Y
+ fi
+ ;;
+ esac
+}
+
+startup() {
+ rm -f tet_xres
+}
+
+cleanup() {
+ if [ -f tet_xres ];then
+ #mv tet_xres journal.gs-test
+ rm -f out.stdout
+ rm -f out.stderr
+ rm -f /tmp/out.prn
+ fi
+}
+
+# source common shell functions
+
+. ./shfuncs.sh
+. ./lsbfuncs.sh
+
+# execute shell test case manager - must be last line
+. ./tcm.sh
+
diff --git a/test/tetapi.sh b/test/tetapi.sh
new file mode 100755
index 0000000..a835769
--- /dev/null
+++ b/test/tetapi.sh
@@ -0,0 +1,313 @@
+#
+# SCCS: @(#)tetapi.sh 1.17 (03/03/31)
+#
+# UniSoft Ltd., London, England
+#
+# (C) Copyright 1996 X/Open Company Limited
+#
+# All rights reserved. No part of this source code may be reproduced,
+# stored in a retrieval system, or transmitted, in any form or by any
+# means, electronic, mechanical, photocopying, recording or otherwise,
+# except as stated in the end-user licence agreement, without the prior
+# permission of the copyright owners.
+# A copy of the end-user licence agreement is contained in the file
+# Licence which accompanies this distribution.
+#
+# X/Open and the 'X' symbol are trademarks of X/Open Company Limited in
+# the UK and other countries.
+#
+# ************************************************************************
+
+# Copyright 1990 Open Software Foundation (OSF)
+# Copyright 1990 Unix International (UI)
+# Copyright 1990 X/Open Company Limited (X/Open)
+#
+# Permission to use, copy, modify, and distribute this software and its
+# documentation for any purpose and without fee is hereby granted, provided
+# that the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of OSF, UI or X/Open not be used in
+# advertising or publicity pertaining to distribution of the software
+# without specific, written prior permission. OSF, UI and X/Open make
+# no representations about the suitability of this software for any purpose.
+# It is provided "as is" without express or implied warranty.
+#
+# OSF, UI and X/Open DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+# EVENT SHALL OSF, UI or X/Open BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+# USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+#
+# ***********************************************************************
+#
+# SCCS: @(#)tetapi.sh 1.17 03/31/03
+# NAME: Shell API Support Routines
+# PRODUCT: TET (Test Environment Toolkit)
+# as supplied with TETware release 3.7
+# AUTHOR: Andrew Dingwall, UniSoft Ltd.
+# DATE CREATED: 1 November 1990
+#
+# DESCRIPTION:
+# This file contains shell functions for use with the shell API.
+# It is sourced automatically by the shell TCM.
+# In addition it should be sourced by test purposes that are written as
+# separate shell scripts, by means of the shell . command.
+#
+# The following functions are provided:
+#
+# tet_setcontext
+# tet_setblock
+# tet_infoline
+# tet_result
+# tet_delete
+# tet_reason
+#
+# MODIFICATIONS:
+#
+# Geoff Clare, 29 Jan 1992
+# Rewrite tet_setcontext() so context number will change.
+#
+# Geoff Clare, UniSoft Ltd., August 1996
+# Make TP number unique over test case, not just IC.
+# Use $$ as context number whenever possible.
+#
+# Andrew Dingwall, UniSoft Ltd., October 1996
+# Port to NT
+#
+# Andrew Dingwall, The Open Group, January 2002
+# changed "ed -" to "ed -s" so as to conform to UNIX2003
+#
+# ***********************************************************************
+
+#
+# publicly available shell API functions
+#
+
+# set current context and reset block and sequence
+# usage: tet_setcontext
+# Note that when tet_setcontext is called in a subshell started using
+# "( ... )" we cannot use $$ because it has the same value as in the parent.
+tet_setcontext(){
+ if test $$ != "$TET_CONTEXT"
+ then
+ TET_CONTEXT=$$
+ else
+ # obtain a new, unused PID without generating a zombie process.
+ TET_CONTEXT=`(:)& echo $!`
+ fi
+ TET_BLOCK=1
+ TET_SEQUENCE=1
+}
+
+# increment the current block ID, reset the sequence number to 1
+# usage: tet_setblock
+tet_setblock(){
+ TET_BLOCK=`expr ${TET_BLOCK:?} + 1`
+ TET_SEQUENCE=1
+}
+
+# print an information line to the execution results file
+# and increment the sequence number
+# usage: tet_infoline args [...]
+tet_infoline(){
+ tet_output 520 "${TET_TPNUMBER:?} ${TET_CONTEXT:?} ${TET_BLOCK:?} ${TET_SEQUENCE:?}" "$*"
+ TET_SEQUENCE=`expr $TET_SEQUENCE + 1`
+}
+
+# record a test result for later emmision to the execution results file
+# by tet_tpend
+# usage: tet_result result_name
+# (note that a result name is expected, not a result code number)
+tet_result(){
+ TET_ARG1="${1:?}"
+ if tet_getcode "$TET_ARG1"
+ then
+ : ok
+ else
+ tet_error "invalid result name \"$TET_ARG1\"" \
+ "passed to tet_result"
+ TET_ARG1=NORESULT
+ fi
+
+ echo $TET_ARG1 >> ${TET_TMPRES:?}
+ unset TET_ARG1
+}
+
+# mark a test purpose as deleted
+# usage: tet_delete test_name reason [...]
+tet_delete(){
+ TET_ARG1=${1:?}
+ shift
+ TET_ARG2N="$*"
+ if test -z "$TET_ARG2N"
+ then
+ tet_undelete $TET_ARG1
+ return
+ fi
+
+ case $TET_OSNAME in
+ Windows_*)
+ TET_DEVNULL=nul
+ ;;
+ *)
+ TET_DEVNULL=/dev/null
+ ;;
+ esac
+
+ if tet_reason $TET_ARG1 > $TET_DEVNULL
+ then
+ tet_undelete $TET_ARG1
+ fi
+
+ echo "$TET_ARG1 $TET_ARG2N" >> ${TET_DELETES:?}
+ unset TET_ARG1 TET_ARG2N
+}
+
+# print the reason why a test purpose has been deleted
+# return 0 if the test purpose has been deleted, 1 otherwise
+# usage: tet_reason test_name
+tet_reason(){
+ : ${1:?}
+ (
+ while read TET_A TET_B
+ do
+ if test X"$TET_A" = X"$1"
+ then
+ echo "$TET_B"
+ exit 0
+ fi
+ done
+ exit 1
+ ) < ${TET_DELETES:?}
+
+ return $?
+}
+
+
+# ******************************************************************
+
+#
+# "private" functions for internal use by the shell API
+# these are not published interfaces and may go away one day
+#
+
+
+# tet_getcode
+# look up a result code name in the result code definition file
+# return 0 if successful with the result number in TET_RESNUM and TET_ABORT
+# set to YES or NO
+# otherwise return 1 if the code could not be found
+tet_getcode(){
+ TET_ABORT=NO
+ TET_RESNUM=-1
+ : ${TET_CODE:?}
+
+ TET_A="${1:?}"
+ eval "`sed '/^#/d; /^[ ]*$/d' $TET_CODE | while read TET_B
+ do
+ eval set -- $TET_B
+ if test X\"$2\" = X\"$TET_A\"
+ then
+ echo TET_RESNUM=\\"$1\\"
+ echo TET_ABACTION=\\"$3\\"
+ exit
+ fi
+ done`"
+ unset TET_A
+
+ case "$TET_RESNUM" in
+ -1)
+ unset TET_ABACTION
+ return 1
+ ;;
+ esac
+
+ case "$TET_ABACTION" in
+ ""|Continue)
+ TET_ABORT=NO
+ ;;
+ Abort)
+ TET_ABORT=YES
+ ;;
+ *)
+ tet_error "invalid action field \"$TET_ABACTION\" in file" \
+ $TET_CODE
+ TET_ABORT=NO
+ ;;
+ esac
+
+ unset TET_ABACTION
+ return 0
+}
+
+# tet_undelete - undelete a test purpose
+# Note: if your system has a very old version of ed(1) which doesn't
+# understand -s, change the invocation to "ed -"
+tet_undelete(){
+ echo "g/^${1:?} /d
+w
+q" | ed -s ${TET_DELETES:?}
+}
+
+# tet_error - print an error message to stderr and on TCM Message line
+tet_error(){
+ echo "$TET_PNAME: $*" 1>&2
+ echo "510|${TET_ACTIVITY:-0}|$*" >> ${TET_RESFILE:?}
+}
+
+# tet_output - print a line to the execution results file
+tet_output(){
+ > ${TET_STDERR:?}
+
+ case $TET_OSNAME in
+ Windows_*)
+ TET_DEVNULL=nul
+ ;;
+ *)
+ TET_DEVNULL=/dev/null
+ ;;
+ esac
+
+ awk 'END {
+ if (length(tet_arg2) > 0)
+ tet_sp = " ";
+ else
+ tet_sp = "";
+ line = sprintf("%d|%s%s%s|%s", tet_arg1, tet_activity, \
+ tet_sp, tet_arg2, tet_arg3);
+
+ # ensure no newline characters in data
+ nl = sprintf("\n");
+ n = split(line, a, nl);
+ if (n > 1)
+ {
+ line = a[1];
+ for (i = 2; i <= n; i++)
+ {
+ if (a[i] != "")
+ line = line " " a[i];
+ }
+ }
+
+ # journal lines must not exceed 512 bytes
+ if (length(line) > 511)
+ {
+ printf("warning: results file line truncated: prefix: %d|%s%s%s|\n", tet_arg1, tet_activity, tet_sp, tet_arg2) >tet_stderr;
+ line = substr(line, 1, 511);
+ }
+
+ # line is now OK to print
+ print line;
+ }' "tet_arg1=${1:?}" "tet_arg2=$2" "tet_arg3=$3" \
+ "tet_activity=${TET_ACTIVITY:-0}" \
+ "tet_stderr=$TET_STDERR" $TET_DEVNULL >> ${TET_RESFILE:?}
+
+ if test -s $TET_STDERR
+ then
+ tet_error "`cat $TET_STDERR`"
+ fi
+ > $TET_STDERR
+}
+