Пример #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])
 def test_kill_all(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_all("yes")
     self.assertEqual(process.wait(), -signal.SIGTERM)
     # Killing again should fail silently.
     executive.kill_all("yes")
 def test_kill_all(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_all("yes")
     # Note: Can't use a ternary since signal.SIGTERM is undefined for sys.platform == "win32"
     if sys.platform in ("win32", "cygwin"):
         expected_exit_code = 0  # taskkill.exe results in exit(0)
     else:
         expected_exit_code = -signal.SIGTERM
     self.assertEqual(process.wait(), expected_exit_code)
     # Killing again should fail silently.
     executive.kill_all("yes")
Пример #4
0
 def test_kill_all(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_all("yes")
     # Note: Can't use a ternary since signal.SIGTERM is undefined for sys.platform == "win32"
     if sys.platform in ("win32", "cygwin"):
         expected_exit_code = 0  # taskkill.exe results in exit(0)
     else:
         expected_exit_code = -signal.SIGTERM
     self.assertEqual(process.wait(), expected_exit_code)
     # Killing again should fail silently.
     executive.kill_all("yes")
 def test_kill_all(self):
     executive = Executive()
     # We use "yes" because it loops forever.
     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.
     elif sys.platform == "win32":
         expected_exit_code = 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])
Пример #6
0
 def serial_test_kill_all(self):
     executive = Executive()
     with executive.popen(never_ending_command(), stdout=subprocess.PIPE) as process:
         self.assertIsNone(process.poll())  # 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.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))
         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])
Пример #7
0
 def serial_test_kill_all(self):
     executive = Executive()
     process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
     self.assertIsNone(process.poll())  # 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.assertIn(process.wait(), (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])