Changeset 534 for pkpgcounter

Show
Ignore:
Timestamp:
12/05/07 00:14:11 (16 years ago)
Author:
jerome
Message:

Now also checks for some hpijs drivers.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/tests/gstests.py

    r509 r534  
    3939    answerfd = os.popen('/bin/echo "devicenames ==" | gs -dBATCH -dQUIET -dNOPAUSE -dPARANOIDSAFER -sDEVICE=nullpage -', "r") 
    4040    answer = answerfd.readline().strip() 
    41     answerfd.close() 
    42     if answer.startswith("[/") and answer.endswith("]") : 
    43         devices = [ dev[1:] for dev in answer[1:-1].split() \ 
    44                                 if dev.startswith("/") \ 
    45                                    and (not dev.startswith("/x11")) \ 
    46                                    and (not dev == "/ijs") \ 
    47                                    and (not dev == "/nullpage") \ 
    48                                    and (not dev == "/bbox") ] 
    49         devices.sort()                            
    50         return devices 
    51     else : 
    52         return [] 
     41    if not answerfd.close() : 
     42        if answer.startswith("[/") and answer.endswith("]") : 
     43            devices = [ dev[1:] for dev in answer[1:-1].split() \ 
     44                                    if dev.startswith("/") \ 
     45                                       and (not dev.startswith("/x11")) \ 
     46                                       and (not dev == "/ijs") \ 
     47                                       and (not dev == "/nullpage") \ 
     48                                       and (not dev == "/bbox") ] 
     49            devices.sort()                            
     50            return devices 
     51    return [] 
    5352         
    54 def genTestSuite(infilename, root) : 
    55     """Generate the testsuite.""" 
    56     for device in getAvailableDevices() : 
     53def getAvailableIJSPrintClasses() : 
     54    """Returns a list of available IJS Print Classes. 
     55     
     56       Currently the list is a static one and doesn't contain all the available print classes. 
     57    """ 
     58    return [ "DJ3600", "DJ3320", "DJ9xx", "DJGenericVIP", "LJColor",  
     59             "DJ850", "DJ890", "DJ9xxVIP", "DJ8xx", "DJ540", "DJ660", 
     60             "DJ6xx", "DJ350", "DJ6xxPhoto", "DJ630", "DJ8x5", "DJ4100", 
     61             "AP21xx", "AP2560", "AP2xxx", "PSP100", "PSP470", "Undefined", 
     62             "Postscript", "LJJetReady", "LJMono", "LJFastRaster", 
     63             "LJZjsMono", ] 
     64         
     65def batchGeneration(infilename, devices, root, command) : 
     66    """Loops over a set of devices calling a particular command.""" 
     67    for device in devices : 
    5768        outfilename = "%(root)s.%(device)s" % locals() 
    58         if not os.path.exists(outfilename) : 
     69        if os.path.exists(outfilename) and os.stat(outfilename).st_size : 
     70            sys.stdout.write("Skipping %(outfilename)s : already exists.\n" % locals()) 
     71        else :     
    5972            sys.stdout.write("Generating %(outfilename)s " % locals()) 
    6073            sys.stdout.flush() 
    61             os.system('gs -dQUIET -dBATCH -dNOPAUSE -dPARANOIDSAFER -sOutputFile="%(outfilename)s" -sDEVICE="%(device)s" "%(infilename)s"' % locals()) 
     74            os.system(command % locals()) 
    6275            sys.stdout.write("\n") 
    63         else :     
    64             sys.stdout.write("Skipping %(outfilename)s : already exists.\n" % locals()) 
    6576             
    6677        if not os.path.exists(outfilename) : 
    6778            sys.stderr.write("ERROR while generating %(outfilename)s\n" % locals()) 
     79     
     80def genTestSuite(infilename, root) : 
     81    """Generate the testsuite.""" 
     82    batchGeneration(infilename, getAvailableDevices(),  
     83                                root,  
     84                                'gs -dQUIET -dBATCH -dNOPAUSE -dPARANOIDSAFER -sOutputFile="%(outfilename)s" -sDEVICE="%(device)s" "%(infilename)s"') 
     85                                 
     86    batchGeneration(infilename, getAvailableIJSPrintClasses(),  
     87                                "%(root)s.hpijs" % locals(),  
     88                                'gs -dBATCH -dQUIET -dPARANOIDSAFER -dNOPAUSE -sDEVICE=ijs -sIjsServer=hpijs -dIjsUseOutputFD -sDeviceManufacturer="HEWLETT-PACKARD" -sDeviceModel="%(device)s" -sOutputFile="%(outfilename)s" "%(infilename)s"') 
    6889             
    6990def computeSize(filename) :