1533 def RunProgram(self, program, arguments, context, result):
1534 """Run the 'program'.
1536 'program' -- The path to the program to run.
1538 'arguments' -- A list of the arguments to the program. This
1539 list must contain a first argument corresponding to 'argv[0]'.
1541 'context' -- A 'Context' giving run-time parameters to the
1544 'result' -- A 'Result' object. The outcome will be
1545 'Result.PASS' when this method is called. The 'result' may be
1546 modified by this method to indicate outcomes other than
1547 'Result.PASS' or to add annotations.
1549 @attention: This method has been copied from command.ExecTestBase
1550 (QMTest 2.3.0) and modified to keep stdout and stderr
1551 for tests that have been terminated by a signal.
1552 (Fundamental for debugging in the Application Area)
1556 environment = self.MakeEnvironment(context)
1558 if "slc6" in environment.get(
'CMTCONFIG',
''):
1559 environment[
'TERM'] =
'dumb'
1572 exit_status = e.Run(arguments, environment, path = program)
1574 if e.stack_trace_file
and os.path.exists(e.stack_trace_file):
1575 stack_trace = open(e.stack_trace_file).read()
1576 os.remove(e.stack_trace_file)
1580 result[
"ExecTest.stack_trace"] = result.Quote(stack_trace)
1583 if (sys.platform ==
"win32" or os.WIFEXITED(exit_status)
1584 or self.
signal == os.WTERMSIG(exit_status)):
1589 if self.exit_code
is None:
1591 elif sys.platform ==
"win32":
1592 exit_code = exit_status
1594 exit_code = os.WEXITSTATUS(exit_status)
1599 result[
"ExecTest.exit_code"] = str(exit_code)
1600 result[
"ExecTest.stdout"] = result.Quote(stdout)
1601 result[
"ExecTest.stderr"] = result.Quote(stderr)
1603 if exit_code != self.exit_code:
1604 causes.append(
"exit_code")
1605 result[
"ExecTest.expected_exit_code"] \
1606 = str(self.exit_code)
1611 result.Fail(
"Unexpected %s." % string.join(causes,
", "))
1612 elif os.WIFSIGNALED(exit_status):
1615 signal_number = str(os.WTERMSIG(exit_status))
1617 result.Fail(
"Program terminated by signal.")
1621 result.Fail(
"Exceeded time limit (%ds), terminated." % timeout)
1622 result[
"ExecTest.signal_number"] = signal_number
1623 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1624 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1626 result[
"ExecTest.expected_signal_number"] = str(self.
signal)
1627 elif os.WIFSTOPPED(exit_status):
1630 signal_number = str(os.WSTOPSIG(exit_status))
1632 result.Fail(
"Program stopped by signal.")
1636 result.Fail(
"Exceeded time limit (%ds), stopped." % timeout)
1637 result[
"ExecTest.signal_number"] = signal_number
1638 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1639 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1643 result.Fail(
"Program did not terminate normally.")
1649 result[
"ExecTest.stdout"] = result[
"ExecTest.stdout"].replace(esc,repr_esc)