#!/bin/sh

cgroup_path="/sys/fs/cgroup/test"

if [ ! -f /tmp/test_data ]; then
   echo "Creating /tmp/test_data"
   dd if=/dev/zero of=/tmp/test_data bs=1G count=2
fi

if [ ! -d ${cgroup_path} ]; then
   mkdir ${cgroup_path}
fi

echo 1152M > ${cgroup_path}/memory.max
echo 1024M > ${cgroup_path}/memory.high
echo 768M > ${cgroup_path}/memory.low
echo 0 > ${cgroup_path}/memory.min
echo 0 > ${cgroup_path}/memory.swap.max
echo 0 > ${cgroup_path}/memory.swap.high
echo 0 > ${cgroup_path}/memory.zswap.max 

echo 1 > /proc/sys/vm/drop_caches
echo $$ > /sys/fs/cgroup/test/cgroup.procs
./test break-on-each-step

