Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/test.py

    rf85bc15 red45af6  
    1919
    2020        def matchTest(path):
    21                 match = re.search("%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.[\w\-_]+)?\.txt" % settings.SRCDIR, path)
     21                match = re.search("(\.[\w\/\-_]*)\/.expect\/([\w\-_]+)(\.[\w\-_]+)?\.txt", path)
    2222                if match :
    2323                        test = Test()
     
    116116#               running test functions
    117117################################################################################
    118 # fix the absolute paths in the output
    119 def fixoutput( fname ):
    120         if not is_ascii(fname):
    121                 return
    122 
    123         file_replace(fname, "%s/" % settings.SRCDIR, "")
    124 
    125 
    126118# logic to run a single test and return the result (No handling of printing or other test framework logic)
    127119def run_single_test(test):
    128120
    129121        # find the output file based on the test name and options flag
    130         exe_file = test.target_executable();
    131122        out_file = test.target_output()
    132123        err_file = test.error_log()
     
    138129
    139130        # remove any outputs from the previous tests to prevent side effects
    140         rm( (out_file, err_file, exe_file) )
     131        rm( (out_file, err_file, test.target()) )
    141132
    142133        # build, skipping to next test on error
     
    155146        if make_ret == 0 or settings.dry_run:
    156147                before = time.time()
    157                 if settings.dry_run or fileIsExecutable(exe_file) :
     148                if settings.dry_run or fileIsExecutable(test.target()) :
    158149                        # run test
    159                         retcode, _ = sh("timeout 60 %s > %s 2>&1" % (exe_file, out_file), input = in_file)
     150                        retcode, _ = sh("timeout 60 %s > %s 2>&1" % (test.target(), out_file), input = in_file)
    160151                else :
    161152                        # simply cat the result into the output
    162                         retcode, _ = sh("cat %s > %s" % (exe_file, out_file))
     153                        retcode, _ = sh("cat %s > %s" % (test.target(), out_file))
    163154
    164155                after = time.time()
     
    179170                else :
    180171                        # fetch return code and error from the diff command
    181                         fixoutput(out_file)
    182172                        retcode, error = diff(cmp_file, out_file)
    183173
     
    251241################################################################################
    252242if __name__ == "__main__":
     243        #always run from same folder
     244        chdir()
    253245
    254246        # parse the command line arguments
Note: See TracChangeset for help on using the changeset viewer.