1548 def RunProgram(self, program, arguments, context, result):
1549 """Run the 'program'.
1551 'program' -- The path to the program to run.
1553 'arguments' -- A list of the arguments to the program. This
1554 list must contain a first argument corresponding to 'argv[0]'.
1556 'context' -- A 'Context' giving run-time parameters to the
1559 'result' -- A 'Result' object. The outcome will be
1560 'Result.PASS' when this method is called. The 'result' may be
1561 modified by this method to indicate outcomes other than
1562 'Result.PASS' or to add annotations.
1564 @attention: This method has been copied from command.ExecTestBase
1565 (QMTest 2.3.0) and modified to keep stdout and stderr
1566 for tests that have been terminated by a signal.
1567 (Fundamental for debugging in the Application Area)
1571 environment = self.MakeEnvironment(context)
1573 if "slc6" in environment.get(
'CMTCONFIG',
''):
1574 environment[
'TERM'] =
'dumb'
1587 exit_status = e.Run(arguments, environment, path = program)
1589 if e.stack_trace_file
and os.path.exists(e.stack_trace_file):
1590 stack_trace = open(e.stack_trace_file).read()
1591 os.remove(e.stack_trace_file)
1595 result[
"ExecTest.stack_trace"] = result.Quote(stack_trace)
1598 if (sys.platform ==
"win32" or os.WIFEXITED(exit_status)
1599 or self.
signal == os.WTERMSIG(exit_status)):
1604 if self.exit_code
is None:
1606 elif sys.platform ==
"win32":
1607 exit_code = exit_status
1609 exit_code = os.WEXITSTATUS(exit_status)
1614 result[
"ExecTest.exit_code"] = str(exit_code)
1615 result[
"ExecTest.stdout"] = result.Quote(stdout)
1616 result[
"ExecTest.stderr"] = result.Quote(stderr)
1618 if exit_code != self.exit_code:
1619 causes.append(
"exit_code")
1620 result[
"ExecTest.expected_exit_code"] \
1621 = str(self.exit_code)
1626 result.Fail(
"Unexpected %s." % string.join(causes,
", "))
1627 elif os.WIFSIGNALED(exit_status):
1630 signal_number = str(os.WTERMSIG(exit_status))
1632 result.Fail(
"Program terminated by signal.")
1636 result.Fail(
"Exceeded time limit (%ds), terminated." % timeout)
1637 result[
"ExecTest.signal_number"] = signal_number
1638 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1639 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1641 result[
"ExecTest.expected_signal_number"] = str(self.
signal)
1642 elif os.WIFSTOPPED(exit_status):
1645 signal_number = str(os.WSTOPSIG(exit_status))
1647 result.Fail(
"Program stopped by signal.")
1651 result.Fail(
"Exceeded time limit (%ds), stopped." % timeout)
1652 result[
"ExecTest.signal_number"] = signal_number
1653 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1654 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1658 result.Fail(
"Program did not terminate normally.")
1664 result[
"ExecTest.stdout"] = result[
"ExecTest.stdout"].replace(esc,repr_esc)