Changeset ff29f08 for src/tests/pybin


Ignore:
Timestamp:
May 18, 2018, 2:09:21 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
2472a19
Parents:
f6f0cca3 (diff), c7d8100c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'origin/master' into with_gc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/pybin/test_run.py

    rf6f0cca3 rff29f08  
    44
    55import pybin.settings
     6import datetime
     7
     8from string import Template
     9
     10class DeltaTemplate(Template):
     11    delimiter = "%"
     12
     13def strfdelta(tdelta, fmt):
     14    d["H"], rem = divmod(tdelta.seconds, 3600)
     15    d["M"], d["S"] = divmod(rem, 60)
     16    t = DeltaTemplate(fmt)
     17    return t.substitute(**d)
    618
    719# Test class that defines what a test is
     
    5769
    5870        @classmethod
    59         def toString( cls, retcode ):
     71        def toString( cls, retcode, duration ):
    6072                if settings.generating :
    61                         if   retcode == TestResult.SUCCESS:     return "Done"
    62                         elif retcode == TestResult.TIMEOUT:     return "TIMEOUT"
    63                         else :                                          return "ERROR code %d" % retcode
     73                        if   retcode == TestResult.SUCCESS:     text = "Done   "
     74                        elif retcode == TestResult.TIMEOUT:     text = "TIMEOUT"
     75                        else :                                          text = "ERROR code %d" % retcode
    6476                else :
    65                         if   retcode == TestResult.SUCCESS:     return "PASSED"
    66                         elif retcode == TestResult.TIMEOUT:     return "TIMEOUT"
    67                         else :                                          return "FAILED with code %d" % retcode
     77                        if   retcode == TestResult.SUCCESS:     text = "PASSED "
     78                        elif retcode == TestResult.TIMEOUT:     text = "TIMEOUT"
     79                        else :                                          text = "FAILED with code %d" % retcode
     80
     81                text += "    C%s - R%s" % (cls.fmtDur(duration[0]), cls.fmtDur(duration[1]))
     82                return text
     83
     84        @classmethod
     85        def fmtDur( cls, duration ):
     86                if duration :
     87                        hours, rem = divmod(duration, 3600)
     88                        minutes, rem = divmod(rem, 60)
     89                        seconds, millis = divmod(rem, 1)
     90                        return "%2d:%02d.%03d" % (minutes, seconds, millis * 1000)
     91                return " n/a"
Note: See TracChangeset for help on using the changeset viewer.