
add l2 cache testcases for MPAM Signed-off-by: Wen Renjie <wenrenjie@huawei.com> --- testcases/feature-test/mpam/mpam_l2_01.sh | 40 ++++++++++++++++++ testcases/feature-test/mpam/mpam_l2_02.sh | 43 +++++++++++++++++++ testcases/feature-test/mpam/mpam_l2_03.sh | 50 +++++++++++++++++++++++ testcases/feature-test/mpam/mpam_l2_04.sh | 47 +++++++++++++++++++++ testcases/feature-test/mpam/mpam_l2_05.sh | 38 +++++++++++++++++ testcases/feature-test/mpam/mpam_l2_06.sh | 36 ++++++++++++++++ 6 files changed, 254 insertions(+) create mode 100755 testcases/feature-test/mpam/mpam_l2_01.sh create mode 100755 testcases/feature-test/mpam/mpam_l2_02.sh create mode 100755 testcases/feature-test/mpam/mpam_l2_03.sh create mode 100755 testcases/feature-test/mpam/mpam_l2_04.sh create mode 100755 testcases/feature-test/mpam/mpam_l2_05.sh create mode 100755 testcases/feature-test/mpam/mpam_l2_06.sh diff --git a/testcases/feature-test/mpam/mpam_l2_01.sh b/testcases/feature-test/mpam/mpam_l2_01.sh new file mode 100755 index 00000000..a1034110 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l2_01.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/04 +# 配置一个域的L2 cache配置,并关联绑定cpu运行业务的vcpu + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir -o l2 + + mkdir $mpam_dir/p1 + + echo "L2:${ENV_L2_ID[0]}=1" > $mpam_dir/p1/schemata + grep -w L2 $mpam_dir/p1/schemata | grep -q "${ENV_L2_ID[0]}=`printf "%05x" 1`" + if [ $? -eq 0 ]; then + tst_res TPASS "L2cache配置成功" + else + tst_res TFAIL "L2cache配置失败" + fi + + cpu=1 + echo $cpu > $mpam_dir/p1/cpus_list + + grep -wq $cpu $mpam_dir/p1/cpus_list + if [ $? -eq 0 ]; then + tst_res TPASS "关联cpu成功" + else + tst_res TFAIL "关联cpu失败" + fi + + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file diff --git a/testcases/feature-test/mpam/mpam_l2_02.sh b/testcases/feature-test/mpam/mpam_l2_02.sh new file mode 100755 index 00000000..86505834 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l2_02.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/04 +# 配置一个域的L2 cache配置,并关联pid + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir -o l2 + + mkdir $mpam_dir/p1 + + echo "L2:${ENV_L2_ID[0]}=1" > $mpam_dir/p1/schemata + grep -w L2 $mpam_dir/p1/schemata | grep -q "${ENV_L2_ID[0]}=`printf "%05x" 1`" + if [ $? -eq 0 ]; then + tst_res TPASS "L2cache配置成功" + else + tst_res TFAIL "L2cache配置失败" + fi + + sleep 100 & + pid=$! + + echo $pid > $mpam_dir/p1/tasks + grep -wq $pid $mpam_dir/p1/tasks + if [ $? -eq 0 ]; then + tst_res TPASS "关联pid成功" + else + tst_res TFAIL "关联pid失败" + fi + + kill -9 $pid + + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file diff --git a/testcases/feature-test/mpam/mpam_l2_03.sh b/testcases/feature-test/mpam/mpam_l2_03.sh new file mode 100755 index 00000000..51861dd2 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l2_03.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/04 +# 配置多个域的L2 cache配置,并关联pid + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir -o l2 + + mkdir $mpam_dir/p1 + + echo "L2:${ENV_L2_ID[0]}=1" > $mpam_dir/p1/schemata + grep -w L2 $mpam_dir/p1/schemata | grep -q "${ENV_L2_ID[0]}=`printf "%05x" 1`" + if [ $? -eq 0 ]; then + tst_res TPASS "L2cache配置成功" + else + tst_res TFAIL "L2cache配置失败" + fi + echo "L2:${ENV_L2_ID[1]}=1" > $mpam_dir/p1/schemata + grep -w L2 $mpam_dir/p1/schemata | grep -q "${ENV_L2_ID[1]}=`printf "%05x" 1`" + if [ $? -eq 0 ]; then + tst_res TPASS "L2cache配置多个域成功" + else + tst_res TFAIL "L2cache配置多个域失败" + fi + + sleep 100 & + pid=$! + + echo $pid > $mpam_dir/p1/tasks + grep -wq $pid $mpam_dir/p1/tasks + if [ $? -eq 0 ]; then + tst_res TPASS "关联pid成功" + else + tst_res TFAIL "关联pid失败" + fi + + kill -9 $pid + + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file diff --git a/testcases/feature-test/mpam/mpam_l2_04.sh b/testcases/feature-test/mpam/mpam_l2_04.sh new file mode 100755 index 00000000..48e3b78a --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l2_04.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/04 +# 配置多个域的L2 cache配置,并关联绑定cpu运行业务的vcpu + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir -o l2 + + mkdir $mpam_dir/p1 + + echo "L2:${ENV_L2_ID[0]}=1" > $mpam_dir/p1/schemata + grep -w L2 $mpam_dir/p1/schemata | grep -q "${ENV_L2_ID[0]}=`printf "%05x" 1`" + if [ $? -eq 0 ]; then + tst_res TPASS "L2cache配置成功" + else + tst_res TFAIL "L2cache配置失败" + fi + echo "L2:${ENV_L2_ID[1]}=1" > $mpam_dir/p1/schemata + grep -w L2 $mpam_dir/p1/schemata | grep -q "${ENV_L2_ID[1]}=`printf "%05x" 1`" + if [ $? -eq 0 ]; then + tst_res TPASS "L2cache配置多个域成功" + else + tst_res TFAIL "L2cache配置多个域失败" + fi + + cpu=1 + echo $cpu > $mpam_dir/p1/cpus_list + + grep -wq $cpu $mpam_dir/p1/cpus_list + if [ $? -eq 0 ]; then + tst_res TPASS "关联cpu成功" + else + tst_res TFAIL "关联cpu失败" + fi + + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file diff --git a/testcases/feature-test/mpam/mpam_l2_05.sh b/testcases/feature-test/mpam/mpam_l2_05.sh new file mode 100755 index 00000000..2c440021 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l2_05.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/04 +# resctrl及资源组下,schemata配置多个域的L2cpd为不同值 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir -o l2,cdp + + mkdir $mpam_dir/p1 + + echo "L2CODE:${ENV_L2_ID[0]}=f;${ENV_L2_ID[1]}=1f" > $mpam_dir/p1/schemata + echo "L2DATA:${ENV_L2_ID[0]}=1f;${ENV_L2_ID[1]}=ff" > $mpam_dir/p1/schemata + + grep -w L2CODE $mpam_dir/p1/schemata | grep "${ENV_L2_ID[0]}=`printf "%05x" 0xf`" | grep -q "${ENV_L2_ID[1]}=`printf "%05x" 0x1f`" + if [ $? -eq 0 ]; then + tst_res TPASS "L2CODE配置成功" + else + tst_res TFAIL "L2CODE配置失败" + fi + grep -w L2DATA $mpam_dir/p1/schemata | grep "${ENV_L2_ID[0]}=`printf "%05x" 0x1f`" | grep -q "${ENV_L2_ID[1]}=`printf "%05x" 0xff`" + if [ $? -eq 0 ]; then + tst_res TPASS "L2DATA配置成功" + else + tst_res TFAIL "L2DATA配置失败" + fi + + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file diff --git a/testcases/feature-test/mpam/mpam_l2_06.sh b/testcases/feature-test/mpam/mpam_l2_06.sh new file mode 100755 index 00000000..e245d732 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l2_06.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/04 +# resctrl及资源组下,schemata配置一个域的L2cpd值超过最大值 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir -o l2,cdp + + mkdir $mpam_dir/p1 + + echo "L2CODE:${ENV_L2_ID[0]}=ffff" > $mpam_dir/p1/schemata + if [ $? -eq 0 ]; then + tst_res TFAIL "L2CODE非法值配置成功" + else + tst_res TPASS "L2CODE非法值配置失败" + fi + + echo "L2DATA:${ENV_L2_ID[0]}=fffff" > $mpam_dir/p1/schemata + if [ $? -eq 0 ]; then + tst_res TFAIL "L2DATA非法值配置成功" + else + tst_res TPASS "L2DATA非法值配置失败" + fi + + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file -- 2.25.1