kernel_linux_build: Add enhancedf2fs_t test suite

Signed-off-by: li-zhanming <lizhanming3@huawei.com>
This commit is contained in:
li-zhanming
2022-05-12 20:30:10 +08:00
parent e69902c692
commit 061c7cdf4f
18 changed files with 1376 additions and 0 deletions
@@ -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 discard size >= 512 blocks in life mode."
cat /sys/kernel/debug/tracing/trace_pipe | grep issue_discard >> log01.txt &
mkdir /mnt/f2fs_mount/test1
if [ $? -eq 0 ]; then
tst_res TPASS "Created test1 dir successfully."
else
tst_res TFAIL "Created test1 dir failed."
ret=$(( $ret + 1 ))
fi
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
rm -rf /mnt/f2fs_mount/test1/image*[1,3,5,7,9]
if [ $? -eq 0 ]; then
tst_res TPASS "Deleted successfully."
else
tst_res TFAIL "Deleted fail."
ret=$(( $ret + 1 ))
fi
sleep 240
kill %1
local blklen=$(cat log01.txt | awk 'NR == 1' | awk -F '0x' '{print$3}')
if [ $((16#$blklen)) -ge 512 ]; then
tst_res TPASS "blklen >= 512 successfully."
else
tst_res TFAIL "blklen >= 512 failed."
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
losetup -d /dev/block/loop1
umount /mnt/f2fs_mount
}
do_setup
do_test
do_clean
tst_exit
@@ -0,0 +1,118 @@
#!/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 discard size >= 512 blocks in life mode,IO imperceptible."
cat /sys/kernel/debug/tracing/trace_pipe | grep issue_discard >> log02.txt &
sh run_fio.sh > run_fio.txt &
sleep 60
mkdir /mnt/f2fs_mount/test2
if [ $? -eq 0 ]; then
tst_res TPASS "Created test2 dir successfully."
else
tst_res TFAIL "Created tets2 dir 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
rm -rf /mnt/f2fs_mount/test2/image*[1,3,5,7,9]
if [ $? -eq 0 ]; then
tst_res TPASS "Deleted successfully."
else
tst_res TFAIL "Deleted failed."
ret=$(( $ret + 1 ))
fi
local first=$(wc -l log02.txt | awk -F ' ' '{print$1}')
sleep 240
local second=$(wc -l log02.txt | awk -F ' ' '{print$1}')
sleep 90
kill %1
local err=$(cat run_fio.txt | grep err | awk -F ':' '{print$3}' | tr -cd "[0-9]")
if [ $err -eq 0 ]; then
tst_res TPASS "fio read successfully."
else
tst_res TFAIL "fio read failed."
ret=$(( $ret + 1 ))
fi
local blklen=$(cat log02.txt | awk 'NR == 1' | awk -F '0x' '{print$3}')
if [ $((16#$blklen)) -ge 512 ]; then
tst_res TPASS "blklen >= 512 successfully."
else
tst_res TFAIL "blklen >= 512 failed."
ret=$(( $ret + 1 ))
fi
if [ $(( $second - $first )) -gt 0 ]; then
tst_res TPASS "IO perception test successfully."
else
tst_res TFAIL "IO perception test failed."
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
losetup -d /dev/block/loop1
umount /mnt/f2fs_mount
}
do_setup
do_test
do_clean
tst_exit
@@ -0,0 +1,97 @@
#!/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 discard size >= 16 blocks in equilibrium mode."
cat /sys/kernel/debug/tracing/trace_pipe | grep issue_discard >> log03.txt &
sleep 60
mkdir /mnt/f2fs_mount/test3
if [ $? -eq 0 ]; then
tst_res TPASS "Creation test3 dir successfully."
else
tst_res TFAIL "Creation test3 dir 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
rm -rf /mnt/f2fs_mount/test3/image*[1,3,5,7,9]
if [ $? -eq 0 ]; then
tst_res TPASS "Deleted successfully."
else
tst_res TFAIL "Deleted fail."
ret=$(( $ret + 1 ))
fi
sleep 90
kill %1
local blklen=$(cat log03.txt | awk 'NR == 1' | awk -F '0x' '{print$3}')
if [ $((16#$blklen)) -ge 16 ];then
tst_res TPASS "blklen >= 16 successfully."
else
tst_res TFAIL "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
losetup -d /dev/block/loop1
umount /mnt/f2fs_mount
}
do_setup
do_test
do_clean
tst_exit
@@ -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 discard size >= 1 block in performance mode."
cat /sys/kernel/debug/tracing/trace_pipe | grep issue_discard >> log05.txt &
mkdir /mnt/f2fs_mount/test5
if [ $? -eq 0 ]; then
tst_res TPASS "Creation test5 dir successfully."
else
tst_res TFAIL "Creation test5 dir 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
rm -rf /mnt/f2fs_mount/test5/image*[1,3,5,7,9]
if [ $? -eq 0 ]; then
tst_res TPASS "Delete successfully."
else
tst_res TFAIL "Delete failed."
ret=$(( $ret + 1 ))
fi
sleep 90
kill %1
local blklen=$(cat log05.txt | awk 'NR == 1' | awk -F '0x' '{print$3}')
if [ $((16#$blklen)) -ge 1 ];then
tst_res TPASS "Log printing successfully."
else
tst_res TFAIL "Log printing failed."
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
losetup -d /dev/block/loop1
umount /mnt/f2fs_mount
}
do_setup
do_test
do_clean
tst_exit
@@ -0,0 +1,70 @@
#!/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: enhancedf2fs07.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()
{
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
_ssr_path=/sys/fs/f2fs/loop1
tst_res TINFO "Start test hierarchical SSR control interface."
if [ $(cat $_ssr_path/hc_enable) == '0' ]; then
tst_res TPASS "default is 0 successfully."
else
tst_res TFAIL "default not is 0 failed."
ret=$(( $ret + 1 ))
fi
temp=$(cat $_ssr_path/hc_enable)
echo 1 > $_ssr_path/hc_enable
if [ $(cat $_ssr_path/hc_enable) == '1' ] && [ $ret -eq 0 ]; then
tst_res TPASS "Hierarchical SSR control interface setting pass."
else
tst_res TFAIL "Hierarchical SSR control interface setting failed!"
fi
}
do_clean()
{
echo $temp > $_ssr_path/hc_enable
losetup -d /dev/block/loop1
umount /mnt/f2fs_mount
}
do_setup
do_test
do_clean
tst_exit
@@ -0,0 +1,106 @@
#!/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: enhancedf2fs08.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()
{
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()
{
ret=0
_ssr_path=/sys/fs/f2fs/loop1
tst_res TINFO "Start test hierarchical SSR threshold configuration interface."
init_value1=$(cat $_ssr_path/hc_hot_data_lower_limit)
init_value2=$(cat $_ssr_path/hc_warm_data_lower_limit)
init_value3=$(cat $_ssr_path/hc_hot_node_lower_limit)
init_value4=$(cat $_ssr_path/hc_warm_node_lower_limit)
confirm_value hc_hot_data_lower_limit
confirm_value hc_warm_data_lower_limit
confirm_value hc_hot_node_lower_limit
confirm_value hc_warm_node_lower_limit
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
confirm_change_value hc_hot_data_lower_limit
confirm_change_value hc_warm_data_lower_limit
confirm_change_value hc_hot_node_lower_limit
confirm_change_value hc_warm_node_lower_limit
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
}
confirm_value()
{
local result_out1=$(cat /sys/fs/f2fs/loop1/$1)
if [ $result_out1 == '5242880' ]; then
tst_res TPASS "$1 Value is 5242880 successfully."
else
tst_res TFAIL "$1 Value is 5242880 failed."
ret=$(( $ret + 1 ))
fi
}
confirm_change_value()
{
local result_out2=$(cat /sys/fs/f2fs/loop1/$1)
if [ $result_out2 == '6000000' ]; then
tst_res TPASS "$1 Value is 6000000 successfully."
else
tst_res TFAIL "$1 Value is 6000000 failed."
ret=$(( $ret + 1 ))
fi
}
do_clean()
{
echo $init_value1 > $_ssr_path/hc_hot_data_lower_limit
echo $init_value2 > $_ssr_path/hc_warm_data_lower_limit
echo $init_value3 > $_ssr_path/hc_hot_node_lower_limit
echo $init_value4 > $_ssr_path/hc_warm_node_lower_limit
losetup -d /dev/block/loop1
umount /mnt/f2fs_mount
}
do_setup
do_test
do_clean
tst_exit
@@ -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: enhancedf2fs09.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()
{
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()
{
ret=0
_ssr_path=/sys/fs/f2fs/loop1
tst_res TINFO "Start test hierarchical SSR waterline configuration interface."
init_value1=$(cat $_ssr_path/hc_hot_data_waterline)
init_value2=$(cat $_ssr_path/hc_warm_data_waterline)
init_value3=$(cat $_ssr_path/hc_hot_node_waterline)
init_value4=$(cat $_ssr_path/hc_warm_node_waterline)
confirm_value hc_hot_data_waterline
confirm_value hc_warm_data_waterline
confirm_value hc_hot_node_waterline
confirm_value hc_warm_node_waterline
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
confirm_change_value hc_hot_data_waterline
confirm_change_value hc_warm_data_waterline
confirm_change_value hc_hot_data_waterline
confirm_change_value hc_warm_node_waterline
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
}
confirm_value()
{
if [ $(cat $_ssr_path/$1) == '80' ];then
tst_res TPASS "$1 Value is 80 successfully."
else
tst_res TFAIL "$1 Value not is 80 failed."
ret=$(( $ret + 1 ))
fi
}
confirm_change_value()
{
if [ $(cat $_ssr_path/$1) == '85' ];then
tst_res TPASS "$1 Value is 85 successfully."
else
tst_res TFAIL "$1 Value not is 85 failed."
ret=$(( $ret + 1 ))
fi
}
do_clean()
{
echo $init_value1 > $_ssr_path/hc_hot_data_waterline
echo $init_value2 > $_ssr_path/hc_warm_data_waterline
echo $init_value3 > $_ssr_path/hc_hot_node_waterline
echo $init_value4 > $_ssr_path/hc_warm_node_waterline
losetup -d /dev/block/loop1
umount /mnt/f2fs_mount
}
do_setup
do_test
do_clean
tst_exit
@@ -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: enhancedf2fs10.sh
#
# Description: 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()
{
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 hierarchical SSR recovery function is enabled."
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/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 180
kill %1
if [ -s log10.txt ];then
tst_res TPASS "log10.txt is not empty."
else
tst_res TFAIL "log10.txt 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
losetup -d /dev/block/loop1
umount /mnt/f2fs_mount
}
do_setup
do_test
do_clean
tst_exit
@@ -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()
{
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 hierarchical SSR recycling is disabled."
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 $_sys_path/trace_pipe | grep ssr >> 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 180
kill %1
if [ -s log11.txt ];then
tst_res TFAIL "log11.txt is not empty."
ret=$(( $ret + 1 ))
else
tst_res TPASS "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
losetup -d /dev/block/loop1
umount /mnt/f2fs_mount
}
do_setup
do_test
do_clean
tst_exit
@@ -0,0 +1,86 @@
#!/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: enhancedf2fs12.sh
#
# Description: GC function test
#
# Authors: Li Zhanming - lizhanming3@h-partners.com
#
# History: April 8 2022 - init scripts
#
################################################################################
source tst_oh.sh
do_setup()
{
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
temp=$(cat /sys/fs/f2fs/loop1/gc_urgent)
tst_res TINFO "Start test GC function."
echo 1 > $_sys_path/tracing_on
echo 1 > $_sys_path/events/f2fs/f2fs_background_gc/enable
cat $_sys_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 60
kill %1
if [ -s log12.txt ];then
tst_res TPASS "log12.txt is not empty."
else
tst_res TFAIL "log12.txt 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
echo $temp > /sys/fs/f2fs/loop1/gc_urgent
losetup -d /dev/block/loop1
umount /mnt/f2fs_mount
}
do_setup
do_test
do_clean
tst_exit
@@ -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: 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
state_init()
{
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/
}
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]")
local result_left=`echo | awk "{peint $a*512*0.2}"`
local result_might=`echo | awk "{print $a*512-$b}"`
local result_right=`echo | awk "{print $a*512*0.1}"`
local result1=`echo "$result_left $result_might" \
| awk '{if ($result_left -gt $result_might) print 1; else print 0}'`
local result2=`echo "$result_might $result_right" \
| awk '{if ($result_might -gt $result_right) print 1; else print 0}'`
if [ $result1 ] && [ $result2 ];then
tst_res TPASS "Inequality holds."
else
tst_res TFAIL "Inequality does not hold."
ret=$(( $ret + 1 ))
fi
sleep 60
if [ $(cat /sys/fs/f2fs/loop1/discard_type) == '1' ];then
tst_res TPASS "equilibrium model successfully."
else
tst_res TFAIL "equilibrium model failed."
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 TPASS "Trace opened successfully."
else
tst_res TFAIL "Trace start failed."
ret=$(( $ret + 1 ))
fi
if [ $ret -eq 0 ];then
tst_res TPASS "equilibrium_init successfully."
else
tst_res TFAIL "equilibrium_init failed!"
fi
}
state_init
equilibrium_init
@@ -0,0 +1,81 @@
#!/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
state_init()
{
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/
}
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 TPASS "Inequality holds."
else
tst_res TFAIL "Inequality does not hold."
ret=$(( $ret + 1 ))
fi
if [ $(cat /sys/fs/f2fs/loop1/discard_type) == '0' ];then
tst_res TPASS "life model successfully."
else
tst_res TFAIL "life model failed."
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 TPASS "Trace opened successfully."
else
tst_res TFAIL "Trace start failed."
ret=$(( $ret + 1 ))
fi
if [ $ret -eq 0 ];then
tst_res TPASS "life_init pass."
else
tst_res TFAIL "life_init failed!"
fi
}
state_init
life_init
@@ -0,0 +1,88 @@
#!/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
state_init()
{
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/
}
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}')
echo "start Embedded file system $(date +%Y%m%d%H%M%S)...." >> log06.txt
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
echo "end Embedded file system $(date +%Y%m%d%H%M%S)...." >> log06.txt
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 TPASS "Inequality holds."
else
tst_res TFAIL "Inequality does not hold."
ret=$(( $ret + 1 ))
fi
sleep 60
if [ $(cat /sys/fs/f2fs/loop1/discard_type) == '2' ];then
tst_res TPASS "performance model successfully."
else
tst_res TFAIL "performance model failed."
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 TPASS "Trace opened successfully."
else
tst_res TFAIL "Trace start failed."
ret=$(( $ret + 1 ))
fi
if [ $ret -eq 0 ];then
tst_res TPASS "performance_init successfully."
else
tst_res TFAIL "performance_init failed!"
fi
}
state_init
performance_init
@@ -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
@@ -0,0 +1,41 @@
#!/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
}
echo "***************************ENHANCED INIT START***************************"
create_catalogue
enable_init
echo "***************************ENHANCED INIT END*****************************"
@@ -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: enhancedf2fs_t_uninit.sh
#
# Description: enhancedf2fs_t testsuite uninit script
#
# Authors: Li Zhanming - lizhanming3@h-partners.com
#
# History: April 8 2022 - init scripts
#
################################################################################
delete_catalogue()
{
rm -rf /mnt/f2fs_mount/
}
echo "***************************enhanced UNINIT START**************************"
delete_catalogue
echo "***************************enhanced UNINIT END****************************"
@@ -27,3 +27,4 @@ cpuisolation_t
cpusetdecouple_cpuhotplug_t
enhancedswap_t
sched_rtg_t
enhancedf2fs_t
@@ -0,0 +1,35 @@
################################################################################
#
# 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
#
# Description: enhancedf2fs_t testcase list
#
# Authors: Li Zhanming - lizhanming3@h-partners.com
#
# History: April 8 2022 - init scripts
#
################################################################################
enhancedf2fs01 enhancedf2fs01.sh
enhancedf2fs02 enhancedf2fs02.sh
enhancedf2fs03 enhancedf2fs03.sh
enhancedf2fs05 enhancedf2fs05.sh
enhancedf2fs07 enhancedf2fs07.sh
enhancedf2fs08 enhancedf2fs08.sh
enhancedf2fs09 enhancedf2fs09.sh
enhancedf2fs10 enhancedf2fs10.sh
enhancedf2fs11 enhancedf2fs11.sh
enhancedf2fs12 enhancedf2fs12.sh