From 17ed015b0622e1e668ccd39d87632c586b97cef5 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 14 Sep 2010 00:32:43 -0700 Subject: [PATCH] Make IpcDaemonTestCase use EbuildBuildDir for lock creation. --- pym/portage/tests/ebuild/test_ipc_daemon.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pym/portage/tests/ebuild/test_ipc_daemon.py b/pym/portage/tests/ebuild/test_ipc_daemon.py index 6e2fe36e1..c4eb55b0d 100644 --- a/pym/portage/tests/ebuild/test_ipc_daemon.py +++ b/pym/portage/tests/ebuild/test_ipc_daemon.py @@ -11,7 +11,9 @@ from portage.const import PORTAGE_BIN_PATH from portage.const import PORTAGE_PYM_PATH from portage.const import BASH_BINARY from portage.package.ebuild._ipc.ExitCommand import ExitCommand +from portage.util import ensure_dirs from _emerge.SpawnProcess import SpawnProcess +from _emerge.EbuildBuildDir import EbuildBuildDir from _emerge.EbuildIpcDaemon import EbuildIpcDaemon from _emerge.TaskScheduler import TaskScheduler @@ -34,13 +36,20 @@ class IpcDaemonTestCase(TestCase): env['PORTAGE_PYTHON'] = _python_interpreter env['PORTAGE_BIN_PATH'] = PORTAGE_BIN_PATH env['PORTAGE_PYM_PATH'] = PORTAGE_PYM_PATH - env['PORTAGE_BUILDDIR'] = tmpdir + env['PORTAGE_BUILDDIR'] = os.path.join(tmpdir, 'cat', 'pkg-1') - input_fifo = os.path.join(tmpdir, '.ipc_in') - output_fifo = os.path.join(tmpdir, '.ipc_out') + task_scheduler = TaskScheduler(max_jobs=2) + build_dir = EbuildBuildDir(dir_path=env['PORTAGE_BUILDDIR'], + scheduler=task_scheduler.sched_iface, + settings=env) + build_dir.lock() + ensure_dirs(env['PORTAGE_BUILDDIR']) + + input_fifo = os.path.join(env['PORTAGE_BUILDDIR'], '.ipc_in') + output_fifo = os.path.join(env['PORTAGE_BUILDDIR'], '.ipc_out') os.mkfifo(input_fifo) os.mkfifo(output_fifo) - task_scheduler = TaskScheduler(max_jobs=2) + for exitcode in (0, 1, 2): exit_command = ExitCommand() commands = {'exit' : exit_command} @@ -108,5 +117,6 @@ class IpcDaemonTestCase(TestCase): self.assertEqual(daemon.isAlive(), False) self.assertEqual(proc.returncode == os.EX_OK, False) + build_dir.unlock() finally: shutil.rmtree(tmpdir) -- 2.26.2