diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-12-13 20:24:35 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-12-13 20:24:35 -0800 |
commit | 89bcc67e2930a841e1120492634ebc20530bc1d7 (patch) | |
tree | 72354b816b5117a8b522f5bf338f728c0606cf2d /pym/portage/tests/ebuild | |
parent | 9fa915eef028c96b8cde3876fb8bb299c03f9a62 (diff) | |
download | portage-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')
-rw-r--r-- | pym/portage/tests/ebuild/test_doebuild_spawn.py | 5 | ||||
-rw-r--r-- | pym/portage/tests/ebuild/test_ipc_daemon.py | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/pym/portage/tests/ebuild/test_doebuild_spawn.py b/pym/portage/tests/ebuild/test_doebuild_spawn.py index daa6e7528..89e27a331 100644 --- a/pym/portage/tests/ebuild/test_doebuild_spawn.py +++ b/pym/portage/tests/ebuild/test_doebuild_spawn.py @@ -26,6 +26,11 @@ class DoebuildSpawnTestCase(TestCase): playground = ResolverPlayground() try: settings = config(clone=playground.settings) + if "__PORTAGE_TEST_HARDLINK_LOCKS" in os.environ: + settings["__PORTAGE_TEST_HARDLINK_LOCKS"] = \ + os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"] + settings.backup_changes("__PORTAGE_TEST_HARDLINK_LOCKS") + cpv = 'sys-apps/portage-2.1' metadata = { 'EAPI' : '2', 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" % \ |