]> git.proxmox.com Git - mirror_lxcfs.git/blame - tests/test_sigusr2.sh.in
util: remove doubled comment
[mirror_lxcfs.git] / tests / test_sigusr2.sh.in
CommitLineData
906f4458
CB
1#!/bin/sh
2# SPDX-License-Identifier: LGPL-2.1+
3
4set -eu
5[ -n "${DEBUG:-}" ] && set -x
6
7PASS=0
8
9cleanup() {
10 [ "$PASS" = "1" ] || (echo FAIL && exit 1)
11}
12
13trap cleanup EXIT HUP INT TERM
14
15LXCFSDIR=${LXCFSDIR:-/var/lib/lxcfs}
16
17if ! mountpoint -q ${LXCFSDIR}; then
18 echo "lxcfs isn't mounted on ${LXCFSDIR}"
19 exit 1
20fi
21
ce26ced7
CB
22echo "==> Setting up memory cgroup in lxcfs_test_proc"
23[ ! -d /sys/fs/cgroup/memory ] && exit 0
906f4458 24
ce26ced7
CB
25initmemory=`awk -F: '/memory/ { print $3 }' /proc/1/cgroup`
26mempath=/sys/fs/cgroup/memory/${initmemory}
27rmdir ${mempath}/lxcfs_test_proc 2>/dev/null || true
28mkdir ${mempath}/lxcfs_test_proc
29echo 1 > ${mempath}/lxcfs_test_proc/tasks
30
31echo $((64*1024*1024)) > ${mempath}/lxcfs_test_proc/memory.limit_in_bytes
32
33# Test meminfo
34echo "==> Testing /proc/meminfo"
35[ "$(grep "^MemTotal:.*kB$" ${LXCFSDIR}/proc/meminfo)" = "$(grep "^MemTotal:.*kB$" /proc/meminfo)" ]
906f4458
CB
36
37PASS=1