コード例 #1
0
ファイル: test_drivers.py プロジェクト: dims/pifpaf
 def test_stuck_process(self):
     d = drivers.Driver(debug=True)
     c, _ = d._exec(
         ["bash", "-c", "trap ':' TERM ; echo start; sleep 10000"],
         wait_for_line="start")
     with mock.patch.object(drivers.LOG, "warning") as w:
         d._kill(c)
         w.assert_called_once()
     self.assertNotEqual(None, c.poll())
コード例 #2
0
 def _do_test_stuck(self, cmd):
     d = drivers.Driver(debug=True)
     d.setUp()
     c, _ = d._exec(cmd, wait_for_line="started")
     parent = psutil.Process(c.pid)
     procs = parent.children(recursive=True)
     procs.append(parent)
     d._kill(c)
     gone, alive = psutil.wait_procs(procs, timeout=0)
     self.assertEqual([], alive)
コード例 #3
0
ファイル: test_drivers.py プロジェクト: dims/pifpaf
 def _get_tmpdir_for_xattr(self):
     tmp_rootdir = os.getenv("TMPDIR_FOR_XATTR")
     # NOTE(sileht): Don't skip test if user have explicitly set a directory
     if not tmp_rootdir:
         try:
             d = drivers.Driver(tmp_rootdir=tmp_rootdir)
             self.useFixture(d)
             d._ensure_xattr_support()
         except RuntimeError as e:
             self.skipTest(str(e))
     return tmp_rootdir