+ # Append the outputs, if present.
+ if out:
+ output += """Command Output (stdout):\n--\n%s\n--\n""" % (out,)
+ if err:
+ output += """Command Output (stderr):\n--\n%s\n--\n""" % (err,)
+
+ return lit.Test.Result(status, output)
+
+
+def executeShTest(test, litConfig, useExternalSh,
+ extra_substitutions=[]):
+ if test.config.unsupported:
+ return (Test.UNSUPPORTED, 'Test is unsupported')
+
+ res = parseIntegratedTestScript(test, useExternalSh, extra_substitutions)
+ if isinstance(res, lit.Test.Result):
+ return res
+ if litConfig.noExecute:
+ return lit.Test.Result(Test.PASS)
+
+ script, tmpBase, execdir = res
+
+ # Re-run failed tests up to test_retry_attempts times.
+ attempts = 1
+ if hasattr(test.config, 'test_retry_attempts'):
+ attempts += test.config.test_retry_attempts
+ for i in range(attempts):
+ res = _runShTest(test, litConfig, useExternalSh, script, tmpBase, execdir)
+ if res.code != Test.FAIL:
+ break
+ # If we had to run the test more than once, count it as a flaky pass. These
+ # will be printed separately in the test summary.
+ if i > 0 and res.code == Test.PASS:
+ res.code = Test.FLAKYPASS
+ return res