From 73e7b52b9eb0b63478fe60d214bfa92f93e5c319 Mon Sep 17 00:00:00 2001 From: BillyOu <12047406+billyou@user.noreply.gitee.com> Date: Fri, 15 Nov 2024 14:41:12 +0000 Subject: [PATCH] =?UTF-8?q?update=20fs/template/tests/main.sh.=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E6=B5=8B=E8=AF=84=E8=B6=85=E6=97=B6=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=BB=88=E6=AD=A2newfs=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: BillyOu <12047406+billyou@user.noreply.gitee.com> --- fs/template/tests/main.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/fs/template/tests/main.sh b/fs/template/tests/main.sh index 631c511..4669753 100755 --- a/fs/template/tests/main.sh +++ b/fs/template/tests/main.sh @@ -206,9 +206,33 @@ function test_end() { clean_mount } +fg_pid=$$ + +function handle_timeout() { + fail "测试超时" + fs_pid=$(pgrep $PROJECT_NAME) + if [ ! -z "$fs_pid" ]; then + for PID in $fs_pid; do + # echo "kill $PID" + kill -9 $PID + done + fi + fusermount -u $MNTPOINT + kill -9 $fg_pid + exit 1 +} + # Main echo "测试脚本工程根目录: $ROOT_PATH" +max_execution_time=20 +( + sleep $max_execution_time + handle_timeout +) & +timer_pid=$! +# echo "timer $timer_pid" + function main() { init_tester test_start @@ -216,3 +240,5 @@ function main() { } main + +kill $timer_pid 2>/dev/null -- Gitee