From 89bcc67e2930a841e1120492634ebc20530bc1d7 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 13 Dec 2011 20:24:35 -0800 Subject: 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. --- pym/portage/tests/ebuild/test_ipc_daemon.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'pym/portage/tests/ebuild/test_ipc_daemon.py') 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" % \ -- cgit v1.2.3-65-gdbad