1544 def RunProgram(self, program, arguments, context, result):
1545 """Run the 'program'.
1547 'program' -- The path to the program to run.
1549 'arguments' -- A list of the arguments to the program. This
1550 list must contain a first argument corresponding to 'argv[0]'.
1552 'context' -- A 'Context' giving run-time parameters to the
1555 'result' -- A 'Result' object. The outcome will be
1556 'Result.PASS' when this method is called. The 'result' may be
1557 modified by this method to indicate outcomes other than
1558 'Result.PASS' or to add annotations.
1560 @attention: This method has been copied from command.ExecTestBase
1561 (QMTest 2.3.0) and modified to keep stdout and stderr
1562 for tests that have been terminated by a signal.
1563 (Fundamental for debugging in the Application Area)
1567 environment = self.MakeEnvironment(context)
1569 if "slc6" in environment.get(
'CMTCONFIG',
''):
1570 environment[
'TERM'] =
'dumb'
1583 exit_status = e.Run(arguments, environment, path = program)
1585 if e.stack_trace_file
and os.path.exists(e.stack_trace_file):
1586 stack_trace = open(e.stack_trace_file).read()
1587 os.remove(e.stack_trace_file)
1591 result[
"ExecTest.stack_trace"] = result.Quote(stack_trace)
1594 if (sys.platform ==
"win32" or os.WIFEXITED(exit_status)
1595 or self.
signal == os.WTERMSIG(exit_status)):
1600 if self.exit_code
is None:
1602 elif sys.platform ==
"win32":
1603 exit_code = exit_status
1605 exit_code = os.WEXITSTATUS(exit_status)
1610 result[
"ExecTest.exit_code"] = str(exit_code)
1611 result[
"ExecTest.stdout"] = result.Quote(stdout)
1612 result[
"ExecTest.stderr"] = result.Quote(stderr)
1614 if exit_code != self.exit_code:
1615 causes.append(
"exit_code")
1616 result[
"ExecTest.expected_exit_code"] \
1617 = str(self.exit_code)
1622 result.Fail(
"Unexpected %s." % string.join(causes,
", "))
1623 elif os.WIFSIGNALED(exit_status):
1626 signal_number = str(os.WTERMSIG(exit_status))
1628 result.Fail(
"Program terminated by signal.")
1632 result.Fail(
"Exceeded time limit (%ds), terminated." % timeout)
1633 result[
"ExecTest.signal_number"] = signal_number
1634 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1635 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1637 result[
"ExecTest.expected_signal_number"] = str(self.
signal)
1638 elif os.WIFSTOPPED(exit_status):
1641 signal_number = str(os.WSTOPSIG(exit_status))
1643 result.Fail(
"Program stopped by signal.")
1647 result.Fail(
"Exceeded time limit (%ds), stopped." % timeout)
1648 result[
"ExecTest.signal_number"] = signal_number
1649 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1650 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1654 result.Fail(
"Program did not terminate normally.")
1660 result[
"ExecTest.stdout"] = result[
"ExecTest.stdout"].replace(esc,repr_esc)