diff options
Diffstat (limited to 'pym/portage/tests')
-rw-r--r-- | pym/portage/tests/ebuild/test_doebuild_spawn.py | 5 | ||||
-rw-r--r-- | pym/portage/tests/ebuild/test_ipc_daemon.py | 9 | ||||
-rw-r--r-- | pym/portage/tests/emerge/test_simple.py | 4 | ||||
-rw-r--r-- | pym/portage/tests/locks/test_asynchronous_lock.py | 48 | ||||
-rw-r--r-- | pym/portage/tests/locks/test_lock_nonblock.py | 12 |
5 files changed, 73 insertions, 5 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" % \ diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py index a3efa62ca..86919509d 100644 --- a/pym/portage/tests/emerge/test_simple.py +++ b/pym/portage/tests/emerge/test_simple.py @@ -318,6 +318,10 @@ pkg_preinst() { "PYTHONPATH" : pythonpath, } + if "__PORTAGE_TEST_HARDLINK_LOCKS" in os.environ: + env["__PORTAGE_TEST_HARDLINK_LOCKS"] = \ + os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"] + updates_dir = os.path.join(portdir, "profiles", "updates") dirs = [cachedir, cachedir_pregen, distdir, fake_bin, portage_tmpdir, updates_dir, 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) diff --git a/pym/portage/tests/locks/test_lock_nonblock.py b/pym/portage/tests/locks/test_lock_nonblock.py index cc1b28e82..914084ca7 100644 --- a/pym/portage/tests/locks/test_lock_nonblock.py +++ b/pym/portage/tests/locks/test_lock_nonblock.py @@ -11,7 +11,7 @@ from portage.tests import TestCase class LockNonblockTestCase(TestCase): - def testLockNonblock(self): + def _testLockNonblock(self): tempdir = tempfile.mkdtemp() try: path = os.path.join(tempdir, 'lock_me') @@ -44,3 +44,13 @@ class LockNonblockTestCase(TestCase): finally: shutil.rmtree(tempdir) + def testLockNonblock(self): + self._testLockNonblock() + + def testLockNonblockHardlink(self): + os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"] = "1" + try: + self._testLockNonblock() + finally: + os.environ.pop("__PORTAGE_TEST_HARDLINK_LOCKS", None) + |