[lxc-devel] [lxcfs/master] test_sigusr2: improve tests

brauner on Github lxc-bot at linuxcontainers.org
Sat Mar 14 20:27:30 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 365 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200314/7ee4bce4/attachment.bin>
-------------- next part --------------
From 929c6bc4aeaae690995a44af69bf0e1ea23195e9 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sat, 14 Mar 2020 21:27:02 +0100
Subject: [PATCH] test_sigusr2: improve tests

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 tests/test_sigusr2.sh | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/tests/test_sigusr2.sh b/tests/test_sigusr2.sh
index 8637916..887fff0 100755
--- a/tests/test_sigusr2.sh
+++ b/tests/test_sigusr2.sh
@@ -19,9 +19,20 @@ if ! mountpoint -q ${LXCFSDIR}; then
     exit 1
 fi
 
-[ ! -d /sys/fs/cgroup/cpuset ] && exit 0
+echo "==> Setting up memory cgroup in lxcfs_test_proc"
+[ ! -d /sys/fs/cgroup/memory ] && exit 0
 
-# Test cpuinfo
-[ "$(grep "^processor" ${LXCFSDIR}/proc/cpuinfo | wc -l)" = "$(grep "^processor" /proc/cpuinfo | wc -l)" ]
+initmemory=`awk -F: '/memory/ { print $3 }' /proc/1/cgroup`
+mempath=/sys/fs/cgroup/memory/${initmemory}
+rmdir ${mempath}/lxcfs_test_proc 2>/dev/null || true
+mkdir ${mempath}/lxcfs_test_proc
+echo 1 > ${mempath}/lxcfs_test_proc/tasks
+
+echo $((64*1024*1024)) > ${mempath}/lxcfs_test_proc/memory.limit_in_bytes
+echo 0 > ${cpupath}/lxcfs_test_proc/cpuset.cpus
+
+# Test meminfo
+echo "==> Testing /proc/meminfo"
+[ "$(grep -q "^MemTotal.*kB$" ${LXCFSDIR}/proc/meminfo)" = "$(grep -q "^MemTotal.*kB$" /proc/meminfo)" ]
 
 PASS=1


More information about the lxc-devel mailing list