From d4b2f116018e1d8e6a3c4f80f30db45934428c6b Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Fri, 24 Aug 2018 15:15:56 -0400 Subject: Convert pods to SHM locks Signed-off-by: Matthew Heon --- libpod/lock/shm/shm_lock_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libpod/lock') diff --git a/libpod/lock/shm/shm_lock_test.go b/libpod/lock/shm/shm_lock_test.go index 7174253d0..bdf0b19e5 100644 --- a/libpod/lock/shm/shm_lock_test.go +++ b/libpod/lock/shm/shm_lock_test.go @@ -18,7 +18,7 @@ import ( // We can at least verify that the locks work within the local process. // 4 * BITMAP_SIZE to ensure we have to traverse bitmaps -const numLocks uint32 = 4 * BitmapSize +var numLocks uint32 = 4 * BitmapSize const lockPath = "/libpod_test" @@ -155,7 +155,8 @@ func TestAllocateTwoLocksGetsDifferentLocks(t *testing.T) { func TestAllocateAllLocksSucceeds(t *testing.T) { runLockTest(t, func(t *testing.T, locks *SHMLocks) { sems := make(map[uint32]bool) - for i := 0; i < numLocks; i++ { + var i uint32 + for i = 0; i < numLocks; i++ { sem, err := locks.AllocateSemaphore() assert.NoError(t, err) @@ -172,7 +173,8 @@ func TestAllocateAllLocksSucceeds(t *testing.T) { func TestAllocateTooManyLocksFails(t *testing.T) { runLockTest(t, func(t *testing.T, locks *SHMLocks) { // Allocate all locks - for i := 0; i < numLocks; i++ { + var i uint32 + for i = 0; i < numLocks; i++ { _, err := locks.AllocateSemaphore() assert.NoError(t, err) } @@ -187,7 +189,8 @@ func TestAllocateTooManyLocksFails(t *testing.T) { func TestAllocateDeallocateCycle(t *testing.T) { runLockTest(t, func(t *testing.T, locks *SHMLocks) { // Allocate all locks - for i := 0; i < numLocks; i++ { + var i uint32 + for i = 0; i < numLocks; i++ { _, err := locks.AllocateSemaphore() assert.NoError(t, err) } -- cgit v1.2.3-54-g00ecf