Changeset 472ca32
- Timestamp:
- Jun 28, 2016, 2:42:16 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 66999e7
- Parents:
- 2e04c7b3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/test.py
r2e04c7b3 r472ca32 21 21 return list 22 22 23 def sh(cmd, dry_run ):23 def sh(cmd, dry_run = False, print2stdout = True): 24 24 if dry_run : 25 25 print("cmd: %s" % cmd) 26 return 0 26 return 0, None 27 27 else : 28 proc = Popen(cmd, std err=STDOUT, shell=True)29 proc.communicate()30 return proc.returncode 28 proc = Popen(cmd, stdout=None if print2stdout else PIPE, stderr=STDOUT, shell=True) 29 out, err = proc.communicate() 30 return proc.returncode, out 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 = None 73 74 74 75 fix_MakeLevel(out_file) … … 76 77 if not generate : 77 78 # diff the output of the files 78 retcode = sh("diff .expect/%s.txt .out/%s.log" % (test, test), dry_run) 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) 79 94 80 95 # clean the executable 81 96 sh("rm -f %s > /dev/null 2>&1" % test, dry_run) 82 97 83 return retcode 98 return retcode, error 84 99 85 100 def run_tests(tests, generate, dry_run) : … … 94 109 print("%20s " % t, end="") 95 110 sys.stdout.flush() 96 test_failed = run_test_instance(t, generate, dry_run)111 test_failed, error = run_test_instance(t, generate, dry_run) 97 112 failed = test_failed or failed 98 113 99 114 if not generate : 100 115 print("FAILED" if test_failed else "PASSED") 116 if error : 117 print(error) 101 118 else : 102 119 print( "Done" )
Note: See TracChangeset
for help on using the changeset viewer.