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/locks/test_asynchronous_lock.py | |
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/locks/test_asynchronous_lock.py')
-rw-r--r-- | pym/portage/tests/locks/test_asynchronous_lock.py | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/pym/portage/tests/locks/test_asynchronous_lock.py b/pym/portage/tests/locks/test_asynchronous_lock.py index 0d6f11656..c896cb45c 100644 --- a/pym/portage/tests/locks/test_asynchronous_lock.py +++ b/pym/portage/tests/locks/test_asynchronous_lock.py @@ -12,7 +12,7 @@ from _emerge.PollScheduler import PollScheduler class AsynchronousLockTestCase(TestCase): - def testAsynchronousLock(self): + def _testAsynchronousLock(self): scheduler = PollScheduler().sched_iface tempdir = tempfile.mkdtemp() try: @@ -39,7 +39,17 @@ class AsynchronousLockTestCase(TestCase): finally: shutil.rmtree(tempdir) - def testAsynchronousLockWait(self): + def testAsynchronousLock(self): + self._testAsynchronousLock() + + def testAsynchronousLockHardlink(self): + os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"] = "1" + try: + self._testAsynchronousLock() + finally: + os.environ.pop("__PORTAGE_TEST_HARDLINK_LOCKS", None) + + def _testAsynchronousLockWait(self): scheduler = PollScheduler().sched_iface tempdir = tempfile.mkdtemp() try: @@ -67,7 +77,17 @@ class AsynchronousLockTestCase(TestCase): finally: shutil.rmtree(tempdir) - def testAsynchronousLockWaitCancel(self): + def testAsynchronousLockWait(self): + self._testAsynchronousLockWait() + + def testAsynchronousLockWaitHardlink(self): + os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"] = "1" + try: + self._testAsynchronousLockWait() + finally: + os.environ.pop("__PORTAGE_TEST_HARDLINK_LOCKS", None) + + def _testAsynchronousLockWaitCancel(self): scheduler = PollScheduler().sched_iface tempdir = tempfile.mkdtemp() try: @@ -92,7 +112,17 @@ class AsynchronousLockTestCase(TestCase): finally: shutil.rmtree(tempdir) - def testAsynchronousLockWaitKill(self): + def testAsynchronousLockWaitCancel(self): + self._testAsynchronousLockWaitCancel() + + def testAsynchronousLockWaitCancelHardlink(self): + os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"] = "1" + try: + self._testAsynchronousLockWaitCancel() + finally: + os.environ.pop("__PORTAGE_TEST_HARDLINK_LOCKS", None) + + def _testAsynchronousLockWaitKill(self): scheduler = PollScheduler().sched_iface tempdir = tempfile.mkdtemp() try: @@ -122,3 +152,13 @@ class AsynchronousLockTestCase(TestCase): lock1.unlock() finally: shutil.rmtree(tempdir) + + def testAsynchronousLockWaitKill(self): + self._testAsynchronousLockWaitKill() + + def testAsynchronousLockWaitKillHardlink(self): + os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"] = "1" + try: + self._testAsynchronousLockWaitKill() + finally: + os.environ.pop("__PORTAGE_TEST_HARDLINK_LOCKS", None) |