diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs01.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs01.sh new file mode 100644 index 0000000000000000000000000000000000000000..ae99e4ed3f0b4d08833a51d3663ae043a3526e89 --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs01.sh @@ -0,0 +1,92 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: enhancedf2fs01.sh +# +# Description: life mode, discard is greater than or equal to 512 block +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +source life_init.sh + +do_setup() +{ + +} + +do_test() +{ + local ret=0 + + tst_res TINFO "Start test enhancedf2fs01.sh." + cat /sys/kernel/debug/tracing/trace_pipe | grep issue_discard >> log01.txt & + mkdir /mnt/f2fs_mount/test1 + if [ $? -eq 0 ]; then + tst_res TINFO "Created test1 success." + else + tst_res TINFO "Created test1 failed." + ret=$(( $ret + 1 )) + fi + sleep 10 + local i=0 + while [ $i -lt 30 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/test1/image$i bs=8M count=1 + i=$(( $i + 1 )) + done + sleep 10 + rm -rf /mnt/f2fs_mount/test1/image*[1,3,5,7,9] + if [ $? -eq 0 ]; then + tst_res TINFO "Deleted success." + else + tst_res TINFO "Delete fail." + ret=$(( $ret + 1 )) + fi + + sleep 90 + kill %1 + + local blklen=$(cat log01.txt | awk 'NR == 1' | awk -F '0x' '{print$3}') + if [ $((16#$blklen)) -ge 512 ]; then + tst_res TINFO "Log printing success." + else + tst_res TINFO "Log printing fail." + ret=$(( $ret + 1 )) + fi + + if [ $ret -eq 0 ]; then + tst_res TPASS "discard is greater than or equal to 512 block pass." + else + tst_res TFAIL "discard is greater than or equal to 512 block failed!" + fi +} + +do_clean() +{ + rm -rf log01.txt +} + +do_setup +do_test +do_clean +tst_exit \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs02.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs02.sh new file mode 100644 index 0000000000000000000000000000000000000000..67bdb4a19358f82da85be15b260811fc1d0864df --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs02.sh @@ -0,0 +1,104 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: enhancedf2fs02.sh +# +# Description: life mode, discard is greater than or equal to 512 block +# IO Imperceptible +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +source life_init.sh + +do_setup() +{ + +} + +do_test() +{ + local ret=0 + + tst_res TINFO "Start test enhancedf2fs02.sh." + cat /sys/kernel/debug/tracing/trace_pipe | grep issue_discard >> log02.txt & + + sh run_fio.sh + if [ $? -eq 0 ]; then + tst_res TINFO "fio read success." + else + tst_res TINFO "fio read fail." + ret=$(( $ret + 1 )) + fi + + mkdir /mnt/f2fs_mount/test2 + if [ $? -eq 0 ]; then + tst_res TINFO "Creation test2 successfully." + else + tst_res TINFO "Creation tets2 failed." + ret=$(( $ret + 1 )) + fi + + local i=0 + while [ $i -lt 30 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/test2/image$i bs=8M count=1 + i=$(( $i + 1 )) + done + sleep 10 + rm -rf /mnt/f2fs_mount/test2/image*[1,3,5,7,9] + if [ $? -eq 0 ]; then + tst_res TINFO "Deleted successfully." + else + tst_res TINFO "Delete failed." + ret=$(( $ret + 1 )) + fi + + sleep 120 + kill %1 + + local blklen=$(cat log02.txt | awk 'NR == 1' | awk -F '0x' '{print$3}') + if [ $((16#$blklen)) -ge 512 ];then + tst_res TINFO "Log printing success." + else + tst_res TINFO "Log printing fail." + ret=$(( $ret + 1 )) + fi + + if [ $ret -eq 0 ];then + tst_res TPASS "life mode, discard is greater than or equal to 512 block \ + IO Imperceptible pass." + else + tst_res TFAIL "life mode, discard is greater than or equal to 512 block \ + IO Imperceptible failed!" + fi +} + +do_clean() +{ + rm -rf log02.txt +} + +do_setup +do_test +do_clean +tst_exit \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs03.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs03.sh new file mode 100644 index 0000000000000000000000000000000000000000..891442680aa028f40c76fe1fd26f13abeed98d87 --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs03.sh @@ -0,0 +1,96 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: enhancedf2fs03.sh +# +# Description: equilibrium mode, discard is greater than or equal to 16 block +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +source equilibrium_init.sh + +do_setup() +{ + +} + +do_test() +{ + local ret=0 + + tst_res TINFO "Start test enhancedf2fs03.sh." + + cat /sys/kernel/debug/tracing/trace_pipe | grep issue_discard >> log03.txt & + sleep 10 + mkdir /mnt/f2fs_mount/test3 + if [ $? -eq 0 ]; then + tst_res TINFO "Creation test3 success." + else + tst_res TINFO "Creation test3 fail." + ret=$(( $ret + 1 )) + fi + + local i=0 + while [ $i -lt 50 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/test3/image$i bs=512K count=1 + i=$(( $i + 1 )) + done + sleep 10 + rm -rf /mnt/f2fs_mount/test3/image*[1,3,5,7,9] + if [ $? -eq 0 ]; then + tst_res TINFO "Deleted success." + else + tst_res TINFO "Delete fail." + ret=$(( $ret + 1 )) + fi + + sleep 150 + kill %1 + + local blklen=$(cat log03.txt | awk 'NR == 1' | awk -F '0x' '{print$3}') + if [ $((16#$blklen)) -ge 16 ];then + tst_res TINFO "Log printing success." + else + tst_res TINFO "Log printing fail." + ret=$(( $ret + 1 )) + fi + + if [ $ret -eq 0 ];then + tst_res TPASS "equilibrium mode, discard is greater than or equal to \ + 16 block pass." + else + tst_res TFAIL "equilibrium mode, discard is greater than or equal to \ + 16 block failed!" + fi +} + +do_clean() +{ + rm -rf log03.txt +} + +do_setup +do_test +do_clean +tst_exit \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs04.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs04.sh new file mode 100644 index 0000000000000000000000000000000000000000..41db6bccbe372066541fe29f75671b390654a68a --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs04.sh @@ -0,0 +1,115 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: enhancedf2fs04.sh +# +# Description: equilibrium mode, discard is greater than or equal to 16 block +# IO Imperceptible +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +source equilibrium_init.sh + +do_setup() +{ + +} + +do_test() +{ + local ret=0 + + tst_res TINFO "Start test enhancedf2fs04.sh." + + cat /sys/kernel/debug/tracing/trace_pipe | grep issue_discard >> log04.txt & + sh run_fio.sh & + if [ $? -eq 0 ]; then + tst_res TINFO "fio read success." + else + tst_res TINFO "fio read fail." + ret=$(( $ret + 1 )) + fi + + sleep 30 + local first=$(wc -l log04.txt | awk -F ' ' '{print$1}') + sleep 300 + local second=$(wc -l log04.txt | awk -F ' ' '{print$1}') + sleep 60 + mkdir /mnt/f2fs_mount/test4 + if [ $? -eq 0 ]; then + tst_res TINFO "Created test4 successfully." + else + tst_res TINFO "Created test4 failed." + ret=$(( $ret + 1 )) + fi + + local i=0 + while [ $i -lt 50 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/test4/image$i bs=512k count=1 + i=$(( $i + 1 )) + done + rm -rf /mnt/f2fs_mount/test4/image*[1,3,5,7,9] + if [ $? -eq 0 ]; then + tst_res TINFO "Deleted successfully." + else + tst_res TINFO "Delete failed." + ret=$(( $ret + 1 )) + fi + + sleep 150 + kill %1 + + local blklen=$(cat log04.txt | awk 'NR == 1' | awk -F '0x' '{print$3}') + if [ $((16#$blklen)) -ge 16 ]; then + tst_res TINFO "Log printing success." + else + tst_res TINFO "Log printing fail." + ret=$(( $ret + 1 )) + fi + + if [ $(( $second - $first )) -eq 0 ]; then + tst_res TINFO "IO perception test success." + else + tst_res TINFO "IO perception test fail." + ret=$(( $ret + 1 )) + fi + + if [ $ret -eq 0 ];then + tst_res TPASS "equilibrium mode, discard is greater than or \ + equal to 16 block IO Imperceptible pass." + else + tst_res TFAIL "equilibrium mode, discard is greater than or \ + equal to 16 block IO Imperceptibl failed!" + fi +} + +do_clean() +{ + rm -rf log04.txt +} + +do_setup +do_test +do_clean +tst_exit \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs05.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs05.sh new file mode 100644 index 0000000000000000000000000000000000000000..12b1e19fdc315fa14137319bc530087fef7fa07a --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs05.sh @@ -0,0 +1,94 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: enhancedf2fs05.sh +# +# Description: performance mode, discard is greater than or equal to 1 block +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +source performance_init.sh + +do_setup() +{ + +} + +do_test() +{ + local ret=0 + + tst_res TINFO "Start test enhancedf2fs05.sh." + + cat /sys/kernel/debug/tracing/trace_pipe | grep issue_discard >> log05.txt & + mkdir /mnt/f2fs_mount/test5 + if [ $? -eq 0 ]; then + tst_res TINFO "Creation test5 successfully." + else + tst_res TINFO "Creation test5 failed." + ret=$(( $ret + 1 )) + fi + local i=0 + while [ $i -lt 200 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/test5/image$i bs=4k count=1 + i=$((i+1)) + done + sleep 10 + rm -rf /mnt/f2fs_mount/test5/image*[1,3,5,7,9] + if [ $? -eq 0 ]; then + tst_res TINFO "Delete successfully." + else + tst_res TINFO "Delete failed." + ret=$(( $ret + 1 )) + fi + + sleep 120 + kill %1 + + local blklen=$(cat log05.txt | awk 'NR == 1' | awk -F '0x' '{print$3}') + if [ $((16#$blklen)) -ge 1 ];then + tst_res TINFO "Log printing success." + else + tst_res TINFO "Log printing fail." + ret=$(( $ret + 1 )) + fi + + if [ $ret -eq 0 ];then + tst_res TPASS "performance mode, discard is greater than or equal to \ + 1 block pass." + else + tst_res TFAIL "performance mode, discard is greater than or equal to \ + 1 block failed!" + fi +} + +do_clean() +{ + rm -rf log05.txt +} + +do_setup +do_test +do_clean +tst_exit \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs06.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs06.sh new file mode 100644 index 0000000000000000000000000000000000000000..0e0e963c3708a99d7e23fc9098406020e7e6e3c8 --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs06.sh @@ -0,0 +1,114 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: enhancedf2fs06.sh +# +# Description: performance mode, discard is greater than or equal to 1 block +# IO Imperceptible +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +source performance_init.sh + +do_setup() +{ + +} + +do_test() +{ + local ret=0 + + tst_res TINFO "Start test enhancedf2fs06.sh." + + cat /sys/kernel/debug/tracing/trace_pipe | grep f2fs_issue_discard >> log06.txt & + sh run_fio.sh & + if [ $? -eq 0 ]; then + tst_res TINFO "fio read success." + else + tst_res TINFO "fio read fail." + ret=$(( $ret + 1 )) + fi + sleep 30 + local first=$(wc -l log06.txt | awk -F ' ' '{print$1}') + sleep 300 + local second=$(wc -l log06.txt | awk -F ' ' '{print$1}') + sleep 60 + mkdir /mnt/f2fs_mount/test6 + if [ $? -eq 0 ]; then + tst_res TINFO "Created test6 successfully." + else + tst_res TINFO "Created test6 failed." + ret=$(( $ret + 1 )) + fi + + local i=0 + while [ $i -lt 200 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/test6/image$i bs=4k count=1 + i=$(( $i + 1 )) + done + rm -rf /mnt/f2fs_mount/test6/image*[1,3,5,7,9] + if [ $? -eq 0 ]; then + tst_res TINFO "Deleted successfully." + else + tst_res TINFO "Delete failed." + ret=$(( $ret + 1 )) + fi + + sleep 150 + kill %1 + + local blklen=$(cat log06.txt | awk 'NR == 1' | awk -F '0x' '{print$3}') + if [ $((16#$blklen)) -ge 1 ];then + tst_res TINFO "Log printing success." + else + tst_res TINFO "Log printing fail." + ret=$(( $ret + 1 )) + fi + + if [ $(( $second - $first )) -lt 5 ]; then + tst_res TINFO "IO perception test success." + else + tst_res TINFO "IO perception test fail." + ret=$(( $ret + 1 )) + fi + + if [ $ret -eq 0 ];then + tst_res TPASS "performance mode, discard is greater than or equal \ + to 1 block IO Imperceptible pass." + else + tst_res TFAIL "performance mode, discard is greater than or equal \ + to 1 block IO Imperceptible!" + fi +} + +do_clean() +{ + rm -rf log06.txt +} + +do_setup +do_test +do_clean +tst_exit \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs07.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs07.sh new file mode 100644 index 0000000000000000000000000000000000000000..e9a1e93d590942c7bf95bc19478ab3756ce8bcd2 --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs07.sh @@ -0,0 +1,79 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: enhancedf2fs02.sh +# +# Description: Hierarchical SSR control interface +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +do_setup() +{ + +} + +do_test() +{ + local ret=0 + local ssr_path=/sys/fs/f2fs/loop1 + + tst_res TINFO "Start test enhancedf2fs07.sh." + + if [ $(cat $ssr_path/hc_enable) == '0' ]; then + tst_res TINFO "trace open success." + else + tst_res TINFO "trace open fail." + ret=$(( $ret + 1 )) + fi + + echo 1 > $ssr_path/hc_enable + if [ $? -eq 0 ]; then + tst_res TINFO " SSR interface setting success." + else + tst_res TINFO " SSR interface setting failed." + ret=$(( $ret + 1 )) + fi + + if [ $(cat $ssr_path/hc_enable) == '1' ]; then + tst_res TINFO "SSR interface is 1 success." + else + tst_res TINFO "SSR interface not is 1 fail." + ret=$(( $ret + 1 )) + fi + + if [ $ret -eq 0 ];then + tst_res TPASS "Hierarchical SSR control interface pass." + else + tst_res TFAIL "Hierarchical SSR control interface failed." + fi +} + +do_clean() +{ + +} + +do_setup +do_test +do_clean +tst_exit \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs08.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs08.sh new file mode 100644 index 0000000000000000000000000000000000000000..baeccf4763e2cbcda548f29392e51b43664b5141 --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs08.sh @@ -0,0 +1,119 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: ce_key_manage01.sh +# +# Description: Hierarchical SSR threshold configuration interface +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +do_setup() +{ + +} + +do_test() +{ + local ret=0 + local ssr_path=/sys/fs/f2fs/loop1 + + tst_res TINFO "Start test enhancedf2fs08.sh." + local result_out=$(cat $ssr_path/hc_hot_data_lower_limit) + if [ $result_out == '5242880' ];then + tst_res TINFO "hc_hot_data_lower_limit Value is $result_out success" + else + tst_res TINFO "hc_hot_data_lower_limit Value is $result_out fail" + ret=$(( $ret + 1 )) + fi + result_out=$(cat $ssr_path/hc_warm_data_lower_limit) + if [ $result_out == '5242880' ];then + tst_res TINFO "hc_warm_data_lower_limit Value is $result_out success" + else + tst_res TINFO "hc_warm_data_lower_limit Value is $result_out fail" + ret=$(( $ret + 1 )) + fi + result_out=$(cat $ssr_path/hc_hot_node_lower_limit) + if [ $result_out == '5242880' ];then + tst_res TINFO "hc_hot_node_lower_limit Value is $result_out success" + else + tst_res TINFO "hc_hot_node_lower_limit Value is $result_out fail" + ret=$(( $ret + 1 )) + fi + result_out=$(cat $ssr_path/hc_warm_node_lower_limit) + if [ $result_out == '5242880' ];then + tst_res TINFO "hc_warm_node_lower_limit Value is $result_out success" + else + tst_res TINFO "hc_warm_node_lower_limit Value is $result_out fail" + ret=$(( $ret + 1 )) + fi + + echo 6000000 > $ssr_path/hc_hot_data_lower_limit + echo 6000000 > $ssr_path/hc_warm_data_lower_limit + echo 6000000 > $ssr_path/hc_hot_node_lower_limit + echo 6000000 > $ssr_path/hc_warm_node_lower_limit + + result_out=$(cat $ssr_path/hc_hot_data_lower_limit) + if [ $result_out == '6000000' ];then + tst_res TINFO "hc_hot_data_lower_limit Value is $result_out success" + else + tst_res TINFO "hc_hot_data_lower_limit Value is $result_out fail" + ret=$(( $ret + 1 )) + fi + result_out=$(cat $ssr_path/hc_warm_data_lower_limit) + if [ $result_out == '6000000' ];then + tst_res TINFO "hc_warm_data_lower_limit Value is $result_out success" + else + tst_res TINFO "hc_warm_data_lower_limit Value is $result_out fail" + ret=$(( $ret + 1 )) + fi + result_out=$(cat $ssr_path/hc_hot_node_lower_limit) + if [ $result_out == '6000000' ];then + tst_res TINFO "hc_hot_node_lower_limit Value is $result_out success" + else + tst_res TINFO "hc_hot_node_lower_limit Value is $result_out fail" + ret=$(( $ret + 1 )) + fi + result_out=$(cat $ssr_path/hc_warm_node_lower_limit) + if [ $result_out == '6000000' ];then + tst_res TINFO "hc_warm_node_lower_limit Value is $result_out success" + else + tst_res TINFO "hc_warm_node_lower_limit Value is $result_out fail" + ret=ret=$(( $ret + 1 )) + fi + + if [ $ret -eq 0 ];then + tst_res TPASS "Hierarchical SSR threshold configuration interface pass" + else + tst_res TFAIL "Hierarchical SSR threshold configuration interface failed" + fi +} + +do_clean() +{ + +} + +do_setup +do_test +do_clean +tst_exit \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs09.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs09.sh new file mode 100644 index 0000000000000000000000000000000000000000..866596641a24dd69f7ddf5be5a0cf2a39cdca1df --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs09.sh @@ -0,0 +1,125 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: ce_key_manage01.sh +# +# Description: Hierarchical SSR waterline configuration interface +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +do_setup() +{ + +} + +do_test() +{ + local ret=0 + local ssr_path=/sys/fs/f2fs/loop1 + + tst_res TINFO "Start test enhancedf2fs09.sh." + local result_out=$(cat $ssr_path/hc_hot_data_waterline) + if [ $result_out == '80' ];then + tst_res TINFO "hc_hot_data_waterline Value is $result_out success." + else + tst_res TINFO "hc_hot_data_waterline Value is $result_out fail." + ret=$(( $ret + 1 )) + fi + + local result_out=$(cat $ssr_path/hc_warm_data_waterline) + if [ $result_out == '80' ];then + tst_res TINFO "hc_warm_data_waterline Value is $result_out success." + else + tst_res TINFO "hc_warm_data_waterline Value is $result_out fail." + ret=$(( $ret + 1 )) + fi + + local result_out=$(cat $ssr_path/hc_hot_node_waterline) + if [ $result_out == '80' ];then + tst_res TINFO "hc_hot_node_waterline Value is $result_out success." + else + tst_res TINFO "hc_hot_node_waterline Value is $result_out fail." + ret=$(( $ret + 1 )) + fi + + local result_out=$(cat $ssr_path/hc_warm_node_waterline) + if [ $result_out == '80' ];then + tst_res TINFO "hc_warm_node_waterline Value is $result_out success." + else + tst_res TINFO "hc_warm_node_waterline Value is $result_out fail." + ret=$(( $ret + 1 )) + fi + + echo 85 > $ssr_path/hc_hot_data_waterline + echo 85 > $ssr_path/hc_warm_data_waterline + echo 85 > $ssr_path/hc_hot_node_waterline + echo 85 > $ssr_path/hc_warm_node_waterline + + local result_out=$(cat $ssr_path/hc_hot_data_waterline) + if [ $result_out == '85' ];then + tst_res TINFO "hc_hot_data_waterline Value is $result_out success." + else + tst_res TINFO "hc_hot_data_waterline Value is $result_out fail." + ret=$(( $ret + 1 )) + fi + + local result_out=$(cat $ssr_path/hc_warm_data_waterline) + if [ $result_out == '85' ];then + tst_res TINFO "hc_warm_data_waterline Value is $result_out success." + else + tst_res TINFO "hc_warm_data_waterline Value is $result_out fail." + ret=$(( $ret + 1 )) + fi + + local result_out=$(cat $ssr_path/hc_hot_node_waterline) + if [ $result_out == '85' ];then + tst_res TINFO "hc_hot_node_waterline Value is $result_out success." + else + tst_res TINFO "hc_hot_node_waterline Value is $result_out fail." + ret=$(( $ret + 1 )) + fi + + local result_out=$(cat $ssr_path/hc_warm_node_waterline) + if [ $result_out == '85' ];then + tst_res TINFO "hc_warm_node_waterline Value is $result_out success." + else + tst_res TINFO "hc_warm_node_waterline Value is $result_out fail." + ret=$(( $ret + 1 )) + fi + + if [ $ret -eq 0 ];then + tst_res TPASS "Hierarchical SSR waterline configuration interface pass." + else + tst_res TFAIL "Hierarchical SSR waterline configuration interface failed." + fi +} + +do_clean() +{ + +} + +do_setup +do_test +do_clean +tst_exit \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs10.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs10.sh new file mode 100644 index 0000000000000000000000000000000000000000..f596fb29901e73a304c48589bdb9a8716cfa6445 --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs10.sh @@ -0,0 +1,101 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: ce_key_manage01.sh +# +# Description: The hierarchical SSR recovery function is enabled +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +do_setup() +{ + losetup -d /dev/block/loop1 + umount /mnt/f2fs_mount + mkfs.f2fs -d1 -t1 -O quota /data/image_f2fs + losetup /dev/block/loop1 /data/image_f2fs + mount -t f2fs /dev/block/loop1 /mnt/f2fs_mount/ +} + +do_test() +{ + local ret=0 + local _sys_path=/sys/kernel/debug/tracing + tst_res TINFO "Start test enhancedf2fs10.sh." + + local i=0 + while [ $i -lt 32 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/image$i bs=512M count=1 + i=$(( $i + 1 )) + done + sleep 10 + mkdir /mnt/f2fs_mount/test10 + local i=0 + while [ $i -lt 5120 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/test10/image$i bs=512k count=1 + i=$(( $i + 1 )) + done + rm -rf /mnt/f2fs_mount/test10/image*[1,3,5,7,9] + + echo 1 > /sys/fs/f2fs/loop1/hc_enable + echo 1 > $_sys_path/tracing_on + echo 1 > $_sys_path/events/f2fs/f2fs_grading_ssr_allocate/enable + + cat $_sys_path/trace_pipe | grep ssr > log10.txt & + + mkdir /mnt/f2fs_mount/test10/f2fs_grading_ssr_allocate + local i=0 + while [ $i -lt 200 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/test10/f2fs_grading_ssr_allocate/image$i bs=4k count=1 + i=$(($i + 1)) + done + rm -rf /mnt/f2fs_mount/test10/f2fs_grading_ssr_allocate/image*[1,3,5,7,9] + + sleep 90 + kill %1 + + if [ -s log10.txt ];then + tst_res TINFO "log10 is not empty." + else + tst_res TINFO "log10 empty." + ret=$(( $ret + 1 )) + fi + + if [ $ret -eq 0 ];then + tst_res TPASS "The hierarchical SSR recovery function is enabled pass." + else + tst_res TFAIL "The hierarchical SSR recovery function is enabled failed!" + fi +} + +do_clean() +{ + rm -rf log10.txt +} + +do_setup +do_test +do_clean +tst_exit \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs11.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs11.sh new file mode 100644 index 0000000000000000000000000000000000000000..71bb323450c98a81dfcc4d785d01878997cd298f --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs11.sh @@ -0,0 +1,100 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: enhancedf2fs11.sh +# +# Description: Hierarchical SSR recycling is disabled +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +do_setup() +{ + losetup -d /dev/block/loop1 + umount /mnt/f2fs_mount + mkfs.f2fs -d1 -t1 -O quota /data/image_f2fs + losetup /dev/block/loop1 /data/image_f2fs + mount -t f2fs /dev/block/loop1 /mnt/f2fs_mount/ +} + +do_test() +{ + local ret=0 + local _sys_path=/sys/kernel/debug/tracing + + tst_res TINFO "Start test enhancedf2fs11.sh." + local i=0 + while [ $i -lt 32 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/image$i bs=512M count=1 + i=$(( $i+ 1 )) + done + + mkdir /mnt/f2fs_mount/test11 + local i=0 + while [ $i -lt 5120 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/test11/image$i bs=512k count=1 + i=$(( $i + 1 )) + done + rm -rf /mnt/f2fs_mount/test11/image*[1,3,5,7,9] + + echo 0 > /sys/fs/f2fs/loop1/hc_enable + echo 1 > $_sys_path/tracing_on + echo 1 > $_sys_path/events/f2fs/f2fs_grading_ssr_allocate/enable + + cat $trace_path/trace_pipe | grep f2fs_grading_ssr_allocate > log11.txt & + mkdir /mnt/f2fs_mount/test11/f2fs_grading_ssr_allocate + local i=0 + while [ $i -lt 200 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/test11/f2fs_grading_ssr_allocate/image$i bs=4k count=1 + i=$(( $i + 1 )) + done + rm -rf /mnt/f2fs_mount/test11/f2fs_grading_ssr_allocate/image*[1,3,5,7,9] + + sleep 90 + kill %1 + + if [ -s log11.txt ];then + tst_res TINFO "log11.txt is not empty." + ret=$(( $ret + 1 )) + else + tst_res TINFO "log11.txt empty." + fi + + if [ $ret -eq 0 ];then + tst_res TPASS "Hierarchical SSR recycling is disabled pass." + else + tst_res TFAIL "Hierarchical SSR recycling is disabled failed!" + fi +} + +do_clean() +{ + rm -rf log11.txt +} + +do_setup +do_test +do_clean +tst_exit \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs12.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs12.sh new file mode 100644 index 0000000000000000000000000000000000000000..81367547c0c0f439822344d4226ff0ee70233754 --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs12.sh @@ -0,0 +1,80 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: enhanced12.sh +# +# Description: GC function test +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +do_setup() +{ + +} + +do_test() +{ + local ret=0 + local _trace_path=/sys/kernel/debug/tracing + + tst_res TINFO "Start test enhancedf2fs12.sh." + + echo 1 > $_trace_path/tracing_on + echo 1 > $_trace_path/events/f2fs/f2fs_background_gc/enable + + cat $_trace_path/trace_pipe | grep f2fs_background_gc > log12.txt & + local i=0 + while [ $i -lt 512 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/image$i bs=1M count=1 + i=$(( $i + 1 )) + done + rm -rf /mnt/f2fs_mount/image*[1,3,5,7,9] + + echo 1 > /sys/fs/f2fs/loop1/gc_urgent + + sleep 90 + kill %1 + + if [ -s log12.txt ];then + tst_res TINFO "log is not empty." + else + tst_res TINFO "log empty." + ret=$(( $ret + 1 )) + fi + if [ $ret -eq 0 ];then + tst_res TPASS "GC function test pass." + else + tst_res TFAIL "GC function test failed!" + fi +} + +do_clean() +{ + rm -rf log12.txt +} + +do_setup +do_test +do_clean +tst_exit diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs13.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs13.sh new file mode 100644 index 0000000000000000000000000000000000000000..7833996d3c7f619c894869e3e58ef5a5b191fbee --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/enhancedf2fs13.sh @@ -0,0 +1,90 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: enhancedf2fs01.sh +# +# Description: GC function IO perception test +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +do_setup() +{ + +} + +do_test() +{ + local ret=0 + local _trace_path=/sys/kernel/debug/tracing + + tst_res TINFO "Start test enhancedf2fs13.sh." + + echo 1 > _$trace_path/tracing_on + echo 1 > _$trace_path/events/f2fs/f2fs_background_gc/enable + + cat $_trace_path/trace_pipe | grep f2fs_background_gc >> log13.txt & + local first=$(wc -l log13.txt | awk -F ' ' '{print$1}') + sh run_fio.sh & + if [ $? -eq 0 ]; then + tst_res TINFO "fio read success." + else + tst_res TINFO "fio read fail." + ret=$(( $ret + 1 )) + fi + + local second=$(wc -l log13.txt | awk -F ' ' '{print$1}') + local i=0 + while [ $i -lt 512 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/image$i bs=1M count=1 + i=$(( $i + 1 )) + done + rm -rf /mnt/f2fs_mount/image*[1,3,5,7,9] + + echo 1 > /sys/fs/f2fs/loop1/gc_urgent + sleep 60 + kill %1 + + if [ $(( $second - $first )) -lt 5 ] && [ -s log13.txt ]; then + tst_res TINFO "IO perception test success." + else + tst_res TINFO "IO perception test fail." + ret=$(( $ret + 1 )) + fi + + if [ $ret -eq 0 ];then + tst_res TPASS "GC function IO perception test pass." + else + tst_res TFAIL "GC function IO perception test failed!" + fi +} + +do_clean() +{ + rm -rf log13.txt +} + +do_setup +do_test +do_clean +tst_exit \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/equilibrium_init.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/equilibrium_init.sh new file mode 100644 index 0000000000000000000000000000000000000000..9111e5295336c26befc2bcf87b7fa4137b12cfa5 --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/equilibrium_init.sh @@ -0,0 +1,84 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: equilibrium_init.sh +# +# Description: enhancedf2fs03 and enhancedf2fs04 testsuite init script +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: Mar 15 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +equilibrium_init() +{ + local ret=0 + local segs_path=/sys/kernel/debug/f2fs/status + + tst_res TINFO "Start equilibrium_init.sh." + local a=$(cat $segs_path | grep segs | awk -F ' ' '{print$3}') + + local i=0 + while [ $i -lt 32 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/image$i bs=512M count=1 + i=$(( $i + 1 )) + done + + local b=$(cat $segs_path | grep "valid blocks" | awk -F ' ' '{print$3}' | tr -cd "[0-9]") + result_left=`echo | awk "{peint $a*512*0.2}"` + result_might=`echo | awk "{print $a*512-$b}"` + result_right=`echo | awk "{print $a*512*0.1}"` + result1=`echo "$result_left $result_might" \ + | awk '{if ($result_left -gt $result_might) print 1; else print 0}'` + result2=`echo "$result_might $result_right" \ + | awk '{if ($result_might -gt $result_right) print 1; else print 0}'` + if [ $result1 ] && [ $result2 ];then + tst_res TINFO "Inequality holds." + else + tst_res TINFO "Inequality does not hold." + ret=$(( $ret + 1 )) + fi + + sleep 30 + if [ $(cat /sys/fs/f2fs/loop1/discard_type) == '1' ];then + tst_res TINFO "equilibrium model success." + else + tst_res TINFO "equilibrium model fail." + ret=$(( $ret + 1 )) + fi + + echo 1 > /sys/kernel/debug/tracing/tracing_on + echo 1 > /sys/kernel/debug/tracing/events/f2fs/f2fs_issue_discard/enable + if [ $? -eq 0 ]; then + tst_res TINFO "Trace opened success." + else + tst_res TINFO "Trace start fail." + ret=$(( $ret + 1 )) + fi + + if [ $ret -eq 0 ];then + tst_res TPASS "equilibrium_init success." + else + tst_res TFAIL "equilibrium_init fail!" + fi +} + +equilibrium_init \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/life_init.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/life_init.sh new file mode 100644 index 0000000000000000000000000000000000000000..7c5189bd255f4f73815ff9c8ce0667e8ee2f06ce --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/life_init.sh @@ -0,0 +1,73 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: life_init.sh +# +# Description: enhancedf2fs01 and enhancedf2fs02 testsuite init script +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +life_init() +{ + local ret=0 + local _segs_path=/sys/kernel/debug/f2fs/status + local _sys_path=/sys/kernel/debug/tracing + + tst_res TINFO "Start life_init.sh." + + local a=$(cat $segs_path | grep segs | awk -F ' ' '{print$3}') + local b=$(cat $segs_path| grep "valid blocks" | awk -F ' ' '{print$3}' | tr -cd "[0-9]") + local result_left=`echo | awk "{print $a*512-$b}"` + local result_right=`echo | awk "{print $a*512*0.2}"` + local result=`echo "$result_left $result_right" \ + | awk '{if ($result_left -gt $result_right) print 1; else print 0}'` + if [ $result ];then + tst_res TINFO "Inequality holds." + else + tst_res TINFO "Inequality does not hold." + ret=$(( $ret + 1 )) + fi + + if [ $(cat /sys/fs/f2fs/loop1/discard_type) == '0' ];then + tst_res TINFO "life model success." + else + tst_res TINFO "life model fail." + ret=$(( $ret + 1 )) + fi + + echo 1 > $_sys_path/tracing_on + echo 1 > $_sys_path/events/f2fs/f2fs_issue_discard/enable + if [ $? -eq 0 ];then + tst_res TINFO "Trace opened successfully." + else + tst_res TINFO "Trace start failed." + ret=$(( $ret + 1 )) + fi + if [ $ret -eq 0 ];then + tst_res TPASS "life_init success." + else + tst_res TFAIL "life_init fail!" + fi +} + +life_init diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/performance_init.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/performance_init.sh new file mode 100644 index 0000000000000000000000000000000000000000..0efb67679540813a114f7b68b195d6fbc1943cbf --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/performance_init.sh @@ -0,0 +1,77 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: performance_init.sh +# +# Description: enhancedf2fs05 and enhancedf2fs06 testsuite init script +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +source tst_oh.sh + +performance_init() +{ + local ret=0 + local segs_path=/sys/kernel/debug/f2fs/status + + tst_res TINFO "Start performance_init.sh." + local a=$(cat $segs_path | grep segs | awk -F ' ' '{print$3}') + local i=0 + while [ $i -lt 37 ] + do + dd if=/dev/zero of=/mnt/f2fs_mount/image$i bs=512M count=1 + i=$(( $i + 1 )) + done + local b=$(cat $segs_path | grep "valid blocks" | awk -F ' ' '{print$3}' | tr -cd "[0-9]") + local result_left=`echo | awk "{print $a*512-$b}"` + local result_right=`echo | awk "{print $a*512*0.1}"` + local result=`echo "$result_left $result_right" \ + | awk '{if ($result_left -lt $result_right) print 1; else print 0}'` + if [ $result ];then + tst_res TINFO "Inequality holds." + else + tst_res TINFO "Inequality does not hold." + ret=$(( $ret + 1 )) + fi + sleep 30 + if [ $(cat /sys/fs/f2fs/loop1/discard_type) == '2' ];then + tst_res TINFO "performance model success." + else + tst_res TINFO "performance model fail." + ret=$(( $ret + 1 )) + fi + echo 1 > /sys/kernel/debug/tracing/tracing_on + echo 1 > /sys/kernel/debug/tracing/events/f2fs/f2fs_issue_discard/enable + if [ $? -eq 0 ]; then + tst_res TINFO "Trace opened successfully." + else + tst_res TINFO "Trace start failed." + ret=$(( $ret + 1 )) + fi + + if [ $ret -eq 0 ];then + tst_res TPASS "performance_init success." + else + tst_res TFAIL "performance_init fail!" + fi +} + +performance_init diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/run_fio.sh b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/run_fio.sh new file mode 100644 index 0000000000000000000000000000000000000000..23730e516dbfaa316f6e00dfe251eed568dfaebb --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t/testcases/bin/run_fio.sh @@ -0,0 +1,35 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: run_fio.sh +# +# Description: run the fio +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +run_fio() +{ + ./fio --name=rw_bg --numjobs=1 --filename=/mnt/f2fs_mount/fio-test.file \ + --bs=32768K --rw=read --ioengine=psync --refill_buffers --group_reporting \ + --runtime=360 --time_based --filesize=128M +} + +run_fio \ No newline at end of file diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t_init.sh b/test/moduletest/runtest/bin/enhancedf2fs_t_init.sh new file mode 100644 index 0000000000000000000000000000000000000000..d08a94a88f2046a31205d2faef0c2905a7ae8ba3 --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t_init.sh @@ -0,0 +1,44 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: enhancedf2fs01.sh +# +# Description: enhancedf2fs_t testsuite init script +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +create_catalogue() +{ + mkdir /mnt/f2fs_mount/ +} + +enable_init() +{ + dd if=/dev/zero of=/data/image_f2fs bs=1M count=20480 + mkfs.f2fs -d1 -t1 -O quota /data/image_f2fs + losetup /dev/block/loop1 /data/image_f2fs + mount -t f2fs /dev/block/loop1 /mnt/f2fs_mount/ +} + +echo "***************************ENHANCED INIT START***************************" +create_catalogue +enable_init +echo "***************************ENHANCED INIT END*****************************" diff --git a/test/moduletest/runtest/bin/enhancedf2fs_t_uninit.sh b/test/moduletest/runtest/bin/enhancedf2fs_t_uninit.sh new file mode 100644 index 0000000000000000000000000000000000000000..9eb3275b824f5c1f99c1cdaf7820ca8dbfc7f52b --- /dev/null +++ b/test/moduletest/runtest/bin/enhancedf2fs_t_uninit.sh @@ -0,0 +1,42 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +# File: enhancedf2fs_t_uninit.sh +# +# Description: enhancedf2fs_t testsuite uninit script +# +# Authors: Li Zhanming - lizhanming3@h-partners.com +# +# History: April 8 2022 - init scripts +# +################################################################################ + +enable_uninit() +{ + losetup -d /dev/block/loop1 + umount /mnt/f2fs_mount +} + +delete_catalogue() +{ + rm -rf /mnt/f2fs_mount/ +} + +echo "***************************enhanced UNINIT START**************************" +enable_uninit +delete_catalogue +echo "***************************enhanced UNINIT END****************************"