Ai
1 Star 0 Fork 2

BuildOpenSource/busybox

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
find.tests 1.84 KB
一键复制 编辑 原始数据 按行查看 历史
David Leonard 提交于 2023-01-29 10:07 +08:00 . find: implement -ok
#!/bin/sh
# Copyright 2014 by Denys Vlasenko <vda.linux@googlemail.com>
# Licensed under GPLv2, see file LICENSE in this source tree.
. ./testing.sh
# testing "description" "command" "result" "infile" "stdin"
mkdir -p find.tempdir
touch find.tempdir/testfile
optional FEATURE_FIND_TYPE
testing "find -type f" \
"cd find.tempdir && find -type f 2>&1" \
"./testfile\n" \
"" ""
SKIP=
optional FEATURE_FIND_EXEC
testing "find -exec exitcode 1" \
"cd find.tempdir && find testfile -exec true {} \; 2>&1; echo \$?" \
"0\n" \
"" ""
SKIP=
optional FEATURE_FIND_EXEC_PLUS
testing "find -exec exitcode 2" \
"cd find.tempdir && find testfile -exec true {} + 2>&1; echo \$?" \
"0\n" \
"" ""
SKIP=
optional FEATURE_FIND_EXEC_OK
testing "find -ok" \
"cd find.tempdir && find testfile -ok true {} ';' 2>&1; echo \$?" \
"true testfile ?0\n" \
"" "y"
SKIP=
# Surprisingly, "-exec false ;" results in exitcode 0! "-exec false +" is different!!!
optional FEATURE_FIND_EXEC
testing "find -exec exitcode 3" \
"cd find.tempdir && find testfile -exec false {} \; 2>&1; echo \$?" \
"0\n" \
"" ""
SKIP=
optional FEATURE_FIND_EXEC_PLUS
testing "find -exec exitcode 4" \
"cd find.tempdir && find testfile -exec false {} + 2>&1; echo \$?" \
"1\n" \
"" ""
SKIP=
optional FEATURE_FIND_MAXDEPTH
testing "find / -maxdepth 0 -name /" \
"find / -maxdepth 0 -name /" \
"/\n" \
"" ""
testing "find // -maxdepth 0 -name /" \
"find // -maxdepth 0 -name /" \
"//\n" \
"" ""
testing "find / -maxdepth 0 -name //" \
"find / -maxdepth 0 -name //" \
"" \
"" ""
testing "find // -maxdepth 0 -name //" \
"find // -maxdepth 0 -name //" \
"" \
"" ""
SKIP=
testing "find ./// -name ." \
"find ./// -name ." \
".///\n" \
"" ""
testing "find ./// -name .///" \
"find ./// -name .///" \
"" \
"" ""
# testing "description" "command" "result" "infile" "stdin"
rm -rf find.tempdir
exit $FAILCOUNT
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/build-open-source/busybox.git
git@gitee.com:build-open-source/busybox.git
build-open-source
busybox
busybox
master

搜索帮助