1698 def RunProgram(self, program, arguments, context, result):
1699 """Run the 'program'. 1701 'program' -- The path to the program to run. 1703 'arguments' -- A list of the arguments to the program. This 1704 list must contain a first argument corresponding to 'argv[0]'. 1706 'context' -- A 'Context' giving run-time parameters to the 1709 'result' -- A 'Result' object. The outcome will be 1710 'Result.PASS' when this method is called. The 'result' may be 1711 modified by this method to indicate outcomes other than 1712 'Result.PASS' or to add annotations. 1714 @attention: This method has been copied from command.ExecTestBase 1715 (QMTest 2.3.0) and modified to keep stdout and stderr 1716 for tests that have been terminated by a signal. 1717 (Fundamental for debugging in the Application Area) 1721 environment = self.MakeEnvironment(context)
1723 if "slc6" in environment.get(
'CMTCONFIG',
''):
1724 environment[
'TERM'] =
'dumb' 1726 if self.timeout >= 0:
1727 timeout = self.timeout
1735 e = GaudiFilterExecutable(self.stdin, timeout)
1737 exit_status = e.Run(arguments, environment, path=program)
1739 if e.stack_trace_file
and os.path.exists(e.stack_trace_file):
1740 stack_trace = open(e.stack_trace_file).
read()
1741 os.remove(e.stack_trace_file)
1745 result[
"ExecTest.stack_trace"] = result.Quote(stack_trace)
1748 if (sys.platform ==
"win32" or os.WIFEXITED(exit_status)
1749 or self.signal == os.WTERMSIG(exit_status)):
1754 if self.exit_code
is None:
1756 elif sys.platform ==
"win32":
1757 exit_code = exit_status
1759 exit_code = os.WEXITSTATUS(exit_status)
1764 result[
"ExecTest.exit_code"] = str(exit_code)
1765 result[
"ExecTest.stdout"] = result.Quote(stdout)
1766 result[
"ExecTest.stderr"] = result.Quote(stderr)
1768 if exit_code != self.exit_code:
1769 causes.append(
"exit_code")
1770 result[
"ExecTest.expected_exit_code"] \
1771 = str(self.exit_code)
1773 causes += self.ValidateOutput(stdout, stderr, result)
1776 result.Fail(
"Unexpected %s." % string.join(causes,
", "))
1777 elif os.WIFSIGNALED(exit_status):
1780 signal_number = str(os.WTERMSIG(exit_status))
1782 result.Fail(
"Program terminated by signal.")
1786 result.Fail(
"Exceeded time limit (%ds), terminated." % timeout)
1787 result[
"ExecTest.signal_number"] = signal_number
1788 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1789 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1791 result[
"ExecTest.expected_signal_number"] = str(self.signal)
1792 elif os.WIFSTOPPED(exit_status):
1795 signal_number = str(os.WSTOPSIG(exit_status))
1797 result.Fail(
"Program stopped by signal.")
1801 result.Fail(
"Exceeded time limit (%ds), stopped." % timeout)
1802 result[
"ExecTest.signal_number"] = signal_number
1803 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1804 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1808 result.Fail(
"Program did not terminate normally.")
1814 result[
"ExecTest.stdout"] = result[
"ExecTest.stdout"].replace(
def read(f, regex='.*', skipevents=0)