mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
tests: move tests to tests/ directory and give the user cgroup perms
Signed-off-by: Levente Kurusa <lkurusa@acm.org>
This commit is contained in:
19
tools/create_cgroup.sh
Executable file
19
tools/create_cgroup.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
CONTROL_GROUPS=`cargo test -- --list 2>/dev/null | egrep 'test$' | egrep -v '^src' | cut -d':' -f1`
|
||||
|
||||
echo This script will create a control group in every subsystem of the V1 hierarchy.
|
||||
echo For this, we will need your sudo privileges. Please do not trust this shell script and have a look to check that it does something that you are okay with.
|
||||
sudo -v
|
||||
|
||||
for i in ${CONTROL_GROUPS}
|
||||
do sudo mkdir -p /sys/fs/cgroup/{blkio,cpu,cpuacct,cpuset,devices,freezer,hugetlb,memory,net_cls,net_prio,perf_event,pids}/$i/
|
||||
|
||||
done
|
||||
echo
|
||||
echo We will now set up permissions...
|
||||
echo
|
||||
|
||||
for i in ${CONTROL_GROUPS}
|
||||
do sudo chown -R ${USER} /sys/fs/cgroup/{blkio,cpu,cpuacct,cpuset,devices,freezer,hugetlb,memory,net_cls,net_prio,perf_event,pids}/$i/
|
||||
done
|
||||
14
tools/delete_cgroup.sh
Executable file
14
tools/delete_cgroup.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
CONTROL_GROUPS=`cargo test -- --list 2>/dev/null | egrep 'test$' | egrep -v '^src' | cut -d':' -f1`
|
||||
|
||||
echo This script will delete the control groups created by the create_cgroup.sh shell script.
|
||||
echo
|
||||
echo It may spit out some errors, but that is fine.
|
||||
echo
|
||||
echo For this, we will need your sudo privileges. Please do not trust this shell script and have a look to check that it does something that you are okay with.
|
||||
sudo -v
|
||||
|
||||
for i in ${CONTROL_GROUPS}
|
||||
do sudo rmdir /sys/fs/cgroup/{blkio,cpu,cpuacct,cpuset,devices,freezer,hugetlb,memory,net_cls,net_prio,perf_event,pids}/$i/
|
||||
done
|
||||
Reference in New Issue
Block a user