/usr/share/cgmanager/tests/test21.sh is in cgmanager-tests 0.39-2ubuntu5.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #!/bin/bash
echo "Test 21: remove_on_empty"
if [ ! -f /run/cgmanager/agents/cgm-release-agent.memory ]; then
echo "memory cgroup was premounted; skipping remove_on_empty test"
exit 0;
fi
if [ ! -f /run/cgmanager/agents/cgm-release-agent.devices ]; then
echo "devices cgroup was premounted; skipping remove_on_empty test"
exit 0;
fi
cg="test21_cg"
cgm remove memory $cg
cgm remove devices $cg
cgm create memory $cg
cgm create devices $cg
sleep 200 &
pid=$!
cgm movepid memory $cg $pid
cgm movepid devices $cg $pid
cgm removeonempty memory $cg
kill $pid
# now $cg should be deleted in memory, but not in devices
# note if logind or upstart has set this for us then this will raise a false positive
cgm gettasks devices $cg
if [ $? -ne 0 ]; then
echo "Remove-on-empty affected another cgroup"
exit 1
fi
cgm gettasks memory $cg
if [ $? -eq 0 ]; then
# Maybe we're on a slow vm. Kernel needs time to spawn the remove
# helper. Give it some time...
sleep 5
cgm gettasks memory $cg
if [ $? -eq 0 ]; then
echo "Failed to remove-on-empty"
exit 1
fi
fi
echo "Test 21 (remove_on_empty) passed"
exit 0
|