aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing')
-rwxr-xr-xtools/testing/selftests/tc-testing/tdc.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/testing/selftests/tc-testing/tdc.py b/tools/testing/selftests/tc-testing/tdc.py
index 87a04a8a5945..7607ba3e3cbe 100755
--- a/tools/testing/selftests/tc-testing/tdc.py
+++ b/tools/testing/selftests/tc-testing/tdc.py
@@ -134,9 +134,9 @@ def exec_cmd(args, pm, stage, command):
134 (rawout, serr) = proc.communicate() 134 (rawout, serr) = proc.communicate()
135 135
136 if proc.returncode != 0 and len(serr) > 0: 136 if proc.returncode != 0 and len(serr) > 0:
137 foutput = serr.decode("utf-8") 137 foutput = serr.decode("utf-8", errors="ignore")
138 else: 138 else:
139 foutput = rawout.decode("utf-8") 139 foutput = rawout.decode("utf-8", errors="ignore")
140 140
141 proc.stdout.close() 141 proc.stdout.close()
142 proc.stderr.close() 142 proc.stderr.close()
@@ -169,6 +169,8 @@ def prepare_env(args, pm, stage, prefix, cmdlist, output = None):
169 file=sys.stderr) 169 file=sys.stderr)
170 print("\n{} *** Error message: \"{}\"".format(prefix, foutput), 170 print("\n{} *** Error message: \"{}\"".format(prefix, foutput),
171 file=sys.stderr) 171 file=sys.stderr)
172 print("returncode {}; expected {}".format(proc.returncode,
173 exit_codes))
172 print("\n{} *** Aborting test run.".format(prefix), file=sys.stderr) 174 print("\n{} *** Aborting test run.".format(prefix), file=sys.stderr)
173 print("\n\n{} *** stdout ***".format(proc.stdout), file=sys.stderr) 175 print("\n\n{} *** stdout ***".format(proc.stdout), file=sys.stderr)
174 print("\n\n{} *** stderr ***".format(proc.stderr), file=sys.stderr) 176 print("\n\n{} *** stderr ***".format(proc.stderr), file=sys.stderr)
@@ -195,12 +197,18 @@ def run_one_test(pm, args, index, tidx):
195 print('-----> execute stage') 197 print('-----> execute stage')
196 pm.call_pre_execute() 198 pm.call_pre_execute()
197 (p, procout) = exec_cmd(args, pm, 'execute', tidx["cmdUnderTest"]) 199 (p, procout) = exec_cmd(args, pm, 'execute', tidx["cmdUnderTest"])
198 exit_code = p.returncode 200 if p:
201 exit_code = p.returncode
202 else:
203 exit_code = None
204
199 pm.call_post_execute() 205 pm.call_post_execute()
200 206
201 if (exit_code != int(tidx["expExitCode"])): 207 if (exit_code is None or exit_code != int(tidx["expExitCode"])):
202 result = False 208 result = False
203 print("exit:", exit_code, int(tidx["expExitCode"])) 209 print("exit: {!r}".format(exit_code))
210 print("exit: {}".format(int(tidx["expExitCode"])))
211 #print("exit: {!r} {}".format(exit_code, int(tidx["expExitCode"])))
204 print(procout) 212 print(procout)
205 else: 213 else:
206 if args.verbose > 0: 214 if args.verbose > 0: