aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-06-27 13:27:01 -0700
committerRob Landley <rob@landley.net>2019-06-28 09:33:31 -0500
commit50f27779b68fb36cdc2ed4d929c8d97a0f69fe9f (patch)
tree93141d5c491ddb66cad84bd94a282c28ed01a865 /tests
parentccf574ecc4dd8af8fd045a9d6bbaf5e8bf66a8d2 (diff)
downloadtoybox-50f27779b68fb36cdc2ed4d929c8d97a0f69fe9f.tar.gz
file, stat: various small improvements.
file now shows the target of a symbolic link and calls out broken symbolic links. file now shows the device type for block/character special files. file now shows specific reason when it can't open. stat now includes the device type, plus a little more space between the number of blocks and the human-readable file type. Adjusted tests accordingly, which actually makes more of them pass on the host as a convenient side-effect, but I actually made these changes because I've been finding the desktop file and stat output more convenient in these cases.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/file.test10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/file.test b/tests/file.test
index fa8ea45b..57204e64 100755
--- a/tests/file.test
+++ b/tests/file.test
@@ -11,6 +11,9 @@ echo "#! /usr/bin/env python" > env.python.script
echo "Hello, world!" > ascii
echo "6465780a3033350038ca8f6ce910f94e" | xxd -r -p > android.dex
ln -s $FILES/java.class symlink
+LINK=$(readlink symlink)
+ln -s $FILES/java.klass dangler
+BROKEN=$(readlink dangler)
testing "directory" "file ." ".: directory\n" "" ""
testing "empty" "file empty" "empty: empty\n" "" ""
@@ -43,14 +46,15 @@ toyonly testing "Android NDK short ELF note" \
"file $FILES/elf/ndk-elf-note-short | sed 's/^.*: //'" \
"ELF shared object, 32-bit LSB arm, dynamic (/system/bin/linker), for Android 28, BuildID=da6a5f4ca8da163b9339326e626d8a3c, stripped\n" "" ""
-testing "symlink" "file symlink" "symlink: symbolic link\n" "" ""
-testing "symlink -h" "file -h symlink" "symlink: symbolic link\n" "" ""
+testing "broken symlink" "file dangler" "dangler: broken symbolic link to $BROKEN\n" "" ""
+testing "symlink" "file symlink" "symlink: symbolic link to $LINK\n" "" ""
+testing "symlink -h" "file -h symlink" "symlink: symbolic link to $LINK\n" "" ""
testing "symlink -L" "file -L symlink" "symlink: Java class file, version 53.0 (Java 1.9)\n" "" ""
testing "- pipe" "cat $FILES/java.class | file -" "-: Java class file, version 53.0 (Java 1.9)\n" "" ""
testing "- redirect" "file - <$FILES/java.class" "-: Java class file, version 53.0 (Java 1.9)\n" "" ""
-testing "/dev/zero" "file /dev/zero" "/dev/zero: character special\n" "" ""
+testing "/dev/zero" "file /dev/zero" "/dev/zero: character special (1/5)\n" "" ""
testing "- </dev/zero" "file - </dev/zero" "-: data\n" "" ""
rm empty bash.script bash.script2 env.python.script ascii android.dex