llvm.org GIT mirror llvm / e1e5746
Change the logic which interprets output on stderr as an error so that it doesn't modify the exit code or the stdout contents, and so that it doesn't clutter the output with "Command has output on stderr!". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110171 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 9 years ago
1 changed file(s) with 38 addition(s) and 46 deletion(s). Raw diff Collapse all Expand all
311311 out,err,exitCode = executeCommand(command, cwd=cwd,
312312 env=test.config.environment)
313313
314 # Tcl commands fail on standard error output.
315 if err:
316 exitCode = 1
317 out = 'Command has output on stderr!\n\n' + out
318
319314 return out,err,exitCode
320315 else:
321316 results = []
326321 exitCode = 255
327322
328323 out = err = ''
329
330 # Tcl commands fail on standard error output.
331 if [True for _,_,err,res in results if err]:
332 exitCode = 1
333 out += 'Command has output on stderr!\n\n'
334324
335325 for i,(cmd, cmd_out, cmd_err, res) in enumerate(results):
336326 out += 'Command %d: %s\n' % (i, ' '.join('"%s"' % s for s in cmd.args))
520510 if len(res) == 2:
521511 return res
522512
513 # Test for failure. In addition to the exit code, Tcl commands fail
514 # if there is any standard error output.
515 out,err,exitCode = res
516 if isXFail:
517 ok = exitCode != 0 or err
518 status = Test.XFAIL if ok else Test.XPASS
519 else:
520 ok = exitCode == 0 and not err
521 status = Test.PASS if ok else Test.FAIL
522
523 if ok:
524 return (status,'')
525
526 return formatTestOutput(status, out, err, exitCode, script)
527
528 def executeShTest(test, litConfig, useExternalSh):
529 if test.config.unsupported:
530 return (Test.UNSUPPORTED, 'Test is unsupported')
531
532 res = parseIntegratedTestScript(test)
533 if len(res) == 2:
534 return res
535
536 script, isXFail, tmpBase, execdir = res
537
538 if litConfig.noExecute:
539 return (Test.PASS, '')
540
541 # Create the output directory if it does not already exist.
542 Util.mkdir_p(os.path.dirname(tmpBase))
543
544 if useExternalSh:
545 res = executeScript(test, litConfig, tmpBase, script, execdir)
546 else:
547 res = executeScriptInternal(test, litConfig, tmpBase, script, execdir)
548 if len(res) == 2:
549 return res
550
523551 out,err,exitCode = res
524552 if isXFail:
525553 ok = exitCode != 0
532560 return (status,'')
533561
534562 return formatTestOutput(status, out, err, exitCode, script)
535
536 def executeShTest(test, litConfig, useExternalSh):
537 if test.config.unsupported:
538 return (Test.UNSUPPORTED, 'Test is unsupported')
539
540 res = parseIntegratedTestScript(test)
541 if len(res) == 2:
542 return res
543
544 script, isXFail, tmpBase, execdir = res
545
546 if litConfig.noExecute:
547 return (Test.PASS, '')
548
549 # Create the output directory if it does not already exist.
550 Util.mkdir_p(os.path.dirname(tmpBase))
551
552 if useExternalSh:
553 res = executeScript(test, litConfig, tmpBase, script, execdir)
554 else:
555 res = executeScriptInternal(test, litConfig, tmpBase, script, execdir)
556 if len(res) == 2:
557 return res
558
559 out,err,exitCode = res
560 if isXFail:
561 ok = exitCode != 0
562 status = Test.XFAIL if ok else Test.XPASS
563 else:
564 ok = exitCode == 0
565 status = Test.PASS if ok else Test.FAIL
566
567 if ok:
568 return (status,'')
569
570 return formatTestOutput(status, out, err, exitCode, script)