Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/test.py

    rf806b61 ra45fc7b  
    88import re
    99import sys
    10 import tempfile
    1110import time
    1211
     
    144143                make_ret, _ = make( test.target(), output=subprocess.DEVNULL, error=out_file, error_file = err_file )
    145144
     145        # if the make command succeds continue otherwise skip to diff
    146146        run_dur = None
    147         # run everything in a temp directory to make sure core file are handled properly
    148         with tempdir():
    149                 # if the make command succeds continue otherwise skip to diff
    150                 if success(make_ret):
    151                         with Timed() as run_dur:
    152                                 if settings.dry_run or is_exe(exe_file):
    153                                         # run test
    154                                         retcode, _ = sh(exe_file, output=out_file, input=in_file, timeout=True)
    155                                 else :
    156                                         # simply cat the result into the output
    157                                         retcode = cat(exe_file, out_file)
    158                 else:
    159                         retcode = mv(err_file, out_file)
    160 
    161                 if success(retcode):
    162                         if settings.generating :
    163                                 # if we are ounly generating the output we still need to check that the test actually exists
    164                                 if no_rule(out_file, test.target()) :
    165                                         retcode = 1
    166                                         error = "\t\tNo make target for test %s!" % test.target()
    167                                         rm(out_file)
    168                                 else:
    169                                         error = None
     147        if success(make_ret):
     148                with Timed() as run_dur:
     149                        if settings.dry_run or is_exe(exe_file):
     150                                # run test
     151                                retcode, _ = sh(exe_file, output=out_file, input=in_file, timeout=True)
    170152                        else :
    171                                 # fetch return code and error from the diff command
    172                                 retcode, error = diff(cmp_file, out_file)
    173 
    174                 else:
    175                         with open (out_file, "r") as myfile:
    176                                 error = myfile.read()
    177 
    178                         ret, info = core_info(exe_file)
    179                         error = error + info if error else info
     153                                # simply cat the result into the output
     154                                retcode = cat(exe_file, out_file)
     155        else:
     156                retcode = mv(err_file, out_file)
     157
     158        if success(retcode):
     159                if settings.generating :
     160                        # if we are ounly generating the output we still need to check that the test actually exists
     161                        if no_rule(out_file, test.target()) :
     162                                retcode = 1
     163                                error = "\t\tNo make target for test %s!" % test.target()
     164                                rm(out_file)
     165                        else:
     166                                error = None
     167                else :
     168                        # fetch return code and error from the diff command
     169                        retcode, error = diff(cmp_file, out_file)
     170
     171        else:
     172                with open (out_file, "r") as myfile:
     173                        error = myfile.read()
     174
     175                ret, info = core_info(exe_file)
     176                error = error + info if error else info
    180177
    181178
Note: See TracChangeset for help on using the changeset viewer.