
add l3 cache testcases for MPAM Signed-off-by: Wen Renjie <wenrenjie@huawei.com> --- testcases/feature-test/mpam/mpam_l3_01.sh | 27 ++++++++++ testcases/feature-test/mpam/mpam_l3_02.sh | 29 ++++++++++ testcases/feature-test/mpam/mpam_l3_03.sh | 35 +++++++++++++ testcases/feature-test/mpam/mpam_l3_04.sh | 60 +++++++++++++++++++++ testcases/feature-test/mpam/mpam_l3_05.sh | 64 +++++++++++++++++++++++ testcases/feature-test/mpam/mpam_l3_06.sh | 64 +++++++++++++++++++++++ testcases/feature-test/mpam/mpam_l3_07.sh | 60 +++++++++++++++++++++ testcases/feature-test/mpam/mpam_l3_08.sh | 35 +++++++++++++ testcases/feature-test/mpam/mpam_l3_09.sh | 41 +++++++++++++++ testcases/feature-test/mpam/mpam_l3_10.sh | 41 +++++++++++++++ testcases/feature-test/mpam/mpam_l3_11.sh | 37 +++++++++++++ testcases/feature-test/mpam/mpam_l3_12.sh | 37 +++++++++++++ testcases/feature-test/mpam/mpam_l3_13.sh | 51 ++++++++++++++++++ testcases/feature-test/mpam/mpam_l3_14.sh | 47 +++++++++++++++++ 14 files changed, 628 insertions(+) create mode 100755 testcases/feature-test/mpam/mpam_l3_01.sh create mode 100755 testcases/feature-test/mpam/mpam_l3_02.sh create mode 100755 testcases/feature-test/mpam/mpam_l3_03.sh create mode 100755 testcases/feature-test/mpam/mpam_l3_04.sh create mode 100755 testcases/feature-test/mpam/mpam_l3_05.sh create mode 100755 testcases/feature-test/mpam/mpam_l3_06.sh create mode 100755 testcases/feature-test/mpam/mpam_l3_07.sh create mode 100755 testcases/feature-test/mpam/mpam_l3_08.sh create mode 100755 testcases/feature-test/mpam/mpam_l3_09.sh create mode 100755 testcases/feature-test/mpam/mpam_l3_10.sh create mode 100755 testcases/feature-test/mpam/mpam_l3_11.sh create mode 100755 testcases/feature-test/mpam/mpam_l3_12.sh create mode 100755 testcases/feature-test/mpam/mpam_l3_13.sh create mode 100755 testcases/feature-test/mpam/mpam_l3_14.sh diff --git a/testcases/feature-test/mpam/mpam_l3_01.sh b/testcases/feature-test/mpam/mpam_l3_01.sh new file mode 100755 index 00000000..aec78357 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_01.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/04 +# resctrl分组下,schemata配置L3MIN为20% + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + echo "L3MIN:${ENV_L3_ID[0]}=20" > $mpam_dir/schemata + if [ $? -eq 0 ]; then + tst_res TPASS "根分组L3MIN配置成功" + else + tst_res TFAIL "根分组L3MIN配置失败" + 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_l3_02.sh b/testcases/feature-test/mpam/mpam_l3_02.sh new file mode 100755 index 00000000..f352b2de --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_02.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/04 +# 资源组下,schemata配置L3MIN为50% + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p1 + + echo "L3MIN:${ENV_L3_ID[0]}=50" > $mpam_dir/p1/schemata + if [ $? -eq 0 ]; then + tst_res TPASS "资源组L3MIN配置成功" + else + tst_res TFAIL "资源组L3MIN配置失败" + 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_l3_03.sh b/testcases/feature-test/mpam/mpam_l3_03.sh new file mode 100755 index 00000000..73803e80 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_03.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/04 +# resctrl及资源组下,schemata配置L3MAX为60% + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + echo "L3MAX:${ENV_L3_ID[0]}=60" > $mpam_dir/schemata + if [ $? -eq 0 ]; then + tst_res TPASS "根分组L3MAX配置成功" + else + tst_res TFAIL "根分组L3MAX配置失败" + fi + + mkdir $mpam_dir/p1 + echo "L3MAX:${ENV_L3_ID[0]}=60" > $mpam_dir/p1/schemata + if [ $? -eq 0 ]; then + tst_res TPASS "资源组L3MAX配置成功" + else + tst_res TFAIL "资源组L3MAX配置失败" + 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_l3_04.sh b/testcases/feature-test/mpam/mpam_l3_04.sh new file mode 100755 index 00000000..16a09920 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_04.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/05 +# 配置一个域的l3 cache配置,并关联绑定cpu运行业务的vcpu + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + echo "L3:${ENV_L3_ID[0]}=f" > $mpam_dir/schemata + grep -w L3 $mpam_dir/schemata | grep -q "${ENV_L3_ID[0]}=`printf "%05x" 0xf`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组L3配置成功" + else + tst_res TFAIL "根分组L3配置失败" + fi + echo "L3:${ENV_L3_ID[0]}=1f" > $mpam_dir/schemata + grep -w L3 $mpam_dir/schemata | grep -q "${ENV_L3_ID[0]}=`printf "%05x" 0x1f`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组L3修改配置成功" + else + tst_res TFAIL "根分组L3修改配置失败" + fi + + mkdir $mpam_dir/p1 + echo "L3:${ENV_L3_ID[0]}=f" > $mpam_dir/p1/schemata + grep -w L3 $mpam_dir/p1/schemata | grep -q "${ENV_L3_ID[0]}=`printf "%05x" 0xf`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组L3配置成功" + else + tst_res TFAIL "资源组L3配置失败" + fi + echo "L3:${ENV_L3_ID[0]}=1f" > $mpam_dir/p1/schemata + grep -w L3 $mpam_dir/p1/schemata | grep -q "${ENV_L3_ID[0]}=`printf "%05x" 0x1f`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组L3修改配置成功" + else + tst_res TFAIL "资源组L3修改配置失败" + 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 "配置L3后关联cpu成功" + else + tst_res TFAIL "配置L3后关联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_l3_05.sh b/testcases/feature-test/mpam/mpam_l3_05.sh new file mode 100755 index 00000000..b66b7361 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_05.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/05 +# 配置一个域的l3 cache配置,并关联pid + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + echo "L3:${ENV_L3_ID[0]}=f" > $mpam_dir/schemata + grep -w L3 $mpam_dir/schemata | grep -q "${ENV_L3_ID[0]}=`printf "%05x" 0xf`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组L3配置成功" + else + tst_res TFAIL "根分组L3配置失败" + fi + echo "L3:${ENV_L3_ID[0]}=1f" > $mpam_dir/schemata + grep -w L3 $mpam_dir/schemata | grep -q "${ENV_L3_ID[0]}=`printf "%05x" 0x1f`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组L3修改配置成功" + else + tst_res TFAIL "根分组L3修改配置失败" + fi + + mkdir $mpam_dir/p1 + echo "L3:${ENV_L3_ID[0]}=f" > $mpam_dir/p1/schemata + grep -w L3 $mpam_dir/p1/schemata | grep -q "${ENV_L3_ID[0]}=`printf "%05x" 0xf`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组L3配置成功" + else + tst_res TFAIL "资源组L3配置失败" + fi + echo "L3:${ENV_L3_ID[0]}=1f" > $mpam_dir/p1/schemata + grep -w L3 $mpam_dir/p1/schemata | grep -q "${ENV_L3_ID[0]}=`printf "%05x" 0x1f`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组L3修改配置成功" + else + tst_res TFAIL "资源组L3修改配置失败" + fi + + sleep 100 & + pid=$! + + echo $pid > $mpam_dir/p1/tasks + grep -wq $pid $mpam_dir/p1/tasks + if [ $? -eq 0 ]; then + tst_res TPASS "配置L3后关联pid成功" + else + tst_res TFAIL "配置L3后关联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_l3_06.sh b/testcases/feature-test/mpam/mpam_l3_06.sh new file mode 100755 index 00000000..d09a21ec --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_06.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/05 +# 配置多个域的l3 cache配置,并关联pid + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + echo "L3:${ENV_L3_ID[0]}=f;${ENV_L3_ID[1]}=ff" > $mpam_dir/schemata + grep -w L3 $mpam_dir/schemata | grep "${ENV_L3_ID[0]}=`printf "%05x" 0xf`" | grep -q "${ENV_L3_ID[1]}=`printf "%05x" 0xff`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组L3配置成功" + else + tst_res TFAIL "根分组L3配置失败" + fi + echo "L3:${ENV_L3_ID[0]}=1f;${ENV_L3_ID[1]}=1ff" > $mpam_dir/schemata + grep -w L3 $mpam_dir/schemata | grep "${ENV_L3_ID[0]}=`printf "%05x" 0x1f`" | grep -q "${ENV_L3_ID[1]}=`printf "%05x" 0x1ff`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组L3修改配置成功" + else + tst_res TFAIL "根分组L3修改配置失败" + fi + + mkdir $mpam_dir/p1 + echo "L3:${ENV_L3_ID[0]}=f;${ENV_L3_ID[1]}=ff" > $mpam_dir/p1/schemata + grep -w L3 $mpam_dir/p1/schemata | grep "${ENV_L3_ID[0]}=`printf "%05x" 0xf`" | grep -q "${ENV_L3_ID[1]}=`printf "%05x" 0xff`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组L3配置成功" + else + tst_res TFAIL "资源组L3配置失败" + fi + echo "L3:${ENV_L3_ID[0]}=1f;${ENV_L3_ID[1]}=1ff" > $mpam_dir/p1/schemata + grep -w L3 $mpam_dir/p1/schemata | grep "${ENV_L3_ID[0]}=`printf "%05x" 0x1f`" | grep -q "${ENV_L3_ID[1]}=`printf "%05x" 0x1ff`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组L3修改配置成功" + else + tst_res TFAIL "资源组L3修改配置失败" + fi + + sleep 100 & + pid=$! + + echo $pid > $mpam_dir/p1/tasks + grep -wq $pid $mpam_dir/p1/tasks + if [ $? -eq 0 ]; then + tst_res TPASS "配置L3后关联pid成功" + else + tst_res TFAIL "配置L3后关联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_l3_07.sh b/testcases/feature-test/mpam/mpam_l3_07.sh new file mode 100755 index 00000000..8a105285 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_07.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/05 +# 配置多个域的l3 cache配置,并关联绑定cpu运行业务的vcpu + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + echo "L3:${ENV_L3_ID[0]}=f;${ENV_L3_ID[1]}=ff" > $mpam_dir/schemata + grep -w L3 $mpam_dir/schemata | grep "${ENV_L3_ID[0]}=`printf "%05x" 0xf`" | grep -q "${ENV_L3_ID[1]}=`printf "%05x" 0xff`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组L3配置成功" + else + tst_res TFAIL "根分组L3配置失败" + fi + echo "L3:${ENV_L3_ID[0]}=1f;${ENV_L3_ID[1]}=1ff" > $mpam_dir/schemata + grep -w L3 $mpam_dir/schemata | grep "${ENV_L3_ID[0]}=`printf "%05x" 0x1f`" | grep -q "${ENV_L3_ID[1]}=`printf "%05x" 0x1ff`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组L3修改配置成功" + else + tst_res TFAIL "根分组L3修改配置失败" + fi + + mkdir $mpam_dir/p1 + echo "L3:${ENV_L3_ID[0]}=f;${ENV_L3_ID[1]}=ff" > $mpam_dir/p1/schemata + grep -w L3 $mpam_dir/p1/schemata | grep "${ENV_L3_ID[0]}=`printf "%05x" 0xf`" | grep -q "${ENV_L3_ID[1]}=`printf "%05x" 0xff`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组L3配置成功" + else + tst_res TFAIL "资源组L3配置失败" + fi + echo "L3:${ENV_L3_ID[0]}=1f;${ENV_L3_ID[1]}=1ff" > $mpam_dir/p1/schemata + grep -w L3 $mpam_dir/p1/schemata | grep "${ENV_L3_ID[0]}=`printf "%05x" 0x1f`" | grep -q "${ENV_L3_ID[1]}=`printf "%05x" 0x1ff`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组L3修改配置成功" + else + tst_res TFAIL "资源组L3修改配置失败" + 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 "配置L3后关联cpu成功" + else + tst_res TFAIL "配置L3后关联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_l3_08.sh b/testcases/feature-test/mpam/mpam_l3_08.sh new file mode 100755 index 00000000..c5f889f1 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_08.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/05 +# 将一个域的l3 cache配置为 超过最大值的cache way + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + echo "L3:${ENV_L3_ID[0]}=ffffffff" > $mpam_dir/schemata + if [ $? -eq 0 ]; then + tst_res TFAIL "根分组配置超出范围的L3成功" + else + tst_res TPASS "根分组配置超出范围的L3失败" + fi + + mkdir $mpam_dir/p1 + echo "L3:${ENV_L3_ID[0]}=ffffffff" > $mpam_dir/p1/schemata + if [ $? -eq 0 ]; then + tst_res TFAIL "资源组配置超出范围的L3成功" + else + tst_res TPASS "资源组配置超出范围的L3失败" + 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_l3_09.sh b/testcases/feature-test/mpam/mpam_l3_09.sh new file mode 100755 index 00000000..bdc1581d --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_09.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/05 +# resctrl及资源组下,schemata配置其中一个域的L3PRI为最大值 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + for i in ${ENV_L3_ID[@]}; do + echo "L3PRI:$i=3" > $mpam_dir/schemata + grep -w L3PRI $mpam_dir/schemata | grep -q "$i=`printf "%05d" 3`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组配置 $i L3PRI最大值成功" + else + tst_res TFAIL "根分组配置 $i L3PRI最大值失败" + fi + done + + mkdir $mpam_dir/p1 + for i in ${ENV_L3_ID[@]}; do + echo "L3PRI:$i=3" > $mpam_dir/p1/schemata + grep -w L3PRI $mpam_dir/p1/schemata | grep -q "$i=`printf "%05d" 3`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组配置 $i L3PRI最大值成功" + else + tst_res TFAIL "资源组配置 $i L3PRI最大值失败" + fi + done + + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file diff --git a/testcases/feature-test/mpam/mpam_l3_10.sh b/testcases/feature-test/mpam/mpam_l3_10.sh new file mode 100755 index 00000000..20551e1c --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_10.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/05 +# resctrl及资源组下,schemata配置其中一个域的L3PRI为最小值 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + for i in ${ENV_L3_ID[@]}; do + echo "L3PRI:$i=0" > $mpam_dir/schemata + grep -w L3PRI $mpam_dir/schemata | grep -q "$i=`printf "%05d" 0`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组配置 $i L3PRI最大值成功" + else + tst_res TFAIL "根分组配置 $i L3PRI最大值失败" + fi + done + + mkdir $mpam_dir/p1 + for i in ${ENV_L3_ID[@]}; do + echo "L3PRI:$i=0" > $mpam_dir/p1/schemata + grep -w L3PRI $mpam_dir/p1/schemata | grep -q "$i=`printf "%05d" 0`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组配置 $i L3PRI最大值成功" + else + tst_res TFAIL "资源组配置 $i L3PRI最大值失败" + fi + done + + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file diff --git a/testcases/feature-test/mpam/mpam_l3_11.sh b/testcases/feature-test/mpam/mpam_l3_11.sh new file mode 100755 index 00000000..35c1260f --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_11.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/05 +# resctrl及资源组下,schemata配置全部域的L3PRI为最大值 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + echo "L3PRI:${ENV_L3_ID[0]}=3;${ENV_L3_ID[1]}=3" > $mpam_dir/schemata + grep -w L3PRI $mpam_dir/schemata | grep "${ENV_L3_ID[0]}=`printf "%05d" 3`" | grep -q "${ENV_L3_ID[1]}=`printf "%05d" 3`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组配置多个域L3PRI最大值成功" + else + tst_res TFAIL "根分组配置多个域L3PRI最大值失败" + fi + + mkdir $mpam_dir/p1 + echo "L3PRI:${ENV_L3_ID[0]}=3;${ENV_L3_ID[1]}=3" > $mpam_dir/p1/schemata + grep -w L3PRI $mpam_dir/p1/schemata | grep "${ENV_L3_ID[0]}=`printf "%05d" 3`" | grep -q "${ENV_L3_ID[1]}=`printf "%05d" 3`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组配置多个域L3PRI最大值成功" + else + tst_res TFAIL "资源组配置多个域L3PRI最大值失败" + 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_l3_12.sh b/testcases/feature-test/mpam/mpam_l3_12.sh new file mode 100755 index 00000000..f6278531 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_12.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/05 +# resctrl及资源组下,schemata配置全部域的L3PRI为最小值 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + echo "L3PRI:${ENV_L3_ID[0]}=0;${ENV_L3_ID[1]}=0" > $mpam_dir/schemata + grep -w L3PRI $mpam_dir/schemata | grep "${ENV_L3_ID[0]}=`printf "%05d" 0`" | grep -q "${ENV_L3_ID[1]}=`printf "%05d" 0`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组配置多个域L3PRI最小值成功" + else + tst_res TFAIL "根分组配置多个域L3PRI最小值失败" + fi + + mkdir $mpam_dir/p1 + echo "L3PRI:${ENV_L3_ID[0]}=0;${ENV_L3_ID[1]}=0" > $mpam_dir/p1/schemata + grep -w L3PRI $mpam_dir/p1/schemata | grep "${ENV_L3_ID[0]}=`printf "%05d" 0`" | grep -q "${ENV_L3_ID[1]}=`printf "%05d" 0`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组配置多个域L3PRI最小值成功" + else + tst_res TFAIL "资源组配置多个域L3PRI最小值失败" + 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_l3_13.sh b/testcases/feature-test/mpam/mpam_l3_13.sh new file mode 100755 index 00000000..fd5bf78a --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_13.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/05 +# resctrl及资源组下,schemata配置多个域的L3cpd为不同值 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir -o cdp + + echo "L3CODE:${ENV_L3_ID[0]}=f;${ENV_L3_ID[1]}=1ff" > $mpam_dir/schemata + grep -w L3CODE $mpam_dir/schemata | grep "${ENV_L3_ID[0]}=`printf "%05x" 0xf`" | grep -q "${ENV_L3_ID[1]}=`printf "%05x" 0x1ff`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组配置多个域L3CODE成功" + else + tst_res TFAIL "根分组配置多个域L3CODE失败" + fi + echo "L3DATA:${ENV_L3_ID[0]}=f;${ENV_L3_ID[1]}=1ff" > $mpam_dir/schemata + grep -w L3DATA $mpam_dir/schemata | grep "${ENV_L3_ID[0]}=`printf "%05x" 0xf`" | grep -q "${ENV_L3_ID[1]}=`printf "%05x" 0x1ff`" + if [ $? -eq 0 ]; then + tst_res TPASS "组配置多个域L3DATA成功" + else + tst_res TFAIL "根分组配置多个域L3DATA失败" + fi + + mkdir $mpam_dir/p1 + echo "L3CODE:${ENV_L3_ID[0]}=f;${ENV_L3_ID[1]}=1ff" > $mpam_dir/p1/schemata + grep -w L3CODE $mpam_dir/p1/schemata | grep "${ENV_L3_ID[0]}=`printf "%05x" 0xf`" | grep -q "${ENV_L3_ID[1]}=`printf "%05x" 0x1ff`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组配置多个域L3CODE成功" + else + tst_res TFAIL "资源组配置多个域L3CODE失败" + fi + echo "L3DATA:${ENV_L3_ID[0]}=f;${ENV_L3_ID[1]}=1ff" > $mpam_dir/p1/schemata + grep -w L3DATA $mpam_dir/p1/schemata | grep "${ENV_L3_ID[0]}=`printf "%05x" 0xf`" | grep -q "${ENV_L3_ID[1]}=`printf "%05x" 0x1ff`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组配置多个域L3DATA成功" + else + tst_res TFAIL "资源组配置多个域L3DATA失败" + 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_l3_14.sh b/testcases/feature-test/mpam/mpam_l3_14.sh new file mode 100755 index 00000000..33be76c4 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_l3_14.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/05 +# resctrl及资源组下,schemata配置一个域的L3cpd值超过最大值 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir -o cdp + + echo "L3CODE:${ENV_L3_ID[0]}=fffff" > $mpam_dir/schemata + if [ $? -eq 0 ]; then + tst_res TFAIL "根分组配置超出范围的L3CODE成功" + else + tst_res TPASS "根分组配置超出范围的L3CODE失败" + fi + echo "L3DATA:${ENV_L3_ID[0]}=fffff" > $mpam_dir/schemata + if [ $? -eq 0 ]; then + tst_res TFAIL "根分组配置超出范围的L3DATA成功" + else + tst_res TPASS "根分组配置超出范围的L3DATA失败" + fi + + mkdir $mpam_dir/p1 + echo "L3CODE:${ENV_L3_ID[0]}=fffff" > $mpam_dir/p1/schemata + if [ $? -eq 0 ]; then + tst_res TFAIL "资源组配置超出范围的L3CODE成功" + else + tst_res TPASS "资源组配置超出范围的L3CODE失败" + fi + echo "L3DATA:${ENV_L3_ID[0]}=fffff" > $mpam_dir/p1/schemata + if [ $? -eq 0 ]; then + tst_res TFAIL "资源组配置超出范围的L3DATA成功" + else + tst_res TPASS "资源组配置超出范围的L3DATA失败" + fi + + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file -- 2.25.1