Changeset 505

Show
Ignore:
Timestamp:
11/22/07 12:58:46 (16 years ago)
Author:
jerome
Message:

Improved testsuite generation tool to regenerate a testsuite if the input datas
don't match that of the existing one.

Location:
pkpgcounter/trunk/tests
Files:
2 modified

Legend:

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

    r504 r505  
    2727import os 
    2828import glob 
     29import md5 
    2930import tempfile 
    3031 
     
    6869def computeSize(filename) :     
    6970    """Computes the size in pages of a file in the testsuite.""" 
    70     answerfd = os.popen('pkpgcounter "%(filename)s"' % locals(), "r") 
     71    answerfd = os.popen('pkpgcounter "%(filename)s" 2>/dev/null' % locals(), "r") 
    7172    try : 
    7273        try : 
     
    8283    if not mastersize : 
    8384        raise RuntimeError, "Unable to compute the size of the testsuite's master file %(masterfilename)s" % locals() 
    84          
     85    else :     
     86        sys.stdout.write("Master file's contains %(mastersize)i pages.\n" % locals()) 
    8587    passed = 0 
    8688    failed = 0 
     
    100102            sys.stdout.write("OK\n") 
    101103            passed += 1 
    102     print "Passed : %i (%.2f%%)" % (passed, 100.0 * passed / nbtests) 
    103     print "Failed : %i (%.2f%%)" % (failed, 100.0 * failed / nbtests) 
     104    sys.stdout.write("Passed : %i (%.2f%%)\n" % (passed, 100.0 * passed / nbtests)) 
     105    sys.stdout.write("Failed : %i (%.2f%%)\n" % (failed, 100.0 * failed / nbtests)) 
    104106             
    105107def main() :         
     
    111113        sys.exit(-1) 
    112114    else :     
     115        checksum = md5.new() # Ensures we'll recreate a new testsuite if input is different 
    113116        infilename = sys.argv[1] 
    114117        istemp = False 
     
    124127                    break 
    125128                tmp.write(data) 
     129                checksum.update(data) 
    126130            tmp.flush()     
    127              
    128         genTestSuite(infilename, "testsuite") 
     131        else :     
     132            checksum.update(infilename) 
     133        genTestSuite(infilename, "testsuite.%s" % checksum.hexdigest()) 
    129134        runTests(infilename, "testsuite") 
    130135             
  • pkpgcounter/trunk/tests/runtest.sh

    r487 r505  
    1919echo -n "Generating testsuite..." 
    2020gunzip <master.ps.gz >master2.ps 
    21 for device in hl1240 \ 
    22               hl1250 \ 
    23               hl7x0 \ 
    24               lj250 \ 
    25               lj4dithp \ 
    26               ljet2p \ 
    27               ljet4pjl \ 
    28               ljetplus \ 
    29               laserjet \ 
    30               ljet3 \ 
    31               ljet4 \ 
    32               lj5gray \ 
    33               lj5mono \ 
    34               pxlmono \ 
    35               pxlcolor \ 
    36               pdfwrite \ 
    37               pswrite \ 
    38               psgray \ 
    39               psmono \ 
    40               psrgb \ 
    41               epson \ 
    42               epsonc \ 
    43               eps9mid \ 
    44               eps9high \ 
    45               stcolor \ 
    46               st800 \ 
    47               escp \ 
    48               pcl3 \ 
    49               cdeskjet \ 
    50               cdj1600 \ 
    51               cdj500 \ 
    52               cdj550 \ 
    53               cdj670 \ 
    54               cdj850 \ 
    55               cdj880 \ 
    56               cdj890 \ 
    57               cdj970 \ 
    58               cdjcolor \ 
    59               cdjmono \ 
    60               dj505j \ 
    61               djet500 \ 
    62               djet500c \ 
    63               hpdj1120c \ 
    64               hpdj310 \ 
    65               hpdj320 \ 
    66               hpdj340 \ 
    67               hpdj400 \ 
    68               hpdj500 \ 
    69               hpdj500c \ 
    70               hpdj510 \ 
    71               hpdj520 \ 
    72               hpdj540 \ 
    73               hpdj550c \ 
    74               hpdj560c \ 
    75               hpdj600 \ 
    76               hpdj660c \ 
    77               hpdj670c \ 
    78               hpdj680c \ 
    79               hpdj690c \ 
    80               hpdj850c \ 
    81               hpdj855c \ 
    82               hpdj870c \ 
    83               hpdj890c \ 
    84               hpdjplus \ 
    85               hpdjportable \ 
    86               gdi \ 
    87               tiff12nc \ 
    88               tiff24nc \ 
    89               tiffcrle \ 
    90               tiffg3 \ 
    91               tiffg32d \ 
    92               tiffg4 \ 
    93               tifflzw \ 
    94               tiffpack ; do 
    95     if ! [ -f "testsuite.$device" ]  ; then 
    96         gs -dQUIET -dBATCH -dNOPAUSE -sOutputFile="testsuite.$device" -sDEVICE="$device" master2.ps ;  
    97     fi ; 
    98     done 
    99      
     21 
     22python ./gstests.py master2.ps 
     23 
    10024if ! [ -f "colors.pdf" ]  ; then 
    10125   python ./runcolors.py ;  
     
    10327echo  
    10428 
    105 echo -n "File master.ps should be 16 pages long, result is : " 
    106 python ../pkpgpdls/analyzer.py master2.ps 
    107  
    108 echo "Analyzing testsuite..." 
    109 for file in testsuite.* ; do 
    110     echo -n "$file ===> " && python ../pkpgpdls/analyzer.py "$file" ; 
    111 done     
    112 echo 
    113  
    11429echo "Analyzing colors..." 
    115 for cspace in BW RGB CMY CMYK ; do 
     30for cspace in BW RGB CMY CMYK GC ; do 
    11631    echo "Colorspace : $cspace" ; 
    117     python ../pkpgpdls/analyzer.py --colorspace $cspace colors.pdf ; 
     32    pkpgcounter --colorspace $cspace colors.pdf ; 
    11833    echo ; 
    11934done