summaryrefslogtreecommitdiff
path: root/libpod/lock/shm
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-08-24 15:15:56 -0400
committerMatthew Heon <matthew.heon@pm.me>2019-01-04 09:51:09 -0500
commitd4b2f116018e1d8e6a3c4f80f30db45934428c6b (patch)
tree66b020a3db3824d4b5c9831a1b41043aa59a5150 /libpod/lock/shm
parent3de560053f4b391c8386554160f61a2a086c1564 (diff)
downloadpodman-d4b2f116018e1d8e6a3c4f80f30db45934428c6b.tar.gz
podman-d4b2f116018e1d8e6a3c4f80f30db45934428c6b.tar.bz2
podman-d4b2f116018e1d8e6a3c4f80f30db45934428c6b.zip
Convert pods to SHM locks
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'libpod/lock/shm')
-rw-r--r--libpod/lock/shm/shm_lock_test.go11
1 files changed, 7 insertions, 4 deletions
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)
}