1477 def RunProgram(self, program, arguments, context, result):
1478 """Run the 'program'.
1480 'program' -- The path to the program to run.
1482 'arguments' -- A list of the arguments to the program. This
1483 list must contain a first argument corresponding to 'argv[0]'.
1485 'context' -- A 'Context' giving run-time parameters to the
1488 'result' -- A 'Result' object. The outcome will be
1489 'Result.PASS' when this method is called. The 'result' may be
1490 modified by this method to indicate outcomes other than
1491 'Result.PASS' or to add annotations.
1493 @attention: This method has been copied from command.ExecTestBase
1494 (QMTest 2.3.0) and modified to keep stdout and stderr
1495 for tests that have been terminated by a signal.
1496 (Fundamental for debugging in the Application Area)
1500 environment = self.MakeEnvironment(context)
1502 if "slc6" in environment.get(
'CMTCONFIG',
''):
1503 environment[
'TERM'] =
'dumb'
1516 exit_status = e.Run(arguments, environment, path = program)
1518 if e.stack_trace_file
and os.path.exists(e.stack_trace_file):
1519 stack_trace = open(e.stack_trace_file).read()
1520 os.remove(e.stack_trace_file)
1524 result[
"ExecTest.stack_trace"] = result.Quote(stack_trace)
1527 if (sys.platform ==
"win32" or os.WIFEXITED(exit_status)
1528 or self.
signal == os.WTERMSIG(exit_status)):
1533 if self.exit_code
is None:
1535 elif sys.platform ==
"win32":
1536 exit_code = exit_status
1538 exit_code = os.WEXITSTATUS(exit_status)
1543 result[
"ExecTest.exit_code"] = str(exit_code)
1544 result[
"ExecTest.stdout"] = result.Quote(stdout)
1545 result[
"ExecTest.stderr"] = result.Quote(stderr)
1547 if exit_code != self.exit_code:
1548 causes.append(
"exit_code")
1549 result[
"ExecTest.expected_exit_code"] \
1550 = str(self.exit_code)
1555 result.Fail(
"Unexpected %s." % string.join(causes,
", "))
1556 elif os.WIFSIGNALED(exit_status):
1559 signal_number = str(os.WTERMSIG(exit_status))
1561 result.Fail(
"Program terminated by signal.")
1565 result.Fail(
"Exceeded time limit (%ds), terminated." % timeout)
1566 result[
"ExecTest.signal_number"] = signal_number
1567 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1568 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1570 result[
"ExecTest.expected_signal_number"] = str(self.
signal)
1571 elif os.WIFSTOPPED(exit_status):
1574 signal_number = str(os.WSTOPSIG(exit_status))
1576 result.Fail(
"Program stopped by signal.")
1580 result.Fail(
"Exceeded time limit (%ds), stopped." % timeout)
1581 result[
"ExecTest.signal_number"] = signal_number
1582 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1583 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1587 result.Fail(
"Program did not terminate normally.")
1593 result[
"ExecTest.stdout"] = result[
"ExecTest.stdout"].replace(esc,repr_esc)