Remove unnecessary uses of ls (#2311)

Other call sites need the call to readdir/getdents64.
This commit is contained in:
Andrew Gaul 2023-09-13 22:27:12 +09:00 committed by GitHub
parent e9814b4a4d
commit f493cb5846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -393,7 +393,7 @@ function test_external_directory_creation {
echo "data" | aws_cli s3 cp - "s3://${TEST_BUCKET_1}/${OBJECT_NAME}" echo "data" | aws_cli s3 cp - "s3://${TEST_BUCKET_1}/${OBJECT_NAME}"
# shellcheck disable=SC2010 # shellcheck disable=SC2010
ls | grep -q directory ls | grep -q directory
ls directory >/dev/null 2>&1 stat directory >/dev/null 2>&1
get_permissions directory | grep -q 750$ get_permissions directory | grep -q 750$
ls directory ls directory
cmp <(echo "data") directory/"${TEST_TEXT_FILE}" cmp <(echo "data") directory/"${TEST_TEXT_FILE}"
@ -2254,8 +2254,7 @@ function test_not_existed_dir_obj() {
fi fi
# Single nest directory # Single nest directory
# shellcheck disable=SC2010 if ! stat not_existed_dir_single; then
if ! ls -d not_existed_dir_single | grep -q '^not_existed_dir_single$'; then
echo "Expect to find \"not_existed_dir_single\" directory, but it is not found" echo "Expect to find \"not_existed_dir_single\" directory, but it is not found"
return 1; return 1;
fi fi
@ -2271,8 +2270,7 @@ function test_not_existed_dir_obj() {
fi fi
# Double nest directory # Double nest directory
# shellcheck disable=SC2010 if ! stat not_existed_dir_parent; then
if ! ls -d not_existed_dir_parent | grep -q '^not_existed_dir_parent'; then
echo "Expect to find \"not_existed_dir_parent\" directory, but it is not found" echo "Expect to find \"not_existed_dir_parent\" directory, but it is not found"
return 1; return 1;
fi fi
@ -2281,8 +2279,7 @@ function test_not_existed_dir_obj() {
echo "Expect to find \"not_existed_dir_parent/not_existed_dir_child\" directory, but it is not found" echo "Expect to find \"not_existed_dir_parent/not_existed_dir_child\" directory, but it is not found"
return 1; return 1;
fi fi
# shellcheck disable=SC2010 if ! stat not_existed_dir_parent/not_existed_dir_child; then
if ! ls -d not_existed_dir_parent/not_existed_dir_child | grep -q '^not_existed_dir_parent/not_existed_dir_child'; then
echo "Expect to find \"not_existed_dir_parent/not_existed_dir_child\" directory, but it is not found" echo "Expect to find \"not_existed_dir_parent/not_existed_dir_child\" directory, but it is not found"
return 1; return 1;
fi fi