Changeset 21bdce2 for src/tests/test.py


Ignore:
Timestamp:
May 21, 2018, 10:52:15 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
2f0a0678
Parents:
b12c036 (diff), 1596726 (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 branch 'master' of plg2:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/test.py

    rb12c036 r21bdce2  
    99import re
    1010import sys
     11import time
    1112
    1213################################################################################
     
    9596        parser.add_argument('--all', help='Run all test available', action='store_true')
    9697        parser.add_argument('--regenerate-expected', help='Regenerate the .expect by running the specified tets, can be used with --all option', action='store_true')
    97         parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int, default='8')
     98        parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int)
    9899        parser.add_argument('--list-comp', help='List all valide arguments', action='store_true')
    99100        parser.add_argument('-I','--include', help='Directory of test to include, can be used multiple time, All  if omitted', action='append')
     
    136137
    137138        # build, skipping to next test on error
     139        before = time.time()
    138140        make_ret, _ = make( test.target(),
    139141                redirects  = "2> %s 1> /dev/null" % out_file,
    140142                error_file = err_file
    141143        )
     144        after = time.time()
     145
     146        comp_dur = after - before
     147
     148        run_dur = None
    142149
    143150        # if the make command succeds continue otherwise skip to diff
    144151        if make_ret == 0 or settings.dry_run:
     152                before = time.time()
    145153                if settings.dry_run or fileIsExecutable(test.target()) :
    146154                        # run test
     
    149157                        # simply cat the result into the output
    150158                        retcode, _ = sh("cat %s > %s" % (test.target(), out_file))
     159
     160                after = time.time()
     161                run_dur = after - before
    151162        else:
    152163                retcode, _ = sh("mv %s %s" % (err_file, out_file))
     
    174185        sh("rm -f %s > /dev/null 2>&1" % test.target())
    175186
    176         return retcode, error
     187        return retcode, error, [comp_dur, run_dur]
    177188
    178189# run a single test and handle the errors, outputs, printing, exception handling, etc.
     
    183194                name_txt = "%20s  " % t.name
    184195
    185                 retcode, error = run_single_test(t)
     196                retcode, error, duration = run_single_test(t)
    186197
    187198                # update output based on current action
    188                 result_txt = TestResult.toString( retcode )
     199                result_txt = TestResult.toString( retcode, duration )
    189200
    190201                #print result with error if needed
Note: See TracChangeset for help on using the changeset viewer.