public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/locks/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     6c6d648ff08be7c7874d1a39ee1f4412081f9f16
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May 17 21:02:12 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 03:05:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6c6d648f

test_asynchronous_lock: test wait and cancel

---
 pym/portage/tests/locks/test_asynchronous_lock.py |   22 +++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/pym/portage/tests/locks/test_asynchronous_lock.py b/pym/portage/tests/locks/test_asynchronous_lock.py
index e72adf6..dc4619d 100644
--- a/pym/portage/tests/locks/test_asynchronous_lock.py
+++ b/pym/portage/tests/locks/test_asynchronous_lock.py
@@ -62,3 +62,25 @@ class AsynchronousLockTestCase(TestCase):
 			lock2.unlock()
 		finally:
 			shutil.rmtree(tempdir)
+
+	def testAsynchronousLockWaitCancel(self):
+		scheduler = PollScheduler().sched_iface
+		tempdir = tempfile.mkdtemp()
+		try:
+			path = os.path.join(tempdir, 'lock_me')
+			lock1 = AsynchronousLock(path=path, scheduler=scheduler)
+			lock1.start()
+			self.assertEqual(lock1.wait(), os.EX_OK)
+			lock2 = AsynchronousLock(path=path, scheduler=scheduler,
+				_force_async=True, _force_process=True)
+			lock2.start()
+			# lock2 should we waiting for lock1 to release
+			self.assertEqual(lock2.returncode, None)
+
+			# Cancel lock2 and then check wait() and returncode results.
+			lock2.cancel()
+			self.assertEqual(lock2.wait() == os.EX_OK, False)
+			self.assertEqual(lock2.returncode == os.EX_OK, False)
+			lock1.unlock()
+		finally:
+			shutil.rmtree(tempdir)



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/locks/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     c09572b6c0ab707105d1acd4ae873d98b6b93c7a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May 17 20:56:15 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 03:05:23 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c09572b6

test_asynchronous_lock: test waiting

---
 pym/portage/tests/locks/test_asynchronous_lock.py |   25 +++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/pym/portage/tests/locks/test_asynchronous_lock.py b/pym/portage/tests/locks/test_asynchronous_lock.py
index 7e9fdfe..e72adf6 100644
--- a/pym/portage/tests/locks/test_asynchronous_lock.py
+++ b/pym/portage/tests/locks/test_asynchronous_lock.py
@@ -37,3 +37,28 @@ class AsynchronousLockTestCase(TestCase):
 
 		finally:
 			shutil.rmtree(tempdir)
+
+	def testAsynchronousLockWait(self):
+		scheduler = PollScheduler().sched_iface
+		tempdir = tempfile.mkdtemp()
+		try:
+			path = os.path.join(tempdir, 'lock_me')
+			lock1 = AsynchronousLock(path=path, scheduler=scheduler)
+			lock1.start()
+			self.assertEqual(lock1.wait(), os.EX_OK)
+
+			# lock2 requires _force_async=True since the portage.locks
+			# module is not designed to work as intended here if the
+			# same process tries to lock the same file more than
+			# one time concurrently.
+			lock2 = AsynchronousLock(path=path, scheduler=scheduler,
+				_force_async=True, _force_process=True)
+			lock2.start()
+			# lock2 should we waiting for lock1 to release
+			self.assertEqual(lock2.returncode, None)
+
+			lock1.unlock()
+			self.assertEqual(lock2.wait(), os.EX_OK)
+			lock2.unlock()
+		finally:
+			shutil.rmtree(tempdir)



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/locks/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     fa3a425622a0b1ac42b8b98d0e15d655f3480e35
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May 17 21:14:20 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 03:05:39 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fa3a4256

test_asynchronous_lock: test returncode more

---
 pym/portage/tests/locks/test_asynchronous_lock.py |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/pym/portage/tests/locks/test_asynchronous_lock.py b/pym/portage/tests/locks/test_asynchronous_lock.py
index dc4619d..d592f4b 100644
--- a/pym/portage/tests/locks/test_asynchronous_lock.py
+++ b/pym/portage/tests/locks/test_asynchronous_lock.py
@@ -23,17 +23,17 @@ class AsynchronousLockTestCase(TestCase):
 						_force_thread=True,
 						_force_dummy=force_dummy)
 					async_lock.start()
-					async_lock.wait()
-					async_lock.unlock()
+					self.assertEqual(async_lock.wait(), os.EX_OK)
 					self.assertEqual(async_lock.returncode, os.EX_OK)
+					async_lock.unlock()
 
 				async_lock = AsynchronousLock(path=path,
 					scheduler=scheduler, _force_async=force_async,
 					_force_process=True)
 				async_lock.start()
-				async_lock.wait()
-				async_lock.unlock()
+				self.assertEqual(async_lock.wait(), os.EX_OK)
 				self.assertEqual(async_lock.returncode, os.EX_OK)
+				async_lock.unlock()
 
 		finally:
 			shutil.rmtree(tempdir)
@@ -46,6 +46,7 @@ class AsynchronousLockTestCase(TestCase):
 			lock1 = AsynchronousLock(path=path, scheduler=scheduler)
 			lock1.start()
 			self.assertEqual(lock1.wait(), os.EX_OK)
+			self.assertEqual(lock1.returncode, os.EX_OK)
 
 			# lock2 requires _force_async=True since the portage.locks
 			# module is not designed to work as intended here if the
@@ -59,6 +60,7 @@ class AsynchronousLockTestCase(TestCase):
 
 			lock1.unlock()
 			self.assertEqual(lock2.wait(), os.EX_OK)
+			self.assertEqual(lock2.returncode, os.EX_OK)
 			lock2.unlock()
 		finally:
 			shutil.rmtree(tempdir)
@@ -71,6 +73,7 @@ class AsynchronousLockTestCase(TestCase):
 			lock1 = AsynchronousLock(path=path, scheduler=scheduler)
 			lock1.start()
 			self.assertEqual(lock1.wait(), os.EX_OK)
+			self.assertEqual(lock1.returncode, os.EX_OK)
 			lock2 = AsynchronousLock(path=path, scheduler=scheduler,
 				_force_async=True, _force_process=True)
 			lock2.start()
@@ -81,6 +84,7 @@ class AsynchronousLockTestCase(TestCase):
 			lock2.cancel()
 			self.assertEqual(lock2.wait() == os.EX_OK, False)
 			self.assertEqual(lock2.returncode == os.EX_OK, False)
+			self.assertEqual(lock2.returncode is None, False)
 			lock1.unlock()
 		finally:
 			shutil.rmtree(tempdir)



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/locks/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     04e7e152a1398c4d35d30fe1a4fb285b594dbc81
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Wed May 18 19:46:09 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 03:23:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=04e7e152

Fix typos in comments.

---
 pym/portage/tests/locks/test_asynchronous_lock.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/portage/tests/locks/test_asynchronous_lock.py b/pym/portage/tests/locks/test_asynchronous_lock.py
index 6e8bc0a..8946caf 100644
--- a/pym/portage/tests/locks/test_asynchronous_lock.py
+++ b/pym/portage/tests/locks/test_asynchronous_lock.py
@@ -56,7 +56,7 @@ class AsynchronousLockTestCase(TestCase):
 			lock2 = AsynchronousLock(path=path, scheduler=scheduler,
 				_force_async=True, _force_process=True)
 			lock2.start()
-			# lock2 should we waiting for lock1 to release
+			# lock2 should be waiting for lock1 to release
 			self.assertEqual(lock2.poll(), None)
 			self.assertEqual(lock2.returncode, None)
 
@@ -79,7 +79,7 @@ class AsynchronousLockTestCase(TestCase):
 			lock2 = AsynchronousLock(path=path, scheduler=scheduler,
 				_force_async=True, _force_process=True)
 			lock2.start()
-			# lock2 should we waiting for lock1 to release
+			# lock2 should be waiting for lock1 to release
 			self.assertEqual(lock2.poll(), None)
 			self.assertEqual(lock2.returncode, None)
 
@@ -104,7 +104,7 @@ class AsynchronousLockTestCase(TestCase):
 			lock2 = AsynchronousLock(path=path, scheduler=scheduler,
 				_force_async=True, _force_process=True)
 			lock2.start()
-			# lock2 should we waiting for lock1 to release
+			# lock2 should be waiting for lock1 to release
 			self.assertEqual(lock2.poll(), None)
 			self.assertEqual(lock2.returncode, None)
 



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-26  6:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-26  6:18 [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/tests/locks/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox