Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/pybin/test_run.py

    ra2f2fda rf9128a5  
    1111                self.path = ''
    1212                self.arch = ''
    13                 self.astv = ''
    1413
    1514        def toString(self):
    16                 return "{:25s} ({:5s} arch, {:s} ast: {:s})".format( self.name, self.arch if self.arch else "Any", self.astv if self.astv else "Any", self.target() )
     15                return "{:25s} ({:5s} {:s})".format( self.name, self.arch if self.arch else "Any", self.target() )
    1716
    1817        def prepare(self):
     
    2120
    2221        def expect(self):
    23                 arch = '' if not self.arch else ".%s" % self.arch
    24                 astv = '' if not self.astv else ".nast" if self.astv == "new" else ".oast"
    25                 return os.path.normpath( os.path.join(settings.SRCDIR  , self.path, ".expect", "%s%s%s.txt" % (self.name,astv,arch)) )
     22                return os.path.normpath( os.path.join(settings.SRCDIR  , self.path, ".expect", "%s%s.txt" % (self.name,'' if not self.arch else ".%s" % self.arch)) )
    2623
    2724        def error_log(self):
     
    4340                return os.path.normpath( os.path.join(settings.BUILDDIR, self.path, self.name) )
    4441
    45         @staticmethod
    46         def valid_name(name):
     42        @classmethod
     43        def valid_name(_, name):
    4744                return not name.endswith( ('.c', '.cc', '.cpp', '.cfa') )
    4845
    49         @staticmethod
    50         def new_target(target, arch, astv):
     46        @classmethod
     47        def from_target(_, target):
    5148                test = Test()
    5249                test.name = os.path.basename(target)
    5350                test.path = os.path.relpath (os.path.dirname(target), settings.SRCDIR)
    54                 test.arch = arch.target if arch else ''
    55                 test.astv = astv.target if astv else ''
     51                test.arch = settings.arch.target if settings.arch.cross_compile else ''
    5652                return test
    5753
     
    7369                        else :                                          text = "FAILED with code %d" % retcode
    7470
    75                 text += "    C%s - R%s" % (fmtDur(duration[0]), fmtDur(duration[1]))
     71                text += "    C%s - R%s" % (cls.fmtDur(duration[0]), cls.fmtDur(duration[1]))
    7672                return text
     73
     74        @classmethod
     75        def fmtDur( cls, duration ):
     76                if duration :
     77                        hours, rem = divmod(duration, 3600)
     78                        minutes, rem = divmod(rem, 60)
     79                        seconds, millis = divmod(rem, 1)
     80                        return "%2d:%02d.%03d" % (minutes, seconds, millis * 1000)
     81                return " n/a"
Note: See TracChangeset for help on using the changeset viewer.