1 , 重要的两个文件 action.pl data.pl
在文件action.pl中 定义自己要使用的action
在文件data.pl中定义 一条一条的case。
REQUITE 后面的action 必须执行成功,否则会导致整条case的失败。
RUN 直接跑一个action
ASSERT 做一个结果的check,如果是执行失败,返回一条case失败的警告
下面为一个例子
["case_mmcrfs", " - Verify mmcrfs with pool definition and nsd FG",
[
"REQUIRE check_descfile",
"REQUIRE check_fs_nonexist ##FSNAME##",
"RUN mmcrfs ##FSNAME## -F ##DESC_1## -T ##MOUNT_POINT## -r 3 -R 3 -m 3 -M 3 -v no",
"ASSERT check_rc != 0",
"ASSERT check_err_output contains \"If write affinity is enabled, the block allocation type must be cluster.\"",
"RUN mmcrfs ##FSNAME## -F ##DESC_7## -T ##MOUNT_POINT## -r 3 -R 3 -m 3 -M 3 -v no",
"ASSERT check_rc == 0",
"ASSERT check_output contains \"Completed creation of file system\"",
"RUN sleep 30",
"RUN mmdelfs ##FSNAME##",
"REQUIRE check_rc == 0",
"RUN sleep 30",
]],
["case_adddisk", " - Verify adddisk with pool definition and nsd FG",
[
"REQUIRE check_descfile",
"REQUIRE check_fs_exist ##FSNAME##",
"RUN mmdeldisk ##FSNAME## -F ##ADD_1##",
"ASSERT check_rc == 0",
"RUN mmadddisk ##FSNAME## -F ##ADD_1##",
"ASSERT check_rc == 0",
"ASSERT check_output contains \"Completed adding disks to file system\"",
"RUN mmadddisk ##FSNAME## -F ##ADD_9##",
"ASSERT check_rc != 0",
"ASSERT check_err_output contains \"mmadddisk: When write affinity is enabled for the storage pool,
disks that share the same NSD server must belong to the same failure group.\"",
"RUN mmadddisk ##FSNAME## -F ##DEL_FOR_ADD##",
"ASSERT check_rc == 0",
]],
["case_chdisk"," - Verify chdisk in FPO fs",
[
"REQUIRE check_descfile",
"REQUIRE check_fs_exist ##FSNAME##",
"RUN mmchdisk ##FSNAME## change -F ##CHDISK_1##",
"ASSERT check_rc != 0",
]],
@snc_mmchattr_command_cases = (
["case_mmchattr_FPO", " - Verify mmchattr --block-group-factor from 2 to 1024 and --write-affinity-depth from 1 to 2 for a file",
[
"REQUIRE check_fs_exist ##FSNAME##",
"REQUIRE confirmFSmounted ##FSNAME## ##MOUNT_POINT##",
"REQUIRE create_file ##FSNAME## ##MOUNT_POINT##",
"FOREACH FACTOR_VALUE in ##FACTOR_VALUE_LIST##",
"RUN mmchattr --block-group-factor ##FACTOR_VALUE## ##FILE_DIR##/snc_test_file",
"ASSERT check_rc == 0",
"RUN mmlsattr -L ##FILE_DIR##/snc_test_file",
"ASSERT check_output contains \"Block group factor: ##FACTOR_VALUE##\"",
"RUN sleep 30",
"ENDFOR",
建立自己的case 查看README的步骤
会建立在/test_root/目录下
EXCITE查看 自带的函数 在/script/action.pl