[gs-cvs] rev 8836 - trunk/cluster/tti

giles at ghostscript.com giles at ghostscript.com
Fri Jul 11 18:17:24 PDT 2008


Author: giles
Date: 2008-07-11 18:17:24 -0700 (Fri, 11 Jul 2008)
New Revision: 8836

Modified:
   trunk/cluster/tti/reg_dispatch-pcl.py
   trunk/cluster/tti/reg_dispatch.py
   trunk/cluster/tti/regress.py
Log:
Synchronize with current cluster versions.

regress.py now takes multiple --device= and --dpi= options, and runs the 
ps3cet files without -dSAFER and with the gs_cet.ps prefix.


Modified: trunk/cluster/tti/reg_dispatch-pcl.py
===================================================================
--- trunk/cluster/tti/reg_dispatch-pcl.py	2008-07-11 23:10:56 UTC (rev 8835)
+++ trunk/cluster/tti/reg_dispatch-pcl.py	2008-07-12 01:17:24 UTC (rev 8836)
@@ -235,12 +235,15 @@
   cmd = 'bwpython ../regress.py'
   cmd += ' --batch --update'
   cmd += ' --exe ' + exe
+  cmd += ' --device=ppmraw'
+  if exe == 'main/obj/pcl6':
+    cmd += ' --device=bitcmyk --device=bitrgb'
   pbsjob(cmd, resources=None, workdir=workdir, stdout=report)
   # wait for the run to finish
   while not os.path.exists(report):
     time.sleep(20)
   if os.path.getsize(report) < 1:
-    f = open(report)
+    f = open(report, "w")
     f.write("[report empty -- regression failed]\n")
     f.close()
   print "report is ready as '" + report + "'. total time %d seconds" % int(time.time() - start)

Modified: trunk/cluster/tti/reg_dispatch.py
===================================================================
--- trunk/cluster/tti/reg_dispatch.py	2008-07-11 23:10:56 UTC (rev 8835)
+++ trunk/cluster/tti/reg_dispatch.py	2008-07-12 01:17:24 UTC (rev 8836)
@@ -124,7 +124,7 @@
     # pcput is the CPU time per process. Recent runs complete in about 6000 sec
     # resources = 'nodes=%d:%s:run%s,cput=10000' % (nodes, cluster, ppn)
     # perform test on a single node to see what is hanging
-    resources = 'nodes=%d:%s:run%s,cput=10000' % (nodes, cluster, ppn)
+    resources = 'nodes=%d:%s:run%s,cput=20000' % (nodes, cluster, ppn)
     print 'requesting', nodes, 'nodes on', cluster
   if stdout: jobname = stdout + '.pbs'
   else: jobname = 'regress.pbs'
@@ -252,6 +252,7 @@
   elif not build(clean=True): irclog("Build failed!", rev)
   else:
     cmd = 'bwpython ../regress.py --batch --update'
+    cmd += ' --device=ppmraw --device=pbmraw --device=pkmraw'
     pbsjob(cmd, resources=None, stdout=report)
     # wait for the run to finish
     while not os.path.exists(report):

Modified: trunk/cluster/tti/regress.py
===================================================================
--- trunk/cluster/tti/regress.py	2008-07-11 23:10:56 UTC (rev 8835)
+++ trunk/cluster/tti/regress.py	2008-07-12 01:17:24 UTC (rev 8836)
@@ -22,8 +22,7 @@
     self.testpath = os.environ['HOME']
     #self.exe = './language_switch/obj/pspcl6'
     self.exe = './bin/gs -q -I$HOME/fonts'
-    self.device = 'ppmraw'
-    self.dpi = 600
+    # see the end of parse for defaults of accumulative options
 
   def parse(self, args):
     '''Parse the command line for configuration switches
@@ -57,7 +56,7 @@
             val = True
 
         # for select options, accumulate the values
-        if opt in ('test'):
+        if opt in ('test', 'device', 'dpi'):
           opt += 's' # pluralize collections
           if not hasattr(self, opt):
             self.__dict__[opt] = []
@@ -67,6 +66,13 @@
           self.__dict__[opt] = val
  
     # finally, set defaults for unset accumulating options
+    if not hasattr(self, 'devices'):
+      self.devices = ['ppmraw']
+    if not hasattr(self, 'dpis'):
+      self.dpis = [600]
+    else:
+      # the code expects dpi to be and integer
+      self.dpis = map(int, self.dpis)
     if not hasattr(self, 'tests'):
       self.tests = []
       # guess appropriate defaults based on the executable
@@ -158,7 +164,7 @@
   def addResult(self, test):
     if test:
       if not conf.batch:
-        print test.description() + ' ... ' + str(test.result)
+        print 'Checking %s ... %s' % (test.description(), test.result)
       self.tests.append(test)
       if isinstance(test.result, ErrorResult):
         self.errors.append(test)
@@ -190,7 +196,7 @@
 	(len(self.fails),len(self.tests))
       if conf.batch:
         for test in self.fails:
-          print '  ' + test.file
+          print '  ' + test.description()
         print
     if self.errors:
       print 'ERROR running %d of %d tests' % \
@@ -245,23 +251,37 @@
   '''Test class for running a file and comparing the output to an
   expected value.'''
 
-  def __init__(self, file, md5sum, dpi=600, device="ppmraw"):
+  def __init__(self, file, db, device='ppmraw', dpi=600):
     SelfTest.__init__(self)
     self.file = file
-    self.md5sum = md5sum
+    self.md5sum = db[db.makekey(file, device=device, dpi=dpi)]
     self.dpi = dpi
+    self.device = device
     self.exe = conf.exe
-    self.opts = "-dQUIET -dSAFER -dNOPAUSE -dBATCH -K1000000"
-    self.opts += " -dSAFER -dBATCH -dMaxBitmap=30000000"
-    self.opts += " -Z:@"
+    self.opts = "-dQUIET -dNOPAUSE -dBATCH"
+    # Some of the ps3cet files will not complete unless run
+    # with the gs_cet.ps prefix and without -dSAFER
+    if not 'ps3cet' in os.path.dirname(file):
+      self.opts += " -dSAFER"
+    self.opts += " -K1000000 -dMaxBitmap=30000000"
+    #self.opts += " -Z:@"
     self.opts += " -sDEVICE=%s -r%d" % (device, dpi)
     self.psopts = '-dJOBSERVER'
+    if 'ps3cet' in os.path.dirname(file):
+      self.psopts += ' lib/gs_cet.ps'
 
   def description(self):
-    return 'Checking ' + self.file
+    # hack out the testpath prefix to shorten the report line
+    if conf.testpath in self.file:
+      file = self.file[len(conf.testpath):]
+      if file[0] == '/': file = file[1:]
+    else:
+      file = self.file
+    return '%s (%s %ddpi)' % (file, self.device, self.dpi)
 
   def run(self):
-    scratch = os.path.join('/tmp', os.path.basename(self.file) + '.md5')
+    scratch = os.path.join('/tmp', os.path.basename(self.file) + \
+        '.'.join( ('', self.device, str(self.dpi), 'md5') ))
     # add psopts if it's a postscript file
     if self.file[-3:].lower() == '.ps' or \
 	self.file[-4:].lower() == '.eps' :
@@ -312,9 +332,9 @@
       if line[:1] == '#': continue
       fields = line.split()
       try:
-        file = fields[0].strip()
+        key = fields[0].strip()
         md5sum = fields[1].strip()
-        self.db[file] = md5sum
+        self.db[key] = md5sum
       except IndexError:
         pass
     f.close()
@@ -339,6 +359,12 @@
   def __setitem__(self, key, value):
     self.db[key] = value
 
+  # key generation
+  def makekey(self, file, **keywords):
+    result = 'file:' + str(file)
+    for key in sorted(keywords):
+      result += ';' + str(key) + ':' + str(keywords[key])
+    return result
 
 def run_regression():
   'run normal set of regressions'
@@ -352,20 +378,24 @@
     db.load()
     for test in conf.tests:
       for file in glob(os.path.join(conf.testpath,test)):
-        suite.addTest(md5Test(file, db[file], conf.dpi, conf.device))
+	for device in conf.devices:
+	  for dpi in conf.dpis:
+            suite.addTest(md5Test(file, db, device, dpi))
     if MPI.size > 1 and not conf.batch:
       print 'running tests on %d nodes...' % MPI.size
   suite.run()
   if MPI.rank == 0:
     # update the database with new files and save
     for test in suite.news:
-      db[test.file] = test.result.msg
+      key = db.makekey(test.file, device=test.device, dpi=test.dpi)
+      db[key] = test.result.msg
     if conf.update:
       if len(suite.fails):
         print 'Updating baselines for the failed tests.'
 	print
       for test in suite.fails:
-        db[test.file] = test.result.msg
+        key = db.makekey(test.file, device=test.device, dpi=test.dpi)
+        db[key] = test.result.msg
     db.save()
 
 



More information about the gs-cvs mailing list