aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-12-13 20:24:35 -0800
committerZac Medico <zmedico@gentoo.org>2011-12-13 20:24:35 -0800
commit89bcc67e2930a841e1120492634ebc20530bc1d7 (patch)
tree72354b816b5117a8b522f5bf338f728c0606cf2d /pym/portage/tests/ebuild/test_ipc_daemon.py
parentebuils-ipc.py: _exit in finally block after fork (diff)
downloadportage-89bcc67e2930a841e1120492634ebc20530bc1d7.tar.gz
portage-89bcc67e2930a841e1120492634ebc20530bc1d7.tar.bz2
portage-89bcc67e2930a841e1120492634ebc20530bc1d7.zip
locks.py: fix hardlink locks for bug #394195
This updates the hardlink locking code to support the non-blocking, lockfile(wantnewlockfile=False), and lockfile(file_object) behaviors which are used by portage code.
Diffstat (limited to 'pym/portage/tests/ebuild/test_ipc_daemon.py')
-rw-r--r--pym/portage/tests/ebuild/test_ipc_daemon.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/pym/portage/tests/ebuild/test_ipc_daemon.py b/pym/portage/tests/ebuild/test_ipc_daemon.py
index 379953d4b..c63843792 100644
--- a/pym/portage/tests/ebuild/test_ipc_daemon.py
+++ b/pym/portage/tests/ebuild/test_ipc_daemon.py
@@ -10,6 +10,7 @@ from portage.tests import TestCase
from portage.const import PORTAGE_BIN_PATH
from portage.const import PORTAGE_PYM_PATH
from portage.const import BASH_BINARY
+from portage.locks import hardlock_cleanup
from portage.package.ebuild._ipc.ExitCommand import ExitCommand
from portage.util import ensure_dirs
from _emerge.SpawnProcess import SpawnProcess
@@ -39,6 +40,10 @@ class IpcDaemonTestCase(TestCase):
env['PORTAGE_PYM_PATH'] = PORTAGE_PYM_PATH
env['PORTAGE_BUILDDIR'] = os.path.join(tmpdir, 'cat', 'pkg-1')
+ if "__PORTAGE_TEST_HARDLINK_LOCKS" in os.environ:
+ env["__PORTAGE_TEST_HARDLINK_LOCKS"] = \
+ os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"]
+
task_scheduler = TaskScheduler(max_jobs=2)
build_dir = EbuildBuildDir(
scheduler=task_scheduler.sched_iface,
@@ -75,6 +80,8 @@ class IpcDaemonTestCase(TestCase):
start_time = time.time()
task_scheduler.run(timeout=self._SCHEDULE_TIMEOUT)
task_scheduler.clear()
+ hardlock_cleanup(env['PORTAGE_BUILDDIR'],
+ remove_all_locks=True)
self.assertEqual(self.received_command, True,
"command not received after %d seconds" % \
@@ -110,6 +117,8 @@ class IpcDaemonTestCase(TestCase):
start_time = time.time()
task_scheduler.run(timeout=short_timeout_ms)
task_scheduler.clear()
+ hardlock_cleanup(env['PORTAGE_BUILDDIR'],
+ remove_all_locks=True)
self.assertEqual(self.received_command, False,
"command received after %d seconds" % \