Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/test.py

    red45af6 rf85bc15  
    1919
    2020        def matchTest(path):
    21                 match = re.search("(\.[\w\/\-_]*)\/.expect\/([\w\-_]+)(\.[\w\-_]+)?\.txt", path)
     21                match = re.search("%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.[\w\-_]+)?\.txt" % settings.SRCDIR, path)
    2222                if match :
    2323                        test = Test()
     
    116116#               running test functions
    117117################################################################################
     118# fix the absolute paths in the output
     119def fixoutput( fname ):
     120        if not is_ascii(fname):
     121                return
     122
     123        file_replace(fname, "%s/" % settings.SRCDIR, "")
     124
     125
    118126# logic to run a single test and return the result (No handling of printing or other test framework logic)
    119127def run_single_test(test):
    120128
    121129        # find the output file based on the test name and options flag
     130        exe_file = test.target_executable();
    122131        out_file = test.target_output()
    123132        err_file = test.error_log()
     
    129138
    130139        # remove any outputs from the previous tests to prevent side effects
    131         rm( (out_file, err_file, test.target()) )
     140        rm( (out_file, err_file, exe_file) )
    132141
    133142        # build, skipping to next test on error
     
    146155        if make_ret == 0 or settings.dry_run:
    147156                before = time.time()
    148                 if settings.dry_run or fileIsExecutable(test.target()) :
     157                if settings.dry_run or fileIsExecutable(exe_file) :
    149158                        # run test
    150                         retcode, _ = sh("timeout 60 %s > %s 2>&1" % (test.target(), out_file), input = in_file)
     159                        retcode, _ = sh("timeout 60 %s > %s 2>&1" % (exe_file, out_file), input = in_file)
    151160                else :
    152161                        # simply cat the result into the output
    153                         retcode, _ = sh("cat %s > %s" % (test.target(), out_file))
     162                        retcode, _ = sh("cat %s > %s" % (exe_file, out_file))
    154163
    155164                after = time.time()
     
    170179                else :
    171180                        # fetch return code and error from the diff command
     181                        fixoutput(out_file)
    172182                        retcode, error = diff(cmp_file, out_file)
    173183
     
    241251################################################################################
    242252if __name__ == "__main__":
    243         #always run from same folder
    244         chdir()
    245253
    246254        # parse the command line arguments
Note: See TracChangeset for help on using the changeset viewer.