1708 def RunProgram(self, program, arguments, context, result):
1709 """Run the 'program'. 1711 'program' -- The path to the program to run. 1713 'arguments' -- A list of the arguments to the program. This 1714 list must contain a first argument corresponding to 'argv[0]'. 1716 'context' -- A 'Context' giving run-time parameters to the 1719 'result' -- A 'Result' object. The outcome will be 1720 'Result.PASS' when this method is called. The 'result' may be 1721 modified by this method to indicate outcomes other than 1722 'Result.PASS' or to add annotations. 1724 @attention: This method has been copied from command.ExecTestBase 1725 (QMTest 2.3.0) and modified to keep stdout and stderr 1726 for tests that have been terminated by a signal. 1727 (Fundamental for debugging in the Application Area) 1731 environment = self.MakeEnvironment(context)
1733 if "slc6" in environment.get(
'CMTCONFIG',
''):
1734 environment[
'TERM'] =
'dumb' 1736 if self.timeout >= 0:
1737 timeout = self.timeout
1745 e = GaudiFilterExecutable(self.stdin, timeout)
1747 exit_status = e.Run(arguments, environment, path=program)
1749 if e.stack_trace_file
and os.path.exists(e.stack_trace_file):
1750 stack_trace = open(e.stack_trace_file).
read()
1751 os.remove(e.stack_trace_file)
1755 result[
"ExecTest.stack_trace"] = result.Quote(stack_trace)
1758 if (sys.platform ==
"win32" or os.WIFEXITED(exit_status)
1759 or self.signal == os.WTERMSIG(exit_status)):
1764 if self.exit_code
is None:
1766 elif sys.platform ==
"win32":
1767 exit_code = exit_status
1769 exit_code = os.WEXITSTATUS(exit_status)
1774 result[
"ExecTest.exit_code"] = str(exit_code)
1775 result[
"ExecTest.stdout"] = result.Quote(stdout)
1776 result[
"ExecTest.stderr"] = result.Quote(stderr)
1778 if exit_code != self.exit_code:
1779 causes.append(
"exit_code")
1780 result[
"ExecTest.expected_exit_code"] \
1781 = str(self.exit_code)
1783 causes += self.ValidateOutput(stdout, stderr, result)
1786 result.Fail(
"Unexpected %s." % string.join(causes,
", "))
1787 elif os.WIFSIGNALED(exit_status):
1790 signal_number = str(os.WTERMSIG(exit_status))
1792 result.Fail(
"Program terminated by signal.")
1796 result.Fail(
"Exceeded time limit (%ds), terminated." % timeout)
1797 result[
"ExecTest.signal_number"] = signal_number
1798 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1799 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1801 result[
"ExecTest.expected_signal_number"] = str(self.signal)
1802 elif os.WIFSTOPPED(exit_status):
1805 signal_number = str(os.WSTOPSIG(exit_status))
1807 result.Fail(
"Program stopped by signal.")
1811 result.Fail(
"Exceeded time limit (%ds), stopped." % timeout)
1812 result[
"ExecTest.signal_number"] = signal_number
1813 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1814 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1818 result.Fail(
"Program did not terminate normally.")
1824 result[
"ExecTest.stdout"] = result[
"ExecTest.stdout"].replace(
def read(f, regex='.*', skipevents=0)