[PATCH openEuler-testcase 0/7] MPAM testcases: add testcases for MPAM feature

add testcases for MPAM feature w00639456 (7): MPAM testcases: resource and monitor group test MPAM testcases: schemata l2 cache test MPAM testcases: schemata l3 cache test MPAM testcases: schemata MB test MPAM testcases: resctrl system mount test MPAM testcases: pid and cpu resources relate test MPAM testcases: lib file testcases/feature-test/mpam/mpam_group_01.sh | 33 +++ testcases/feature-test/mpam/mpam_group_02.sh | 33 +++ testcases/feature-test/mpam/mpam_group_03.sh | 33 +++ testcases/feature-test/mpam/mpam_group_04.sh | 33 +++ testcases/feature-test/mpam/mpam_group_05.sh | 35 +++ testcases/feature-test/mpam/mpam_group_06.sh | 48 ++++ 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 +++ 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 ++++ testcases/feature-test/mpam/mpam_lib.sh | 84 +++++++ testcases/feature-test/mpam/mpam_mb_01.sh | 32 +++ testcases/feature-test/mpam/mpam_mb_02.sh | 32 +++ testcases/feature-test/mpam/mpam_mb_03.sh | 30 +++ testcases/feature-test/mpam/mpam_mb_04.sh | 30 +++ testcases/feature-test/mpam/mpam_mb_05.sh | 46 ++++ testcases/feature-test/mpam/mpam_mb_06.sh | 46 ++++ testcases/feature-test/mpam/mpam_mb_07.sh | 46 ++++ testcases/feature-test/mpam/mpam_mount_01.sh | 24 ++ testcases/feature-test/mpam/mpam_mount_02.sh | 24 ++ testcases/feature-test/mpam/mpam_mount_03.sh | 25 ++ testcases/feature-test/mpam/mpam_mount_04.sh | 32 +++ testcases/feature-test/mpam/mpam_mount_05.sh | 30 +++ testcases/feature-test/mpam/mpam_relate_01.sh | 41 ++++ testcases/feature-test/mpam/mpam_relate_02.sh | 48 ++++ testcases/feature-test/mpam/mpam_relate_03.sh | 42 ++++ testcases/feature-test/mpam/mpam_relate_04.sh | 52 ++++ testcases/feature-test/mpam/mpam_relate_05.sh | 40 +++ testcases/feature-test/mpam/mpam_relate_06.sh | 40 +++ testcases/feature-test/mpam/mpam_relate_07.sh | 39 +++ testcases/feature-test/mpam/mpam_relate_08.sh | 40 +++ testcases/feature-test/mpam/mpam_relate_09.sh | 59 +++++ testcases/feature-test/mpam/mpam_relate_10.sh | 43 ++++ testcases/feature-test/mpam/mpam_relate_11.sh | 43 ++++ testcases/feature-test/mpam/mpam_relate_12.sh | 41 ++++ testcases/feature-test/mpam/tst_test.sh | 229 ++++++++++++++++++ 52 files changed, 2335 insertions(+) create mode 100755 testcases/feature-test/mpam/mpam_group_01.sh create mode 100755 testcases/feature-test/mpam/mpam_group_02.sh create mode 100755 testcases/feature-test/mpam/mpam_group_03.sh create mode 100755 testcases/feature-test/mpam/mpam_group_04.sh create mode 100755 testcases/feature-test/mpam/mpam_group_05.sh create mode 100755 testcases/feature-test/mpam/mpam_group_06.sh 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 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 create mode 100644 testcases/feature-test/mpam/mpam_lib.sh create mode 100755 testcases/feature-test/mpam/mpam_mb_01.sh create mode 100755 testcases/feature-test/mpam/mpam_mb_02.sh create mode 100755 testcases/feature-test/mpam/mpam_mb_03.sh create mode 100755 testcases/feature-test/mpam/mpam_mb_04.sh create mode 100755 testcases/feature-test/mpam/mpam_mb_05.sh create mode 100755 testcases/feature-test/mpam/mpam_mb_06.sh create mode 100755 testcases/feature-test/mpam/mpam_mb_07.sh create mode 100755 testcases/feature-test/mpam/mpam_mount_01.sh create mode 100755 testcases/feature-test/mpam/mpam_mount_02.sh create mode 100755 testcases/feature-test/mpam/mpam_mount_03.sh create mode 100755 testcases/feature-test/mpam/mpam_mount_04.sh create mode 100755 testcases/feature-test/mpam/mpam_mount_05.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_01.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_02.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_03.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_04.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_05.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_06.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_07.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_08.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_09.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_10.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_11.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_12.sh create mode 100755 testcases/feature-test/mpam/tst_test.sh -- 2.25.1

add resource and monitor group testcases for MPAM Signed-off-by: Wen Renjie <wenrenjie@huawei.com> --- testcases/feature-test/mpam/mpam_group_01.sh | 33 ++++++++++++++ testcases/feature-test/mpam/mpam_group_02.sh | 33 ++++++++++++++ testcases/feature-test/mpam/mpam_group_03.sh | 33 ++++++++++++++ testcases/feature-test/mpam/mpam_group_04.sh | 33 ++++++++++++++ testcases/feature-test/mpam/mpam_group_05.sh | 35 ++++++++++++++ testcases/feature-test/mpam/mpam_group_06.sh | 48 ++++++++++++++++++++ 6 files changed, 215 insertions(+) create mode 100755 testcases/feature-test/mpam/mpam_group_01.sh create mode 100755 testcases/feature-test/mpam/mpam_group_02.sh create mode 100755 testcases/feature-test/mpam/mpam_group_03.sh create mode 100755 testcases/feature-test/mpam/mpam_group_04.sh create mode 100755 testcases/feature-test/mpam/mpam_group_05.sh create mode 100755 testcases/feature-test/mpam/mpam_group_06.sh diff --git a/testcases/feature-test/mpam/mpam_group_01.sh b/testcases/feature-test/mpam/mpam_group_01.sh new file mode 100755 index 00000000..c82e4e32 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_group_01.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/01 +# 创建单个资源组并删除 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p0 + if [ $? -eq 0 ]; then + tst_res TPASS "创建单个资源组成功" + else + tst_res TFAIL "创建单个资源组失败" + fi + + rmdir $mpam_dir/p0 + if [ $? -eq 0 ]; then + tst_res TPASS "删除单个资源组成功" + else + tst_res TFAIL "删除单个资源组失败" + 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_group_02.sh b/testcases/feature-test/mpam/mpam_group_02.sh new file mode 100755 index 00000000..d50addef --- /dev/null +++ b/testcases/feature-test/mpam/mpam_group_02.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/01 +# 创建多个资源组并删除 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p0 $mpam_dir/p1 $mpam_dir/p2 + if [ $? -eq 0 ]; then + tst_res TPASS "创建多个资源组成功" + else + tst_res TFAIL "创建多个资源组失败" + fi + + rmdir $mpam_dir/p0 $mpam_dir/p1 $mpam_dir/p2 + if [ $? -eq 0 ]; then + tst_res TPASS "删除多个资源组成功" + else + tst_res TFAIL "删除多个资源组失败" + 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_group_03.sh b/testcases/feature-test/mpam/mpam_group_03.sh new file mode 100755 index 00000000..555b65be --- /dev/null +++ b/testcases/feature-test/mpam/mpam_group_03.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/01 +# 创建单个监控组并删除 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/mon_groups/m1 + if [ $? -eq 0 ]; then + tst_res TPASS "创建单个监控组成功" + else + tst_res TFAIL "创建单个监控组失败" + fi + + rmdir $mpam_dir/mon_groups/m1 + if [ $? -eq 0 ]; then + tst_res TPASS "删除单个监控组成功" + else + tst_res TFAIL "删除单个监控组失败" + 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_group_04.sh b/testcases/feature-test/mpam/mpam_group_04.sh new file mode 100755 index 00000000..11a10e68 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_group_04.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/01 +# 创建多个监控组并删除 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/mon_groups/m1 $mpam_dir/mon_groups/m2 $mpam_dir/mon_groups/m3 + if [ $? -eq 0 ]; then + tst_res TPASS "创建多个监控组成功" + else + tst_res TFAIL "创建多个监控组失败" + fi + + rmdir $mpam_dir/mon_groups/m1 $mpam_dir/mon_groups/m2 $mpam_dir/mon_groups/m3 + if [ $? -eq 0 ]; then + tst_res TPASS "删除多个监控组成功" + else + tst_res TFAIL "删除多个监控组失败" + 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_group_05.sh b/testcases/feature-test/mpam/mpam_group_05.sh new file mode 100755 index 00000000..fe35f039 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_group_05.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/02 +# 可创建最大资源组个数测试 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + res_group_num=`cat $mpam_dir/info/L3/num_closids` + + create_group_num=$(($res_group_num-1)) # 根分组占据一个closeid + + for i in $(seq 1 $create_group_num); do + mkdir $mpam_dir/p$i + if [ $? -ne 0 ]; then + tst_res TFAIL "创建资源组到最大数量失败" + tst_check_dmesg + tst_exit + fi + done + + tst_res TPASS "创建资源组到最大数量成功" + + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file diff --git a/testcases/feature-test/mpam/mpam_group_06.sh b/testcases/feature-test/mpam/mpam_group_06.sh new file mode 100755 index 00000000..d19c95d2 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_group_06.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/02 +# 可创建最大监控组个数测试 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + res_group_num=`cat $mpam_dir/info/L3/num_closids` + mon_group_num=`cat $mpam_dir/info/L3_MON/num_rmids` + + create_res_group_num=$(($res_group_num-1)) # 根分组占据一个closeid + create_mon_group_num=$(($mon_group_num/res_group_num-1)) # 资源组占据一个rmid + + for j in $(seq 1 $create_mon_group_num); do + mkdir $mpam_dir/mon_groups/m$j + if [ $? -ne 0 ]; then + tst_res TFAIL "创建监控组到最大数量失败" + tst_exit + fi + done + + for i in $(seq 1 $create_res_group_num); do + mkdir $mpam_dir/p$i + for j in $(seq 1 $create_mon_group_num); do + mkdir $mpam_dir/p$i/mon_groups/m$j + if [ $? -ne 0 ]; then + tst_res TINFO "$i $j" + tst_res TFAIL "创建监控组到最大数量失败" + tst_exit + fi + done + done + + tst_res TPASS "创建监控组到最大数量成功" + + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file -- 2.25.1

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

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

add memory bandwidth testcases for MPAM Signed-off-by: Wen Renjie <wenrenjie@huawei.com> --- testcases/feature-test/mpam/mpam_mb_01.sh | 32 ++++++++++++++++ testcases/feature-test/mpam/mpam_mb_02.sh | 32 ++++++++++++++++ testcases/feature-test/mpam/mpam_mb_03.sh | 30 +++++++++++++++ testcases/feature-test/mpam/mpam_mb_04.sh | 30 +++++++++++++++ testcases/feature-test/mpam/mpam_mb_05.sh | 46 +++++++++++++++++++++++ testcases/feature-test/mpam/mpam_mb_06.sh | 46 +++++++++++++++++++++++ testcases/feature-test/mpam/mpam_mb_07.sh | 46 +++++++++++++++++++++++ 7 files changed, 262 insertions(+) create mode 100755 testcases/feature-test/mpam/mpam_mb_01.sh create mode 100755 testcases/feature-test/mpam/mpam_mb_02.sh create mode 100755 testcases/feature-test/mpam/mpam_mb_03.sh create mode 100755 testcases/feature-test/mpam/mpam_mb_04.sh create mode 100755 testcases/feature-test/mpam/mpam_mb_05.sh create mode 100755 testcases/feature-test/mpam/mpam_mb_06.sh create mode 100755 testcases/feature-test/mpam/mpam_mb_07.sh diff --git a/testcases/feature-test/mpam/mpam_mb_01.sh b/testcases/feature-test/mpam/mpam_mb_01.sh new file mode 100755 index 00000000..ef976755 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_mb_01.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/08 +# 资源组下,schemata配置内存带宽全部域 MBPRI为最小值0 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p1 + + for ((i=0; i<$ENV_NUMA_NUM; i++)); do + echo "MBPRI:$i=0" > $mpam_dir/p1/schemata + grep -w MBPRI $mpam_dir/p1/schemata | grep -q "$i=`printf "%05d" 0`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组 MBPRI numa $i 配置为最小值成功" + else + tst_res TFAIL "资源组 MBPRI numa $i 配置为最小值失败" + 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_mb_02.sh b/testcases/feature-test/mpam/mpam_mb_02.sh new file mode 100755 index 00000000..74cad193 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_mb_02.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/08 +# 资源组下,schemata配置内存带宽全部域 MBPRI为最大值 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p1 + + for ((i=0; i<$ENV_NUMA_NUM; i++)); do + echo "MBPRI:$i=7" > $mpam_dir/p1/schemata + grep -w MBPRI $mpam_dir/p1/schemata | grep -q "$i=`printf "%05d" 7`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组 MBPRI numa $i 配置为最大值成功" + else + tst_res TFAIL "资源组 MBPRI numa $i 配置为最大值失败" + 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_mb_03.sh b/testcases/feature-test/mpam/mpam_mb_03.sh new file mode 100755 index 00000000..9068155f --- /dev/null +++ b/testcases/feature-test/mpam/mpam_mb_03.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/08 +# resctrl分组下,schemata配置内存带宽全部域 MBPRI为最小值0 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + for ((i=0; i<$ENV_NUMA_NUM; i++)); do + echo "MBPRI:$i=0" > $mpam_dir/schemata + grep -w MBPRI $mpam_dir/schemata | grep -q "$i=`printf "%05d" 0`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组 MBPRI numa $i 配置为最小值成功" + else + tst_res TFAIL "根分组 MBPRI numa $i 配置为最小值失败" + 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_mb_04.sh b/testcases/feature-test/mpam/mpam_mb_04.sh new file mode 100755 index 00000000..578d5ed5 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_mb_04.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/08 +# resctrl分组下,schemata配置内存带宽全部域 MBPRI为最大值 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + for ((i=0; i<$ENV_NUMA_NUM; i++)); do + echo "MBPRI:$i=7" > $mpam_dir/schemata + grep -w MBPRI $mpam_dir/schemata | grep -q "$i=`printf "%05d" 7`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组 MBPRI numa $i 配置为最大值成功" + else + tst_res TFAIL "根分组 MBPRI numa $i 配置为最大值失败" + 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_mb_05.sh b/testcases/feature-test/mpam/mpam_mb_05.sh new file mode 100755 index 00000000..4e40396e --- /dev/null +++ b/testcases/feature-test/mpam/mpam_mb_05.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/08 +# resctrl及资源组下,schemata配置MBMIN + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + for ((i=0; i<$ENV_NUMA_NUM; i++)); do + for j in $(seq 0 100); do + echo "MBMIN:$i=$j" > $mpam_dir/schemata + grep -w MBMIN $mpam_dir/schemata | grep -q "$i=`printf "%05d" $j`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组 MBMIN numa $i 配置为$j 成功" + else + tst_res TFAIL "根分组 MBMIN numa $i 配置为$j 失败" + fi + done + done + + mkdir $mpam_dir/p1 + + for ((i=0; i<$ENV_NUMA_NUM; i++)); do + for j in $(seq 0 100); do + echo "MBMIN:$i=$j" > $mpam_dir/p1/schemata + grep -w MBMIN $mpam_dir/p1/schemata | grep -q "$i=`printf "%05d" $j`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组 MBMIN numa $i 配置为$j 成功" + else + tst_res TFAIL "资源组 MBMIN numa $i 配置为$j 失败" + fi + done + 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_mb_06.sh b/testcases/feature-test/mpam/mpam_mb_06.sh new file mode 100755 index 00000000..7a54425d --- /dev/null +++ b/testcases/feature-test/mpam/mpam_mb_06.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/08 +# resctrl及资源组下,schemata配置MB + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + for ((i=0; i<$ENV_NUMA_NUM; i++)); do + for j in $(seq 0 100); do + echo "MB:$i=$j" > $mpam_dir/schemata + grep -w MB $mpam_dir/schemata | grep -q "$i=`printf "%05d" $j`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组 MB numa $i 配置为$j 成功" + else + tst_res TFAIL "根分组 MB numa $i 配置为$j 失败" + fi + done + done + + mkdir $mpam_dir/p1 + + for ((i=0; i<$ENV_NUMA_NUM; i++)); do + for j in $(seq 0 100); do + echo "MB:$i=$j" > $mpam_dir/p1/schemata + grep -w MB $mpam_dir/p1/schemata | grep -q "$i=`printf "%05d" $j`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组 MB numa $i 配置为$j 成功" + else + tst_res TFAIL "资源组 MB numa $i 配置为$j 失败" + fi + done + 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_mb_07.sh b/testcases/feature-test/mpam/mpam_mb_07.sh new file mode 100755 index 00000000..60decfa2 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_mb_07.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/08 +# resctrl及资源组下,schemata配置MBHDL + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + for ((i=0; i<$ENV_NUMA_NUM; i++)); do + for j in $(seq 0 1); do + echo "MBHDL:$i=$j" > $mpam_dir/schemata + grep -w MBHDL $mpam_dir/schemata | grep -q "$i=`printf "%05d" $j`" + if [ $? -eq 0 ]; then + tst_res TPASS "根分组 MBHDL numa $i 配置为$j 成功" + else + tst_res TFAIL "根分组 MBHDL numa $i 配置为$j 失败" + fi + done + done + + mkdir $mpam_dir/p1 + + for ((i=0; i<$ENV_NUMA_NUM; i++)); do + for j in $(seq 0 1); do + echo "MBHDL:$i=$j" > $mpam_dir/p1/schemata + grep -w MBHDL $mpam_dir/p1/schemata | grep -q "$i=`printf "%05d" $j`" + if [ $? -eq 0 ]; then + tst_res TPASS "资源组 MBHDL numa $i 配置为$j 成功" + else + tst_res TFAIL "资源组 MBHDL numa $i 配置为$j 失败" + fi + done + done + + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file -- 2.25.1

add resctrl system mount testcases for MPAM Signed-off-by: Wen Renjie <wenrenjie@huawei.com> --- testcases/feature-test/mpam/mpam_mount_01.sh | 24 +++++++++++++++ testcases/feature-test/mpam/mpam_mount_02.sh | 24 +++++++++++++++ testcases/feature-test/mpam/mpam_mount_03.sh | 25 +++++++++++++++ testcases/feature-test/mpam/mpam_mount_04.sh | 32 ++++++++++++++++++++ testcases/feature-test/mpam/mpam_mount_05.sh | 30 ++++++++++++++++++ 5 files changed, 135 insertions(+) create mode 100755 testcases/feature-test/mpam/mpam_mount_01.sh create mode 100755 testcases/feature-test/mpam/mpam_mount_02.sh create mode 100755 testcases/feature-test/mpam/mpam_mount_03.sh create mode 100755 testcases/feature-test/mpam/mpam_mount_04.sh create mode 100755 testcases/feature-test/mpam/mpam_mount_05.sh diff --git a/testcases/feature-test/mpam/mpam_mount_01.sh b/testcases/feature-test/mpam/mpam_mount_01.sh new file mode 100755 index 00000000..1acb6a84 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_mount_01.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/08/30 +# 挂载resctrl文件系统 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + if [ $? -eq 0 ]; then + tst_res TPASS "挂载resctrl文件系统成功" + else + tst_res TFAIL "挂载resctrl文件系统失败" + 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_mount_02.sh b/testcases/feature-test/mpam/mpam_mount_02.sh new file mode 100755 index 00000000..4637af37 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_mount_02.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/08/30 +# 解除挂载resctrl文件系统 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + umount $mpam_dir + if [ $? -eq 0 ]; then + tst_res TPASS "卸载resctrl文件系统成功" + else + tst_res TFAIL "卸载resctrl文件系统失败" + fi +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file diff --git a/testcases/feature-test/mpam/mpam_mount_03.sh b/testcases/feature-test/mpam/mpam_mount_03.sh new file mode 100755 index 00000000..93a7ed7b --- /dev/null +++ b/testcases/feature-test/mpam/mpam_mount_03.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/08/30 +# 解除挂载拥有子资源组的resctrl文件系统 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + mkdir $mpam_dir/p0 $mpam_dir/p1 $mpam_dir/p2 + umount $mpam_dir + if [ $? -eq 0 ]; then + tst_res TPASS "卸载拥有子资源组的resctrl文件系统成功" + else + tst_res TFAIL "卸载拥有子资源组的resctrl文件系统失败" + fi +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file diff --git a/testcases/feature-test/mpam/mpam_mount_04.sh b/testcases/feature-test/mpam/mpam_mount_04.sh new file mode 100755 index 00000000..e50190ed --- /dev/null +++ b/testcases/feature-test/mpam/mpam_mount_04.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/08/30 +# 解除挂载自定义分组文件系统 + +. mpam_lib.sh +tst_begin_test + +self_dir="/home/mpam_test_dir" + +fn_main(){ + mkdir -p $self_dir + mount -t resctrl resctrl $self_dir + if [ $? -eq 0 ]; then + tst_res TPASS "自定义目录挂载resctrl文件系统成功" + else + tst_res TFAIL "自定义目录挂载resctrl文件系统失败" + fi + umount $self_dir + if [ $? -eq 0 ]; then + tst_res TPASS "自定义目录卸载resctrl文件系统成功" + else + tst_res TFAIL "自定义目录卸载resctrl文件系统失败" + fi +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file diff --git a/testcases/feature-test/mpam/mpam_mount_05.sh b/testcases/feature-test/mpam/mpam_mount_05.sh new file mode 100755 index 00000000..b4469d4e --- /dev/null +++ b/testcases/feature-test/mpam/mpam_mount_05.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/08/30 +# 同时挂载多个根分组 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + if [ $? -eq 0 ]; then + tst_res TPASS "挂载resctrl文件系统成功" + else + tst_res TFAIL "挂载resctrl文件系统失败" + fi + mount -t resctrl resctrl $mpam_dir + if [ $? -eq 0 ]; then + tst_res TFAIL "再次挂载resctrl文件系统成功 (预期失败)" + else + tst_res TPASS "再次挂载resctrl文件系统失败 (预期失败)" + fi + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file -- 2.25.1

add pid and cpu relate testcases for MPAM Signed-off-by: Wen Renjie <wenrenjie@huawei.com> --- testcases/feature-test/mpam/mpam_relate_01.sh | 41 +++++++++++++ testcases/feature-test/mpam/mpam_relate_02.sh | 48 +++++++++++++++ testcases/feature-test/mpam/mpam_relate_03.sh | 42 +++++++++++++ testcases/feature-test/mpam/mpam_relate_04.sh | 52 ++++++++++++++++ testcases/feature-test/mpam/mpam_relate_05.sh | 40 +++++++++++++ testcases/feature-test/mpam/mpam_relate_06.sh | 40 +++++++++++++ testcases/feature-test/mpam/mpam_relate_07.sh | 39 ++++++++++++ testcases/feature-test/mpam/mpam_relate_08.sh | 40 +++++++++++++ testcases/feature-test/mpam/mpam_relate_09.sh | 59 +++++++++++++++++++ testcases/feature-test/mpam/mpam_relate_10.sh | 43 ++++++++++++++ testcases/feature-test/mpam/mpam_relate_11.sh | 43 ++++++++++++++ testcases/feature-test/mpam/mpam_relate_12.sh | 41 +++++++++++++ 12 files changed, 528 insertions(+) create mode 100755 testcases/feature-test/mpam/mpam_relate_01.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_02.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_03.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_04.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_05.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_06.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_07.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_08.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_09.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_10.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_11.sh create mode 100755 testcases/feature-test/mpam/mpam_relate_12.sh diff --git a/testcases/feature-test/mpam/mpam_relate_01.sh b/testcases/feature-test/mpam/mpam_relate_01.sh new file mode 100755 index 00000000..8f62b5f7 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_relate_01.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/03 +# 创建进程,挂载根分组,创建资源组后关联进程pid + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p0 + sleep 100 & + pid=$! + + grep -wq $pid $mpam_dir/tasks + if [ $? -eq 0 ]; then + tst_res TPASS "进程创建后pid显示在根分组内" + else + tst_res TFAIL "进程创建后pid未显示在根分组内" + fi + + echo $pid > $mpam_dir/p0/tasks + grep -wq $pid $mpam_dir/p0/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_relate_02.sh b/testcases/feature-test/mpam/mpam_relate_02.sh new file mode 100755 index 00000000..2b74425d --- /dev/null +++ b/testcases/feature-test/mpam/mpam_relate_02.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/03 +# 进程pid在资源组间的迁移 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p1 $mpam_dir/p2 + 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 + + echo $pid > $mpam_dir/p2/tasks + grep -wq $pid $mpam_dir/p1/tasks + if [ $? -ne 0 ]; then + tst_res TPASS "进程迁移后pid在原资源组移除" + else + tst_res TFAIL "进程迁移后pid未在原资源组移除" + fi + grep -wq $pid $mpam_dir/p2/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_relate_03.sh b/testcases/feature-test/mpam/mpam_relate_03.sh new file mode 100755 index 00000000..e8eafffa --- /dev/null +++ b/testcases/feature-test/mpam/mpam_relate_03.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/03 +# 创建单个资源组关联pid后,删除资源组 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p0 + sleep 100 & + pid=$! + + echo $pid > $mpam_dir/p0/tasks + + rmdir $mpam_dir/p0 + if [ $? -eq 0 ]; then + tst_res TPASS "资源组删除成功" + else + tst_res TFAIL "资源组删除删除" + fi + + grep -wq $pid $mpam_dir/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_relate_04.sh b/testcases/feature-test/mpam/mpam_relate_04.sh new file mode 100755 index 00000000..14b1f9f1 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_relate_04.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/03 +# 进程pid在监控组迁移测试 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p1 + mkdir $mpam_dir/p1/mon_groups/m1 $mpam_dir/p1/mon_groups/m2 + + sleep 100 & + pid=$! + + echo $pid > $mpam_dir/p1/tasks + + echo $pid > $mpam_dir/p1/mon_groups/m1/tasks + grep -wq $pid $mpam_dir/p1/mon_groups/m1/tasks + if [ $? -eq 0 ]; then + tst_res TPASS "监控组关联进程pid成功" + else + tst_res TFAIL "监控组关联进程pid失败" + fi + + echo $pid > $mpam_dir/p1/mon_groups/m2/tasks + grep -wq $pid $mpam_dir/p1/mon_groups/m1/tasks + if [ $? -ne 0 ]; then + tst_res TPASS "进程迁移后pid在原监控组移除" + else + tst_res TFAIL "进程迁移后pid未在原监控组移除" + fi + grep -wq $pid $mpam_dir/p1/mon_groups/m2/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_relate_05.sh b/testcases/feature-test/mpam/mpam_relate_05.sh new file mode 100755 index 00000000..13ccfd1d --- /dev/null +++ b/testcases/feature-test/mpam/mpam_relate_05.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/03 +# 挂载根分组,创建资源组p1关联单个vcpu + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p1 + + cpu="1" + cpu_last=$(($ENV_CPU_NUM-1)) + cpu_rest="0,2-$cpu_last" + + 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 + grep -wq $cpu_rest $mpam_dir/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_relate_06.sh b/testcases/feature-test/mpam/mpam_relate_06.sh new file mode 100755 index 00000000..6d329484 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_relate_06.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/03 +# 挂载根分组,创建资源组后关联多个连续的vcpu + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p1 + + cpu="1-3" + cpu_last=$(($ENV_CPU_NUM-1)) + cpu_rest="0,4-$cpu_last" + + 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 + grep -wq $cpu_rest $mpam_dir/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_relate_07.sh b/testcases/feature-test/mpam/mpam_relate_07.sh new file mode 100755 index 00000000..849f2e83 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_relate_07.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/03 +# vcpu在资源组间的迁移 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p1 $mpam_dir/p2 + + cpu="1" + echo $cpu > $mpam_dir/p1/cpus_list + + echo $cpu > $mpam_dir/p2/cpus_list + grep -wq $cpu $mpam_dir/p2/cpus_list + if [ $? -eq 0 ]; then + tst_res TPASS "cpu迁移到新的资源组成功" + else + tst_res TFAIL "cpu迁移到新的资源组失败" + fi + grep -wq $cpu $mpam_dir/p1/cpus_list + if [ $? -eq 0 ]; then + tst_res TFAIL "cpu在原资源组移除失败" + else + tst_res TPASS "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_relate_08.sh b/testcases/feature-test/mpam/mpam_relate_08.sh new file mode 100755 index 00000000..4612c4eb --- /dev/null +++ b/testcases/feature-test/mpam/mpam_relate_08.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/03 +# 挂载根分组,创建资源组后关联多个不连续的vcpu + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p1 + + cpu="1-3,5,10-15" + cpu_last=$(($ENV_CPU_NUM-1)) + cpu_rest="0,4,6-9,16-$cpu_last" + + 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 + grep -wq $cpu_rest $mpam_dir/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_relate_09.sh b/testcases/feature-test/mpam/mpam_relate_09.sh new file mode 100755 index 00000000..5bd791ab --- /dev/null +++ b/testcases/feature-test/mpam/mpam_relate_09.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. +# Author: wenrenjie@huawei.com +# Create: 2025/09/03 +# 资源组关联cpu后,cpu下线再上线测试 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p1 + + cpu="1" + cpu_last=$(($ENV_CPU_NUM-1)) + cpu_rest="0,2-$cpu_last" + cpu_full="0-$cpu_last" + + 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 + grep -wq $cpu_rest $mpam_dir/cpus_list + if [ $? -eq 0 ]; then + tst_res TPASS "cpu从根分组移除成功" + else + tst_res TFAIL "cpu从根分组移除失败" + fi + + echo 0 > /sys/devices/system/cpu/cpu$cpu/online + tst_res TINFO "cpu$cpu 下线" + grep -wq $cpu $mpam_dir/p1/cpus_list + if [ $? -ne 0 ]; then + tst_res TPASS "cpu从资源组移除成功" + else + tst_res TFAIL "cpu从资源组移除失败" + fi + + echo 1 > /sys/devices/system/cpu/cpu$cpu/online + tst_res TINFO "cpu$cpu 上线" + grep -wq $cpu_full $mpam_dir/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_relate_10.sh b/testcases/feature-test/mpam/mpam_relate_10.sh new file mode 100755 index 00000000..fc0a2495 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_relate_10.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/03 +# 创建监控组后,向监控组关联多个连续的vcpu + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p1 + mkdir $mpam_dir/p1/mon_groups/m1 + + cpu="1-3" + cpu_last=$(($ENV_CPU_NUM-1)) + cpu_rest="0,4-$cpu_last" + + echo $cpu > $mpam_dir/p1/cpus_list + + echo $cpu > $mpam_dir/p1/mon_groups/m1/cpus_list + grep -wq $cpu $mpam_dir/p1/mon_groups/m1/cpus_list + if [ $? -eq 0 ]; then + tst_res TPASS "监控组关联多个连续cpu成功" + else + tst_res TFAIL "监控组关联多个连续cpu失败" + fi + grep -wq $cpu_rest $mpam_dir/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_relate_11.sh b/testcases/feature-test/mpam/mpam_relate_11.sh new file mode 100755 index 00000000..ebef9c76 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_relate_11.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/03 +# 创建监控组后,向监控组关联多个不连续的vcpu + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p1 + mkdir $mpam_dir/p1/mon_groups/m1 + + cpu="1-3,5,10-15" + cpu_last=$(($ENV_CPU_NUM-1)) + cpu_rest="0,4,6-9,16-$cpu_last" + + echo $cpu > $mpam_dir/p1/cpus_list + + echo $cpu > $mpam_dir/p1/mon_groups/m1/cpus_list + grep -wq $cpu $mpam_dir/p1/mon_groups/m1/cpus_list + if [ $? -eq 0 ]; then + tst_res TPASS "监控组关联多个不连续cpu成功" + else + tst_res TFAIL "监控组关联多个不连续cpu失败" + fi + grep -wq $cpu_rest $mpam_dir/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_relate_12.sh b/testcases/feature-test/mpam/mpam_relate_12.sh new file mode 100755 index 00000000..60b39750 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_relate_12.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/03 +# vcpu在监控组迁移测试 + +. mpam_lib.sh +tst_begin_test + +fn_main(){ + mount -t resctrl resctrl $mpam_dir + + mkdir $mpam_dir/p1 + mkdir $mpam_dir/p1/mon_groups/m1 $mpam_dir/p1/mon_groups/m2 + + cpu="1" + echo $cpu > $mpam_dir/p1/cpus_list + echo $cpu > $mpam_dir/p1/mon_groups/m1/cpus_list + + echo $cpu > $mpam_dir/p1/mon_groups/m2/cpus_list + grep -wq $cpu $mpam_dir/p1/mon_groups/m2/cpus_list + if [ $? -eq 0 ]; then + tst_res TPASS "cpu迁移到新的监控组成功" + else + tst_res TFAIL "cpu迁移到新的监控组失败" + fi + grep -wq $cpu $mpam_dir/p1/mon_groups/m1/cpus_list + if [ $? -eq 0 ]; then + tst_res TFAIL "cpu在原资源组移除失败" + else + tst_res TPASS "cpu在原资源组移除成功" + fi + + umount $mpam_dir +} + +fn_main + +tst_check_dmesg +tst_exit \ No newline at end of file -- 2.25.1

add lib functions for MPAM Signed-off-by: Wen Renjie <wenrenjie@huawei.com> --- testcases/feature-test/mpam/mpam_lib.sh | 84 +++++++++ testcases/feature-test/mpam/tst_test.sh | 229 ++++++++++++++++++++++++ 2 files changed, 313 insertions(+) create mode 100644 testcases/feature-test/mpam/mpam_lib.sh create mode 100755 testcases/feature-test/mpam/tst_test.sh diff --git a/testcases/feature-test/mpam/mpam_lib.sh b/testcases/feature-test/mpam/mpam_lib.sh new file mode 100644 index 00000000..0904c925 --- /dev/null +++ b/testcases/feature-test/mpam/mpam_lib.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +. tst_test.sh +mpam_dir="/sys/fs/resctrl" + +# log file +LOG_MEMINFO="log_meminfo" + +ENV_L2_ID=() +ENV_L2_ID_NUM=0 +ENV_L3_ID=() +ENV_L3_ID_NUM=0 +ENV_NUMA_NUM=0 +ENV_CPU_NUM=0 + +RES_GROUP_MAX=31 # 32-1 +MON_GROUP_MAX=3 # 4-1 + +fn_get_env_l2_id(){ + local i found index list + + while read line; do + found=0 + for i in ${ENV_L2_ID[@]}; do + if [ "$i" == "$line" ]; then + found=1 + break + fi + done + if [ $found -eq 0 ]; then + ENV_L2_ID[${#ENV_L2_ID[@]}]=$line + fi + done < <(cat /sys/devices/system/cpu/cpu*/cache/index2/id) + + list=$(echo ${ENV_L2_ID[*]} | tr ' ' '\n' | sort -n) + + index=0 + for i in $list; do + ENV_L2_ID[$index]=$i + let index++ + done + + ENV_L2_ID_NUM=${#ENV_L2_ID[@]} +} + +fn_get_env_l3_id(){ + local i found index list + + while read line; do + found=0 + for i in ${ENV_L3_ID[@]}; do + if [ "$i" == "$line" ]; then + found=1 + break + fi + done + if [ $found -eq 0 ]; then + ENV_L3_ID[${#ENV_L3_ID[@]}]=$line + fi + done < <(cat /sys/devices/system/cpu/cpu*/cache/index3/id) + + list=$(echo ${ENV_L3_ID[*]} | tr ' ' '\n' | sort -n) + + index=0 + for i in $list; do + ENV_L3_ID[$index]=$i + let index++ + done + + ENV_L3_ID_NUM=${#ENV_L3_ID[@]} +} + +fn_get_env_numa_num(){ + ENV_NUMA_NUM=`lscpu | grep "NUMA node(s)" | awk '{print $3}'` +} + +fn_get_env_cpu_num(){ + ENV_CPU_NUM=`lscpu | grep "^CPU(s):" | awk '{print $2}'` +} + +fn_get_env_l2_id +fn_get_env_l3_id +fn_get_env_numa_num +fn_get_env_cpu_num \ No newline at end of file diff --git a/testcases/feature-test/mpam/tst_test.sh b/testcases/feature-test/mpam/tst_test.sh new file mode 100755 index 00000000..36cbc827 --- /dev/null +++ b/testcases/feature-test/mpam/tst_test.sh @@ -0,0 +1,229 @@ +#!/bin/bash +# +# This is a test library for shell. +# + +[ -n "$TST_LIB_LOADED" ] && return 0 + +export TST_PASS=0 +export TST_FAIL=0 +export TST_BROK=0 +export TST_WARN=0 +export TST_CONF=0 +export TST_COUNT=0 +export TST_COLOR_ENABLED=1 +export TST_LIB_LOADED=1 + +trap "tst_brk TBROK 'test interrupted'" INT + +tst_flag2color() +{ + local ansi_color_blue='\033[1;34m' + local ansi_color_green='\033[1;32m' + local ansi_color_magenta='\033[1;35m' + local ansi_color_red='\033[1;31m' + local ansi_color_yellow='\033[1;33m' + + case "$1" in + TPASS) printf $ansi_color_green;; + TFAIL) printf $ansi_color_red;; + TBROK) printf $ansi_color_red;; + TWARN) printf $ansi_color_magenta;; + TINFO) printf $ansi_color_blue;; + TCONF) printf $ansi_color_yellow;; + esac +} + +tst_color_enabled() +{ + [ $TST_COLOR_ENABLED -eq 1 ] && return 1 || return 0 +} + +tst_print_colored() +{ + tst_color_enabled + local color=$? + + [ "$color" = "1" ] && tst_flag2color "$1" + printf "$2" + [ "$color" = "1" ] && printf '\033[0m' +} + +tst_exit() +{ + local ret=0 + + if [ $TST_FAIL -gt 0 ]; then + ret=$((ret|1)) + fi + + if [ $TST_BROK -gt 0 ]; then + ret=$((ret|2)) + fi + + if [ $TST_WARN -gt 0 ]; then + ret=$((ret|4)) + fi + + if [ $TST_CONF -gt 0 ]; then + ret=$((ret|32)) + fi + + cat >&2 << EOF + +Summary: +passed $TST_PASS +failed $TST_FAIL +broken $TST_BROK +skipped $TST_CONF +warnings $TST_WARN +EOF + + exit $ret +} + +_tst_inc_res() +{ + case "$1" in + TPASS) TST_PASS=$((TST_PASS+1));; + TFAIL) TST_FAIL=$((TST_FAIL+1));; + TBROK) TST_BROK=$((TST_BROK+1));; + TWARN) TST_WARN=$((TST_WARN+1));; + TCONF) TST_CONF=$((TST_CONF+1));; + TINFO) ;; + *) tst_brk TBROK "Invalid res type '$1'";; + esac +} + +tst_res() +{ + local res=$1 + if type caller >/dev/null 2>&1;then + caller_info=$(caller 2) || + caller_info=$(caller 1) || + caller_info=$(caller 0) + + caller_info=$(echo "${caller_info}" | awk 'info=$NF":"$1 {print info}') + fi + + shift + + tst_color_enabled + local color=$? + + TST_COUNT=$(($TST_COUNT+1)) + + _tst_inc_res "$res" + printf "$(date) $TST_ID $TST_COUNT ${caller_info} " + tst_print_colored $res "$res: " + echo -e "$@" +} + +tst_brk() +{ + local res=$1 + shift + + tst_res "$res" "$@" + tst_exit +} + +tst_begin_test() +{ + if [ -w /dev/kmsg ]; then + export tst_date_time=`date +"%F %T%N"` + echo "run test at $tst_date_time" > /dev/kmsg + fi +} + +_dmesg_since_test_start() +{ + if which tac > /dev/null 2>&1; then + dmesg -T | tac | sed -ne "0,\#run test at $tst_date_time#p" | tac + else + dmesg -T >/dev/null 2>&1 && dmesg_cmd="dmesg -T" || dmesg_cmd="dmesg" + tac_cmd="awk '{ lines[NR] = \$0 } END { for (i = NR; i > 0; i--) print lines[i] }'" + eval "${dmesg_cmd} | ${tac_cmd} | sed -ne \"1,\#run test at ${tst_date_time}#p\" | ${tac_cmd}" + fi +} + +tst_check_dmesg_for() +{ + keywords=$@ + if [ -z "$keywords" ];then + tst_res TWARN "tst_check_dmesg_for parameter is null" + else + _dmesg_since_test_start | grep -E -q "$keywords" + fi +} + +_tst_expect_pass() +{ + local fnc="$1" + shift + + eval $@ + if [ $? -eq 0 ]; then + tst_res TPASS "$@ passed as expected" + return 0 + else + $fnc TFAIL "$@ failed unexpectedly" + return 1 + fi +} + +_tst_expect_fail() +{ + local fnc="$1" + shift + + eval $@ + if [ $? -ne 0 ]; then + tst_res TPASS "$@ failed as expected" + return 0 + else + $fnc TFAIL "$@ pass unexpectedly" + return 1 + fi +} + +tst_expect_pass() +{ + _tst_expect_pass tst_res "$@" +} + +tst_expect_fail() +{ + _tst_expect_fail tst_res "$@" +} + +# check dmesg log for WARNING/Oops/etc. +tst_check_dmesg() +{ + ret=$(_dmesg_since_test_start | grep -E -q \ + -e "kernel BUG at" \ + -e "WARNING:" \ + -e "BUG:" \ + -e "WARNING:" \ + -e "Oops:" \ + -e "possible recursive locking detected" \ + -e "Internal error" \ + -e "suspicious RCU usage" \ + -e "possible circular locking dependency detected" \ + -e "general protection fault" \ + -e "BUG.*remaining" \ + -e "UBSAN" \ + -e "KASAN" \ + -e "unregister_netdevice: waiting for" \ + -e "Call trace") + if [ $? -eq 0 ]; then + tst_res TWARN "_check_dmesg: something found in dmesg\n$(_dmesg_since_test_start)" + fi +} + +if [ -z "$TST_ID" ]; then + _tst_filename=$(basename $0) || \ + tst_brk TCONF "Failed to set TST_ID from \$0 ('$0')" + TST_ID=${_tst_filename%%.*} +fi +export TST_ID="$TST_ID" \ No newline at end of file -- 2.25.1
participants (1)
-
w00639456