Changes in src/tests/test.py [472ca32:7bd045d]
- File:
-
- 1 edited
-
src/tests/test.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/tests/test.py
r472ca32 r7bd045d 21 21 return list 22 22 23 def sh(cmd, dry_run = False, print2stdout = True):23 def sh(cmd, dry_run): 24 24 if dry_run : 25 25 print("cmd: %s" % cmd) 26 return 0 , None26 return 0 27 27 else : 28 proc = Popen(cmd, std out=None if print2stdout else PIPE, stderr=STDOUT, shell=True)29 out, err =proc.communicate()30 return proc.returncode , out28 proc = Popen(cmd, stderr=STDOUT, shell=True) 29 proc.communicate() 30 return proc.returncode 31 31 32 32 def file_replace(fname, pat, s_after): … … 61 61 62 62 # 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) 64 64 65 65 if make_ret == 0 : … … 71 71 72 72 retcode = 0 73 error = None74 73 75 74 fix_MakeLevel(out_file) … … 77 76 if not generate : 78 77 # 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) 94 79 95 80 # clean the executable 96 81 sh("rm -f %s > /dev/null 2>&1" % test, dry_run) 97 82 98 return retcode , error83 return retcode 99 84 100 85 def run_tests(tests, generate, dry_run) : … … 109 94 print("%20s " % t, end="") 110 95 sys.stdout.flush() 111 test_failed , error= run_test_instance(t, generate, dry_run)96 test_failed = run_test_instance(t, generate, dry_run) 112 97 failed = test_failed or failed 113 98 114 99 if not generate : 115 100 print("FAILED" if test_failed else "PASSED") 116 if error :117 print(error)118 101 else : 119 102 print( "Done" )
Note:
See TracChangeset
for help on using the changeset viewer.