Show
Ignore:
Timestamp:
11/22/07 12:58:46 (17 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.

Files:
1 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