Пример #1
0
    def test_kill_process(self):
        executive = Executive()
        process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
        self.assertEqual(process.poll(), None)  # Process is running
        executive.kill_process(process.pid)
        # Note: Can't use a ternary since signal.SIGKILL is undefined for sys.platform == "win32"
        if sys.platform == "win32":
            # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54790
            # We seem to get either 0 or 1 here for some reason.
            self.assertTrue(process.wait() in (0, 1))
        else:
            expected_exit_code = -signal.SIGKILL
            self.assertEqual(process.wait(), expected_exit_code)

        # Killing again should fail silently.
        executive.kill_process(process.pid)

        # Now test kill_all ; we do this in the same test as kill
        # so that we don't collide when running tests in parallel.
        process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
        self.assertEqual(process.poll(), None)  # Process is running
        executive.kill_all(never_ending_command()[0])
        # Note: Can't use a ternary since signal.SIGTERM is undefined for sys.platform == "win32"
        if sys.platform == "cygwin":
            expected_exit_code = 0  # os.kill results in exit(0) for this process.
            self.assertEqual(process.wait(), expected_exit_code)
        elif sys.platform == "win32":
            # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54790
            # We seem to get either 0 or 1 here for some reason.
            self.assertTrue(process.wait() in (0, 1))
        else:
            expected_exit_code = -signal.SIGTERM
            self.assertEqual(process.wait(), expected_exit_code)
        # Killing again should fail silently.
        executive.kill_all(never_ending_command()[0])
Пример #2
0
    def test_kill_process(self):
        executive = Executive()
        process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
        self.assertEqual(process.poll(), None)  # Process is running
        executive.kill_process(process.pid)

        # Killing again should fail silently.
        executive.kill_process(process.pid)
Пример #3
0
    def test_kill_process(self):
        executive = Executive()
        process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
        self.assertEqual(process.poll(), None)  # Process is running
        executive.kill_process(process.pid)

        # Killing again should fail silently.
        executive.kill_process(process.pid)
 def test_kill_process(self):
     executive = Executive()
     # FIXME: This may need edits to work right on windows.
     # We use "yes" because it loops forever.
     process = subprocess.Popen(["yes"], stdout=subprocess.PIPE)
     self.assertEqual(process.poll(), None)  # Process is running
     executive.kill_process(process.pid)
     self.assertEqual(process.wait(), -signal.SIGKILL)
     # Killing again should fail silently.
     executive.kill_process(process.pid)
Пример #5
0
    def serial_test_kill_process(self):
        if sys.platform in ("win32", "cygwin"):
            return  # Windows does not return consistent exit codes.

        executive = Executive()
        process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
        self.assertEqual(process.poll(), None)  # Process is running
        executive.kill_process(process.pid)
        self.assertEqual(process.wait(), -signal.SIGKILL)

        # Killing again should fail silently.
        executive.kill_process(process.pid)
 def test_kill_process(self):
     executive = Executive()
     process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
     self.assertEqual(process.poll(), None)  # Process is running
     executive.kill_process(process.pid)
     # Note: Can't use a ternary since signal.SIGKILL is undefined for sys.platform == "win32"
     if sys.platform == "win32":
         expected_exit_code = 1
     else:
         expected_exit_code = -signal.SIGKILL
     self.assertEqual(process.wait(), expected_exit_code)
     # Killing again should fail silently.
     executive.kill_process(process.pid)
Пример #7
0
    def serial_test_kill_process(self):
        if sys.platform in ("win32", "cygwin"):
            return  # Windows does not return consistent exit codes.

        executive = Executive()
        process = subprocess.Popen(never_ending_command(),
                                   stdout=subprocess.PIPE)
        self.assertEqual(process.poll(), None)  # Process is running
        executive.kill_process(process.pid)
        self.assertEqual(process.wait(), -signal.SIGKILL)

        # Killing again should fail silently.
        executive.kill_process(process.pid)
 def test_kill_process(self):
     executive = Executive()
     # We use "yes" because it loops forever.
     process = subprocess.Popen(["yes"], stdout=subprocess.PIPE)
     self.assertEqual(process.poll(), None)  # Process is running
     executive.kill_process(process.pid)
     # Note: Can't use a ternary since signal.SIGKILL is undefined for sys.platform == "win32"
     if sys.platform == "win32":
         expected_exit_code = 0  # taskkill.exe results in exit(0)
     else:
         expected_exit_code = -signal.SIGKILL
     self.assertEqual(process.wait(), expected_exit_code)
     # Killing again should fail silently.
     executive.kill_process(process.pid)
Пример #9
0
 def test_kill_process(self):
     executive = Executive()
     # We use "yes" because it loops forever.
     process = subprocess.Popen(["yes"], stdout=subprocess.PIPE)
     self.assertEqual(process.poll(), None)  # Process is running
     executive.kill_process(process.pid)
     # Note: Can't use a ternary since signal.SIGKILL is undefined for sys.platform == "win32"
     if sys.platform == "win32":
         expected_exit_code = 0  # taskkill.exe results in exit(0)
     else:
         expected_exit_code = -signal.SIGKILL
     self.assertEqual(process.wait(), expected_exit_code)
     # Killing again should fail silently.
     executive.kill_process(process.pid)
Пример #10
0
 def test_kill_process(self):
     executive = Executive()
     process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
     self.assertEqual(process.poll(), None)  # Process is running
     executive.kill_process(process.pid)
     # Note: Can't use a ternary since signal.SIGKILL is undefined for sys.platform == "win32"
     if sys.platform == "win32":
         # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54790
         # We seem to get either 0 or 1 here for some reason.
         self.assertTrue(process.wait() in (0, 1))
     else:
         expected_exit_code = -signal.SIGKILL
         self.assertEqual(process.wait(), expected_exit_code)
     # Killing again should fail silently.
     executive.kill_process(process.pid)
Пример #11
0
 def test_kill_process(self):
     executive = Executive()
     process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
     self.assertEqual(process.poll(), None)  # Process is running
     executive.kill_process(process.pid)
     # Note: Can't use a ternary since signal.SIGKILL is undefined for sys.platform == "win32"
     if sys.platform == "win32":
         # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54790
         # We seem to get either 0 or 1 here for some reason.
         self.assertTrue(process.wait() in (0, 1))
     else:
         expected_exit_code = -signal.SIGKILL
         self.assertEqual(process.wait(), expected_exit_code)
     # Killing again should fail silently.
     executive.kill_process(process.pid)
Пример #12
0
    def serial_test_kill_process(self):
        executive = Executive()
        with executive.popen(never_ending_command(), stdout=subprocess.PIPE) as process:
            self.assertEqual(process.poll(), None)  # Process is running
            executive.kill_process(process.pid)
            # Note: Can't use a ternary since signal.SIGKILL is undefined for sys.platform == "win32"
            if sys.platform.startswith('win'):
                # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54790
                # We seem to get either 0 or 1 here for some reason.
                self.assertIn(process.wait(), (0, 1))
            elif sys.platform == "cygwin":
                # FIXME: https://bugs.webkit.org/show_bug.cgi?id=98196
                # cygwin seems to give us either SIGABRT or SIGKILL
                # Native Windows (via Cygwin) returns ENOTBLK (-15)
                self.assertIn(process.wait(), (-signal.SIGABRT, -signal.SIGKILL, -15))
            else:
                expected_exit_code = -signal.SIGTERM
                self.assertEqual(process.wait(), expected_exit_code)

            # Killing again should fail silently.
            executive.kill_process(process.pid)
Пример #13
0
    def serial_test_kill_process(self):
        executive = Executive()
        process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
        self.assertEqual(process.poll(), None)  # Process is running
        executive.kill_process(process.pid)
        # Note: Can't use a ternary since signal.SIGKILL is undefined for sys.platform == "win32"
        if sys.platform == "win32":
            # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54790
            # We seem to get either 0 or 1 here for some reason.
            self.assertIn(process.wait(), (0, 1))
        elif sys.platform == "cygwin":
            # FIXME: https://bugs.webkit.org/show_bug.cgi?id=98196
            # cygwin seems to give us either SIGABRT or SIGKILL
            # Native Windows (via Cygwin) returns ENOTBLK (-15)
            self.assertIn(process.wait(), (-signal.SIGABRT, -signal.SIGKILL, -15))
        else:
            expected_exit_code = -signal.SIGTERM
            self.assertEqual(process.wait(), expected_exit_code)

        # Killing again should fail silently.
        executive.kill_process(process.pid)