Merge pull request #828 from hqhq/hq_fix_update_kmem

Fix update kernel memory test
This commit is contained in:
Mrunal Patel 2016-05-24 09:58:09 -07:00
commit aa7e27eac9
2 changed files with 14 additions and 1 deletions

View File

@ -70,5 +70,12 @@ EOF
# update kernel memory limit
run "$RUNC" update test_cgroups_kmem --kernel-memory 50331648
[ ! "$status" -eq 0 ]
# Since kernel 4.6, we can update kernel memory without initialization
# because it's accounted by default.
if [ "$KERNEL_MAJOR" -lt 4 ] || [ "$KERNEL_MAJOR" -eq 4 -a "$KERNEL_MINOR" -le 5 ]; then
[ ! "$status" -eq 0 ]
else
[ "$status" -eq 0 ]
check_cgroup_value $CGROUP_MEMORY "memory.kmem.limit_in_bytes" 50331648
fi
}

View File

@ -19,6 +19,12 @@ HELLO_BUNDLE="$BATS_TMPDIR/hello-world"
# CRIU PATH
CRIU="/usr/local/sbin/criu"
# Kernel version
KERNEL_VERSION="$(uname -r)"
KERNEL_MAJOR="${KERNEL_VERSION%%.*}"
KERNEL_MINOR="${KERNEL_VERSION#$KERNEL_MAJOR.}"
KERNEL_MINOR="${KERNEL_MINOR%%.*}"
# Retry a command $1 times until it succeeds. Wait $2 seconds between retries.
function retry() {
local attempts=$1