1474 def RunProgram(self, program, arguments, context, result):
1475 """Run the 'program'.
1477 'program' -- The path to the program to run.
1479 'arguments' -- A list of the arguments to the program. This
1480 list must contain a first argument corresponding to 'argv[0]'.
1482 'context' -- A 'Context' giving run-time parameters to the
1485 'result' -- A 'Result' object. The outcome will be
1486 'Result.PASS' when this method is called. The 'result' may be
1487 modified by this method to indicate outcomes other than
1488 'Result.PASS' or to add annotations.
1490 @attention: This method has been copied from command.ExecTestBase
1491 (QMTest 2.3.0) and modified to keep stdout and stderr
1492 for tests that have been terminated by a signal.
1493 (Fundamental for debugging in the Application Area)
1497 environment = self.MakeEnvironment(context)
1499 if "slc6" in environment.get(
'CMTCONFIG',
''):
1500 environment[
'TERM'] =
'dumb'
1513 exit_status = e.Run(arguments, environment, path = program)
1515 if e.stack_trace_file
and os.path.exists(e.stack_trace_file):
1516 stack_trace = open(e.stack_trace_file).read()
1517 os.remove(e.stack_trace_file)
1521 result[
"ExecTest.stack_trace"] = result.Quote(stack_trace)
1524 if (sys.platform ==
"win32" or os.WIFEXITED(exit_status)
1525 or self.
signal == os.WTERMSIG(exit_status)):
1530 if self.exit_code
is None:
1532 elif sys.platform ==
"win32":
1533 exit_code = exit_status
1535 exit_code = os.WEXITSTATUS(exit_status)
1540 result[
"ExecTest.exit_code"] = str(exit_code)
1541 result[
"ExecTest.stdout"] = result.Quote(stdout)
1542 result[
"ExecTest.stderr"] = result.Quote(stderr)
1544 if exit_code != self.exit_code:
1545 causes.append(
"exit_code")
1546 result[
"ExecTest.expected_exit_code"] \
1547 = str(self.exit_code)
1552 result.Fail(
"Unexpected %s." % string.join(causes,
", "))
1553 elif os.WIFSIGNALED(exit_status):
1556 signal_number = str(os.WTERMSIG(exit_status))
1558 result.Fail(
"Program terminated by signal.")
1562 result.Fail(
"Exceeded time limit (%ds), terminated." % timeout)
1563 result[
"ExecTest.signal_number"] = signal_number
1564 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1565 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1567 result[
"ExecTest.expected_signal_number"] = str(self.
signal)
1568 elif os.WIFSTOPPED(exit_status):
1571 signal_number = str(os.WSTOPSIG(exit_status))
1573 result.Fail(
"Program stopped by signal.")
1577 result.Fail(
"Exceeded time limit (%ds), stopped." % timeout)
1578 result[
"ExecTest.signal_number"] = signal_number
1579 result[
"ExecTest.stdout"] = result.Quote(e.stdout)
1580 result[
"ExecTest.stderr"] = result.Quote(e.stderr)
1584 result.Fail(
"Program did not terminate normally.")
1590 result[
"ExecTest.stdout"] = result[
"ExecTest.stdout"].replace(esc,repr_esc)