testing/mozbase/mozprocess/tests/test_mozprocess_kill_broad_wait.py
author Andrew Halberstadt <ahalberstadt@mozilla.com>
Fri, 24 Jan 2014 16:26:57 -0500
changeset 181247 c48b1f578d7d675f18c926bced0cebcfc814d56c
parent 165823 541750e89771444d80f70a2f47e10f4db1ef417b
child 302299 72bf30ffd77166d0813caf50218e0f31bedbe219
permissions -rw-r--r--
Bug 947974 - Add signal parameter to mozprocess.kill(), r=wlach

#!/usr/bin/env python

import os
import time
import unittest
import proctest
from mozprocess import processhandler

here = os.path.dirname(os.path.abspath(__file__))

class ProcTestKill(proctest.ProcTest):
    """ Class to test various process tree killing scenatios """

    # This test should ideally be a part of test_mozprocess_kill.py
    # It has been separated for the purpose of tempporarily disabling it.
    # See https://bugzilla.mozilla.org/show_bug.cgi?id=921632
    def test_process_kill_broad_wait(self):
        """Process is started, we use a broad process tree, we let it spawn
           for a bit, we kill it"""

        p = processhandler.ProcessHandler([self.python, self.proclaunch, "process_normal_broad_python.ini"],
                                          cwd=here)
        p.run()
        # Let the tree spawn a bit, before attempting to kill
        time.sleep(3)
        p.kill()

        detected, output = proctest.check_for_process(self.proclaunch)
        self.determine_status(detected,
                              output,
                              p.proc.returncode,
                              p.didTimeout,
                              expectedfail=('returncode',))

if __name__ == '__main__':
    unittest.main()