1644 """Run the 'program'. 1646 'program' -- The path to the program to run. 1648 'arguments' -- A list of the arguments to the program. This 1649 list must contain a first argument corresponding to 'argv[0]'. 1651 'context' -- A 'Context' giving run-time parameters to the 1654 'result' -- A 'Result' object. The outcome will be 1655 'Result.PASS' when this method is called. The 'result' may be 1656 modified by this method to indicate outcomes other than 1657 'Result.PASS' or to add annotations. 1659 @attention: This method has been copied from command.ExecTestBase 1660 (QMTest 2.3.0) and modified to keep stdout and stderr 1661 for tests that have been terminated by a signal. 1662 (Fundamental for debugging in the Application Area) 1666 environment = self.MakeEnvironment(context)
1668 if "slc6" in environment.get(
'CMTCONFIG',
''):
1669 environment[
'TERM'] =
'dumb' 1682 exit_status = e.Run(arguments, environment, path=program)
1684 if e.stack_trace_file
and os.path.exists(e.stack_trace_file):
1685 stack_trace = open(e.stack_trace_file).
read()
1686 os.remove(e.stack_trace_file)
1690 result[
"ExecTest.stack_trace"] = result.Quote(stack_trace)
1693 if (sys.platform ==
"win32" or os.WIFEXITED(exit_status)
1699 if self.exit_code
is None:
1701 elif sys.platform ==
"win32":
1702 exit_code = exit_status
1704 exit_code = os.WEXITSTATUS(exit_status)
1709 result[
"ExecTest.exit_code"] = str(exit_code)
1710 result[
"ExecTest.stdout"] = result.Quote(stdout)
1711 result[
"ExecTest.stderr"] = result.Quote(stderr)
1713 if exit_code != self.exit_code:
1714 causes.append(
"exit_code")
1715 result[
"ExecTest.expected_exit_code"] \
1716 = str(self.exit_code)
1721 result.Fail(
"Unexpected %s." % string.join(causes,
", "))
1722 elif os.WIFSIGNALED(exit_status):
1725 signal_number = str(os.WTERMSIG(exit_status))
1727 result.Fail(
"Program terminated by signal.")
1731 result.Fail(
"Exceeded time limit (%ds), terminated." % timeout)
1732 result[
"ExecTest.signal_number"] = signal_number
1733 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1734 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1736 result[
"ExecTest.expected_signal_number"] = str(self.
signal)
1737 elif os.WIFSTOPPED(exit_status):
1740 signal_number = str(os.WSTOPSIG(exit_status))
1742 result.Fail(
"Program stopped by signal.")
1746 result.Fail(
"Exceeded time limit (%ds), stopped." % timeout)
1747 result[
"ExecTest.signal_number"] = signal_number
1748 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1749 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1753 result.Fail(
"Program did not terminate normally.")
1759 result[
"ExecTest.stdout"] = result[
"ExecTest.stdout"].replace(
def read(f, regex='.*', skipevents=0)
def RunProgram(self, program, arguments, context, result)
def ValidateOutput(self, stdout, stderr, result)