def runTest(self): if hasattr(self, "skip") and self.skip == 1: self.assert_(True) return outputfile = "%s.%s.%d.%d" % (self.file[string.rindex(self.file, '/') + 1:], self.device, self.dpi, self.band) gs = gstestgs.Ghostscript() gs.gsroot = self.gsroot gs.device = self.device gs.dpi = self.dpi gs.band = self.band gs.infile = self.file gs.outfile = outputfile if self.log_stdout: gs.log_stdout = self.log_stdout if self.log_stderr: gs.log_stderr = self.log_stderr if gs.process(): sum = gssum.make_sum(outputfile) else: sum = '' if os.path.exists(outputfile): shutil.move(outputfile, gsconf.datadir + "/raster.daily") # os.unlink(outputfile) if sum and self.track_daily: # add test result to daily database if gsconf.__dict__.has_key("checksumdb") and gsconf.checksumdb: dbname = gsconf.dailydir + gsconf.checksumdb # mhw +".db" else: dbname = gsconf.get_dailydb_name() gssum.add_file(outputfile, dbname=dbname, sum=sum) if not sum: message = myself + " output file " + outputfile + " was not created for input file: " + self.file self.fail(message) else: if gssum.exists(outputfile, gsconf.baselinedb): sum_baseline = gssum.get_sum(outputfile, gsconf.baselinedb) message = myself + ' checksum did not match baseline (' + outputfile + ') for input file: ' + self.file self.assertEqual(sum, sum_baseline, message) else: message = myself + " no baseline checksum (" + outputfile + ") for file: " + self.file self.fail(message)
def runTest(self): if hasattr(self, "skip") and self.skip == 1: self.assert_(True) return outputfile = "%s.%s.%d.%d" % (self.file[string.rindex(self.file, '/') + 1:], self.device, self.dpi, self.band) gs = gstestgs.Ghostscript() gs.gsroot = self.gsroot gs.device = self.device gs.dpi = self.dpi gs.band = self.band gs.infile = self.file gs.outfile = outputfile if self.log_stdout: gs.log_stdout = self.log_stdout if self.log_stderr: gs.log_stderr = self.log_stderr if gs.process(): sum = gssum.make_sum(outputfile) else: sum = '' if os.path.exists(outputfile): shutil.move(outputfile, gsconf.datadir+"/raster.daily") # os.unlink(outputfile) if sum and self.track_daily: # add test result to daily database if gsconf.__dict__.has_key("checksumdb") and gsconf.checksumdb: dbname=gsconf.dailydir+gsconf.checksumdb # mhw +".db" else: dbname=gsconf.get_dailydb_name() gssum.add_file(outputfile, dbname=dbname, sum=sum) if not sum: message=myself+" output file "+outputfile+" was not created for input file: " + self.file self.fail(message) else: if gssum.exists(outputfile,gsconf.baselinedb): sum_baseline=gssum.get_sum(outputfile,gsconf.baselinedb) message=myself+' checksum did not match baseline (' + outputfile + ') for input file: ' + self.file self.assertEqual(sum,sum_baseline,message) else: message = myself+" no baseline checksum (" + outputfile + ") for file: " + self.file self.fail(message)
def runTest(self): if hasattr(self, "skip") and self.skip: self.assert_(True) return file1 = '%s.%s.%d.%d.pdf' % (self.file[string.rindex(self.file, '/') + 1:], 'pdf', self.dpi, self.band) file2 = '%s.pdf.%s.%d.%d' % (self.file[string.rindex(self.file, '/') + 1:], self.device, self.dpi, self.band) gs = gstestgs.Ghostscript() gs.gsroot = self.gsroot gs.dpi = self.dpi gs.band = self.band gs.infile = self.file if self.log_stdout: gs.log_stdout = self.log_stdout if self.log_stderr: gs.log_stderr = self.log_stderr # do file->PDF conversion gs.device = 'pdfwrite' gs.dpi = None gs.outfile = file1 if not gs.process(): self.fail("non-zero exit code trying to create pdf file from " + self.file) # do PDF->device (pbmraw, pgmraw, ppmraw, pkmraw) gs.device = self.device gs.dpi = self.dpi gs.infile = file1 gs.outfile = file2 if not gs.process(): self.fail("non-zero exit code trying to rasterize " + file1) if os.path.exists(file1): shutil.move(file1, gsconf.datadir+"/raster.daily") # os.unlink(file1) else: self.fail("output file "+file1+" was not created for input file: " + file1) if os.path.exists(file2): sum = gssum.make_sum(file2) if not sum: self.fail("no checksum for output file "+file2+" was not created for input file: " + self.file) shutil.move(file2, gsconf.datadir+"/raster.daily") # os.unlink(file2) else: self.fail("output file "+file2+" was not created for input file: " + file2) # add test result to daily database if self.track_daily: if gsconf.__dict__.has_key("checksumdb") and gsconf.checksumdb: dbname=gsconf.dailydir+gsconf.checksumdb # mhw+".db" else: dbname=gsconf.get_dailydb_name() gssum.add_file(file2, dbname=dbname, sum=sum) else: outputfile=file2 if gssum.exists(outputfile,gsconf.baselinedb): sum_baseline=gssum.get_sum(outputfile,gsconf.baselinedb) message=myself+' checksum did not match baseline (' + outputfile + ') for input file: ' + self.file self.assertEqual(sum,sum_baseline,message) else: message = myself+" no baseline checksum (" + outputfile + ") for file: " + self.file self.fail(message)
revision=options.revision revision_value=options.revision_value if revision != "HEAD": gsconf.checksumdb = gsconf.dailydir+revision # mhw +".db" if revision != "HEAD": gsroot=gsconf.root+"gs."+revision+"/" else: gsroot=gsconf.gsroot if options.track: if gsconf.__dict__.has_key("checksumdb") and gsconf.checksumdb: dbname=gsconf.checksumdb else: dbname=gsconf.get_dailydb_name() # create (truncate) the database for the daily checksums db = anydbm.open(dbname, "n") db.close() print options.myself,"daily database for checksums",dbname testAll(options.track,gsroot,now,options) if options.track: dbname = dbname + ".db" # mhw if not os.path.exists(dbname): print options.myself,"ERROR","the checksum database does not exist",dbname # copy from the db by date to the db by revision if revision == "HEAD":
revision = options.revision revision_value = options.revision_value if revision != "HEAD": gsconf.checksumdb = gsconf.dailydir + revision # mhw +".db" if revision != "HEAD": gsroot = gsconf.root + "gs." + revision + "/" else: gsroot = gsconf.gsroot if options.track: if gsconf.__dict__.has_key("checksumdb") and gsconf.checksumdb: dbname = gsconf.checksumdb else: dbname = gsconf.get_dailydb_name() # create (truncate) the database for the daily checksums db = anydbm.open(dbname, "n") db.close() print options.myself, "daily database for checksums", dbname testAll(options.track, gsroot, now, options) if options.track: dbname = dbname + ".db" # mhw if not os.path.exists(dbname): print options.myself, "ERROR", "the checksum database does not exist", dbname # copy from the db by date to the db by revision if revision == "HEAD":