示例#1
0
 def movie(self, list_of_psfiles):
     """Insert HTML commands for an animated gif picture."""
     # convert to animated gif:
     filelist = string.join(list_of_psfiles, ' ')
     pid = os.getpid()  # use pid to make unique giffile name
     giffile_with_full_path = '%s/anim-%d.gif' % \
                             (self.scratchdir,pid)
     print 'making an animated gif sequence of psfiles:',filelist
     os_system('convert -loop 60 -delay 10 %s %s' % \
               (filelist,giffile_with_full_path))
     self._insertgif (giffile_with_full_path)
示例#2
0
 def movie(self, list_of_psfiles):
     """Insert HTML commands for an animated gif picture."""
     # convert to animated gif:
     filelist = string.join(list_of_psfiles, ' ')
     pid = os.getpid()  # use pid to make unique giffile name
     giffile_with_full_path = '%s/anim-%d.gif' % \
                             (self.scratchdir,pid)
     print 'making an animated gif sequence of psfiles:', filelist
     os_system('convert -loop 60 -delay 10 %s %s' % \
               (filelist,giffile_with_full_path))
     self._insertgif(giffile_with_full_path)
示例#3
0
 def picture(self, psfile):
     """Insert HTML commands for a gif picture."""
     # convert to gif:
     filestem = re.sub(r'(.*)\.[e]?ps', '', psfile)
     print 'picture: psfile=',psfile,'filestem=',filestem
     os_system('convert %s gif:%s.gif' % (psfile, filestem))
     pid = os.getpid()  # use pid to makea unique giffile name
     giffile_with_full_path = '%s/%s-%d.gif' % \
                             (self.scratchdir,pid,filestem)
     os.rename('%s.gif %s' % (filestem, giffile_with_full_path))
     self._insertgif (giffile_with_full_path)
示例#4
0
 def picture(self, psfile):
     """Insert HTML commands for a gif picture."""
     # convert to gif:
     filestem = re.sub(r'(.*)\.[e]?ps', '', psfile)
     print 'picture: psfile=', psfile, 'filestem=', filestem
     os_system('convert %s gif:%s.gif' % (psfile, filestem))
     pid = os.getpid()  # use pid to makea unique giffile name
     giffile_with_full_path = '%s/%s-%d.gif' % \
                             (self.scratchdir,pid,filestem)
     os.rename('%s.gif %s' % (filestem, giffile_with_full_path))
     self._insertgif(giffile_with_full_path)
示例#5
0
    def run(self, program, options='', inputfile=''):
        """Run program, store output on logfile."""
        # the logfile is always opened in the constructor so
        # we can safely append here
        vfile = open(self.logfile, 'a')
        vfile.write('\n#### Test: %s' % (self.scriptfilename))
        vfile.write(' running %(program)s %(options)s\n' % vars())
        vfile.close()

        # do not use time.clock() to measure CPU time; it will not
        # notice the CPU time(here waiting time) of a system command
        t0 = os.times()  # [user,system,cuser,csystem,elapsed]
        if inputfile == '':
            cmd = '%s %s >> %s' % (program,options,self.logfile)
        else:
            cmd = '%s %s < %s >> %s' % (program,options,inputfile,self.logfile)
        failure, output = os_system(cmd, failure_handling='silent')
        if failure:
            vfile = open(self.logfile, 'a')
            msg = 'ERROR in %s: execution failure arose from the ' \
                  'command\n  %s\n\n%s\n\n' % (self.scriptfilename,cmd,output)
            vfile.write(msg)
            vfile.close()
            print msg
        # write CPU time of system command(user+system time
        # of child processes):
        t1 = os.times(); tm = t1[2] - t0[2] + t1[3] - t0[3]
        vfile = open(self.logfile, 'a')
        vfile.write('CPU time of %(program)s: %(tm).1f seconds' % vars())
        #if re.search('(x|sun)',sys.platform):
        if os.name == 'posix':  # is 'posix', 'nt' or 'mac'
            # unix
            u = os.uname()
            vfile.write(' on %s %s, %s' % (u[1],u[4],u[0]))
        vfile.write('\n\n')
示例#6
0
 def run(self, scriptfile):
     # recall that os.chdir has been taken to the scriptfiles's dir
     path = os.path.join(os.curdir, scriptfile)
     # path is executable since we made an os.chmod in self._diff
     failure, output = os_system(path, failure_handling='silent')
     if failure:
         print 'Failure in regression test', path
         print output
示例#7
0
 def run(self, scriptfile):
     # recall that os.chdir has been taken to the scriptfiles's dir
     path = os.path.join(os.curdir, scriptfile)
     # path is executable since we made an os.chmod in self._diff
     failure, output = os_system(path, failure_handling='silent')
     if failure:
         print 'Failure in regression test', path
         print output
示例#8
0
    def floatdump(self, program, options=''):
        """Run program and direct output to self.floatlogfile."""
        if not os.path.isfile(self.floatlogfile):
            # bring the float logfile into existence:
            ff = open(self.floatlogfile, 'w'); ff.close()

        cmd = '%s %s >> %s' % (program,options,self.floatlogfile)
        failure, output = os_system(cmd, failure_handling='silent')
        if failure:
            msg = 'ERROR in %s: execution failure arose from the ' \
                  'command\n  %s\n%s\n\n' % (self.scriptfilename,cmd,output)
            print msg
示例#9
0
 def clean(self, dirname):
     """Clean up files, typically executables etc."""
     # is this a Verify directory? (recall that we have chdir'ed to dir)
     if string.count(os.getcwd(), '/Verify'):
         # go to parent directory and clean application:
         thisdir = os.getcwd();  os.chdir(os.pardir)
         if os.path.isfile('Makefile'):
             # yes, we have a makefile!
             failure, output = os_system('Make clean',
                                         failure_handling='silent')
             if failure:
                 print 'Could not run Make clean in directory', os.getcwd()
         os.chdir(thisdir)
示例#10
0
    def floatdump(self, program, options=''):
        """Run program and direct output to self.floatlogfile."""
        if not os.path.isfile(self.floatlogfile):
            # bring the float logfile into existence:
            ff = open(self.floatlogfile, 'w')
            ff.close()

        cmd = '%s %s >> %s' % (program, options, self.floatlogfile)
        failure, output = os_system(cmd, failure_handling='silent')
        if failure:
            msg = 'ERROR in %s: execution failure arose from the ' \
                  'command\n  %s\n%s\n\n' % (self.scriptfilename,cmd,output)
            print msg
示例#11
0
 def clean(self, dirname):
     """Clean up files, typically executables etc."""
     # is this a Verify directory? (recall that we have chdir'ed to dir)
     if string.count(os.getcwd(), '/Verify'):
         # go to parent directory and clean application:
         thisdir = os.getcwd()
         os.chdir(os.pardir)
         if os.path.isfile('Makefile'):
             # yes, we have a makefile!
             failure, output = os_system('Make clean',
                                         failure_handling='silent')
             if failure:
                 print 'Could not run Make clean in directory', os.getcwd()
         os.chdir(thisdir)
示例#12
0
 def graphics(self, program, options=''):
     """
     Run e.g. graphics program if the environment variable
     BATCH_REGRESSION is not set.
     """
     batch = int(os.environ.get('BATCH_REGRESSION', 0))
     if not batch:
         failure, output = os_system('%s %s' % (program,options),
                                     failure_handling='silent')
         if failure:
             vfile = open(self.logfile, 'a')
             msg = 'ERROR in %s: execution failure with %s %s\n%s\n' % \
                   (self.scriptfilename,program,options,output)
             vfile.write(msg)
             print msg
示例#13
0
 def graphics(self, program, options=''):
     """
     Run e.g. graphics program if the environment variable
     BATCH_REGRESSION is not set.
     """
     batch = int(os.environ.get('BATCH_REGRESSION', 0))
     if not batch:
         failure, output = os_system('%s %s' % (program, options),
                                     failure_handling='silent')
         if failure:
             vfile = open(self.logfile, 'a')
             msg = 'ERROR in %s: execution failure with %s %s\n%s\n' % \
                   (self.scriptfilename,program,options,output)
             vfile.write(msg)
             print msg
示例#14
0
    def run(self, scriptfile):
        """Run script, but compile the application first."""
        # is this a Verify directory? (recall that we have chdir'ed to dir)
        if string.count(os.getcwd(), '/Verify'):
            # go to parent directory (os.pardir is '..'):
            thisdir = os.getcwd();  os.chdir(os.pardir)
            #print '\na Verify dir with a parent dir\n  ',os.getcwd(),\
            #      '\nLet's compile!\n'
            print '\n...compile app in', os.getcwd()
            if os.path.isfile('Makefile'):
                # yes, we have a makefile!
                failure, output = os_system('Make MODE=%s' % self.makemode,
                                            failure_handling='silent')
                if failure:
                    print 'Could not compile in directory', os.getcwd()
            os.chdir(thisdir) # back to Verify dir

            print '\n\n...run regression test ''+scriptfile+'' for VerifyDiffpack.run:'
        # call parent class' run function:
        Verify.run(self,scriptfile)
示例#15
0
    def run(self, scriptfile):
        """Run script, but compile the application first."""
        # is this a Verify directory? (recall that we have chdir'ed to dir)
        if string.count(os.getcwd(), '/Verify'):
            # go to parent directory (os.pardir is '..'):
            thisdir = os.getcwd()
            os.chdir(os.pardir)
            #print '\na Verify dir with a parent dir\n  ',os.getcwd(),\
            #      '\nLet's compile!\n'
            print '\n...compile app in', os.getcwd()
            if os.path.isfile('Makefile'):
                # yes, we have a makefile!
                failure, output = os_system('Make MODE=%s' % self.makemode,
                                            failure_handling='silent')
                if failure:
                    print 'Could not compile in directory', os.getcwd()
            os.chdir(thisdir)  # back to Verify dir

            print '\n\n...run regression test ' '+scriptfile+' ' for VerifyDiffpack.run:'
        # call parent class' run function:
        Verify.run(self, scriptfile)
示例#16
0
    def run(self, program, options='', inputfile=''):
        """Run program, store output on logfile."""
        # the logfile is always opened in the constructor so
        # we can safely append here
        vfile = open(self.logfile, 'a')
        vfile.write('\n#### Test: %s' % (self.scriptfilename))
        vfile.write(' running %(program)s %(options)s\n' % vars())
        vfile.close()

        # do not use time.clock() to measure CPU time; it will not
        # notice the CPU time(here waiting time) of a system command
        t0 = os.times()  # [user,system,cuser,csystem,elapsed]
        if inputfile == '':
            cmd = '%s %s >> %s' % (program, options, self.logfile)
        else:
            cmd = '%s %s < %s >> %s' % (program, options, inputfile,
                                        self.logfile)
        failure, output = os_system(cmd, failure_handling='silent')
        if failure:
            vfile = open(self.logfile, 'a')
            msg = 'ERROR in %s: execution failure arose from the ' \
                  'command\n  %s\n\n%s\n\n' % (self.scriptfilename,cmd,output)
            vfile.write(msg)
            vfile.close()
            print msg
        # write CPU time of system command(user+system time
        # of child processes):
        t1 = os.times()
        tm = t1[2] - t0[2] + t1[3] - t0[3]
        vfile = open(self.logfile, 'a')
        vfile.write('CPU time of %(program)s: %(tm).1f seconds' % vars())
        #if re.search('(x|sun)',sys.platform):
        if os.name == 'posix':  # is 'posix', 'nt' or 'mac'
            # unix
            u = os.uname()
            vfile.write(' on %s %s, %s' % (u[1], u[4], u[0]))
        vfile.write('\n\n')