Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/test.py

    r472ca32 r7bd045d  
    2121        return list
    2222
    23 def sh(cmd, dry_run = False, print2stdout = True):
     23def sh(cmd, dry_run):
    2424        if dry_run :
    2525                print("cmd: %s" % cmd)
    26                 return 0, None
     26                return 0
    2727        else :
    28                 proc = Popen(cmd, stdout=None if print2stdout else PIPE, stderr=STDOUT, shell=True)
    29                 out, err = proc.communicate()
    30                 return proc.returncode, out
     28                proc = Popen(cmd, stderr=STDOUT, shell=True)
     29                proc.communicate()
     30                return proc.returncode
    3131
    3232def file_replace(fname, pat, s_after):
     
    6161
    6262        # build, skipping to next test on error
    63         make_ret, _ = sh("%s %s 2> %s 1> /dev/null" % (make_cmd, test, out_file), dry_run)
     63        make_ret = sh("%s %s 2> %s 1> /dev/null" % (make_cmd, test, out_file), dry_run)
    6464
    6565        if make_ret == 0 :
     
    7171
    7272        retcode = 0
    73         error = None
    7473
    7574        fix_MakeLevel(out_file)
     
    7776        if not generate :
    7877                # diff the output of the files
    79                 diff_cmd = ("diff --old-group-format='\t\tmissing lines :\n"
    80                                         "%%<' \\\n"
    81                                         "--new-group-format='\t\tnew lines :\n"
    82                                         "%%>' \\\n"
    83                                         "--unchanged-group-format='%%=' \\"
    84                                         "--changed-group-format='\t\texpected :\n"
    85                                         "%%<\n"
    86                                         "\t\tgot :\n"
    87                                         "%%>' \\\n"
    88                                         "--new-line-format='\t\t%%dn\t%%L' \\\n"
    89                                         "--old-line-format='\t\t%%dn\t%%L' \\\n"
    90                                         "--unchanged-line-format='' \\\n"
    91                                         ".expect/%s.txt .out/%s.log")
    92 
    93                 retcode, error = sh(diff_cmd % (test, test), dry_run, False)
     78                retcode = sh("diff .expect/%s.txt .out/%s.log" % (test, test), dry_run)
    9479
    9580        # clean the executable
    9681        sh("rm -f %s > /dev/null 2>&1" % test, dry_run)
    9782
    98         return retcode, error
     83        return retcode
    9984
    10085def run_tests(tests, generate, dry_run) :
     
    10994                print("%20s  " % t, end="")
    11095                sys.stdout.flush()
    111                 test_failed, error = run_test_instance(t, generate, dry_run)
     96                test_failed = run_test_instance(t, generate, dry_run)
    11297                failed = test_failed or failed
    11398
    11499                if not generate :
    115100                        print("FAILED" if test_failed else "PASSED")
    116                         if error :
    117                                 print(error)
    118101                else :
    119102                        print( "Done" )
Note: See TracChangeset for help on using the changeset viewer.