Re: [PATCH] selftests/sgx: Improve cgroup test scripts

From: Haitao Huang
Date: Mon Apr 01 2024 - 18:55:17 EST


On Mon, 01 Apr 2024 09:22:21 -0500, Jarkko Sakkinen <jarkko@xxxxxxxxxx> wrote:

On Sun Mar 31, 2024 at 8:44 PM EEST, Haitao Huang wrote:
Make cgroup test scripts ash compatible.
Remove cg-tools dependency.
Add documentation for functions.

Tested with busybox on Ubuntu.

Signed-off-by: Haitao Huang <haitao.huang@xxxxxxxxxxxxxxx>

I'll run this next week on good old NUC7. Thank you.

I really wish that either (hopefully both) Intel or AMD would bring up
for developers home use meant platform to develop on TDX and SNP. It is
a shame that the latest and greatest is from 2018.

BR, Jarkko


Argh, missed a few changes for v2 cgroup:

--- a/tools/testing/selftests/sgx/run_epc_cg_selftests.sh
+++ b/tools/testing/selftests/sgx/run_epc_cg_selftests.sh
@@ -15,6 +15,8 @@ CG_MEM_ROOT=/sys/fs/cgroup
CG_V1=0
if [ ! -d "/sys/fs/cgroup/misc" ]; then
echo "# cgroup V2 is in use."
+ echo "+misc" > $CG_MISC_ROOT/cgroup.subtree_control
+ echo "+memory" > $CG_MEM_ROOT/cgroup.subtree_control
else
echo "# cgroup V1 is in use."
CG_MISC_ROOT=/sys/fs/cgroup/misc
@@ -26,6 +28,11 @@ mkdir -p $CG_MISC_ROOT/$TEST_CG_SUB2
mkdir -p $CG_MISC_ROOT/$TEST_CG_SUB3
mkdir -p $CG_MISC_ROOT/$TEST_CG_SUB4

+if [ $CG_V1 -eq 0 ]; then
+echo "+misc" > $CG_MISC_ROOT/$TEST_ROOT_CG/cgroup.subtree_control
+echo "+misc" > $CG_MISC_ROOT/$TEST_CG_SUB1/cgroup.subtree_control
+fi