aboutsummaryrefslogtreecommitdiff
path: root/tests/blkid.test
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-06-24 13:59:52 -0700
committerRob Landley <rob@landley.net>2019-06-25 18:24:57 -0500
commitac631beb854f4d1d533819d7eefbdadbe94cec95 (patch)
tree09fcdb91edb95561da46408081a83b160301a735 /tests/blkid.test
parent7fceed5f75c9c082b2bc5f47be816e69524f63af (diff)
downloadtoybox-ac631beb854f4d1d533819d7eefbdadbe94cec95.tar.gz
blkid: adapt tests for util-linux blkid.
util-linux's blkid doesn't support reading from stdin, so move that to being a special toyonly test rather than the default. toybox blkid differs from util-linux in that it doesn't seem to find the LABEL for the checked-in example f2fs file system (the offset is wrong, but also f2fs uses LE16 strings), nor does it support the SEC_TYPE that util-linux blkid shows for several of the test file systems.
Diffstat (limited to 'tests/blkid.test')
-rwxr-xr-xtests/blkid.test58
1 files changed, 31 insertions, 27 deletions
diff --git a/tests/blkid.test b/tests/blkid.test
index deb94d89..436a0950 100755
--- a/tests/blkid.test
+++ b/tests/blkid.test
@@ -4,41 +4,45 @@
#testing "name" "command" "result" "infile" "stdin"
-BDIR="$FILES/blkid"
+function BLKID()
+{
+ bzcat $FILES/blkid/$1.bz2 > temp.img
+ blkid temp.img
+ rm temp.img
+}
-bzcat "$BDIR"/squashfs.bz2 > temp.img
-testing "file" "blkid temp.img" 'temp.img: TYPE="squashfs"\n' "" ""
-rm temp.img
-
-testing "cramfs" 'bzcat "$BDIR"/cramfs.bz2 | blkid -' \
- '-: LABEL="mycramfs" TYPE="cramfs"\n' "" ""
-testing "ext2" 'bzcat "$BDIR"/ext2.bz2 | blkid -' \
- '-: LABEL="myext2" UUID="e59093ba-4135-4fdb-bcc4-f20beae4dfaf" TYPE="ext2"\n' \
+testing "cramfs" "BLKID cramfs" \
+ 'temp.img: LABEL="mycramfs" TYPE="cramfs"\n' "" ""
+testing "ext2" "BLKID ext2" \
+ 'temp.img: LABEL="myext2" UUID="e59093ba-4135-4fdb-bcc4-f20beae4dfaf" TYPE="ext2"\n' \
"" ""
-testing "ext3" 'bzcat "$BDIR"/ext3.bz2 | blkid -' \
- '-: LABEL="myext3" UUID="79d1c877-1a0f-4e7d-b21d-fc32ae3ef101" TYPE="ext3"\n' \
+testing "ext3" "BLKID ext3" \
+ 'temp.img: LABEL="myext3" UUID="79d1c877-1a0f-4e7d-b21d-fc32ae3ef101" TYPE="ext3"\n' \
"" ""
-testing "ext4" 'bzcat "$BDIR"/ext4.bz2 | blkid -' \
- '-: LABEL="myext4" UUID="dc4b7c00-c0c0-4600-af7e-0335f09770fa" TYPE="ext4"\n' \
+testing "ext4" "BLKID ext4" \
+ 'temp.img: LABEL="myext4" UUID="dc4b7c00-c0c0-4600-af7e-0335f09770fa" TYPE="ext4"\n' \
"" ""
-testing "f2fs" 'bzcat "$BDIR"/f2fs.bz2 | blkid -' \
- '-: UUID="b53d3619-c204-4c0b-8504-36363578491c" TYPE="f2fs"\n' \
+testing "f2fs" "BLKID f2fs" \
+ 'temp.img: UUID="b53d3619-c204-4c0b-8504-36363578491c" TYPE="f2fs"\n' \
"" ""
-testing "msdos" 'bzcat "$BDIR"/msdos.bz2 | blkid -' \
- '-: LABEL="mymsdos" UUID="5108-1e6e" TYPE="vfat"\n' "" ""
-testing "ntfs" 'bzcat "$BDIR"/ntfs.bz2 | blkid -' \
- '-: UUID="8585600838bfe16e" TYPE="ntfs"\n' "" ""
-testing "reiserfs" 'bzcat "$BDIR"/reiser3.bz2 | blkid -' \
- '-: LABEL="myreiser" UUID="a5b99bec-45cc-41d7-986e-32f4b6fc28f2" TYPE="reiserfs"\n' \
+testing "msdos" "BLKID msdos" \
+ 'temp.img: LABEL="mymsdos" UUID="5108-1e6e" TYPE="vfat"\n' "" ""
+testing "ntfs" "BLKID ntfs" \
+ 'temp.img: UUID="8585600838bfe16e" TYPE="ntfs"\n' "" ""
+testing "reiserfs" "BLKID reiser3" \
+ 'temp.img: LABEL="myreiser" UUID="a5b99bec-45cc-41d7-986e-32f4b6fc28f2" TYPE="reiserfs"\n' \
"" ""
-testing "squashfs" 'bzcat "$BDIR"/squashfs.bz2 | blkid -' \
- '-: TYPE="squashfs"\n' "" ""
-testing "vfat" 'bzcat "$BDIR"/vfat.bz2 | blkid -' \
- '-: LABEL="myvfat" UUID="1db9-5673" TYPE="vfat"\n' "" ""
-testing "xfs" 'bzcat "$BDIR"/xfs.bz2 | blkid -' \
- '-: LABEL="XFS_test" UUID="d63a1dc3-27d5-4dd4-8b38-f4f97f495c6f" TYPE="xfs"\n' \
+testing "squashfs" "BLKID squashfs" 'temp.img: TYPE="squashfs"\n' "" ""
+testing "vfat" "BLKID vfat" \
+ 'temp.img: LABEL="myvfat" UUID="1db9-5673" TYPE="vfat"\n' "" ""
+testing "xfs" "BLKID xfs" \
+ 'temp.img: LABEL="XFS_test" UUID="d63a1dc3-27d5-4dd4-8b38-f4f97f495c6f" TYPE="xfs"\n' \
"" ""
+# Unlike util-linux's blkid, toybox blkid can read from stdin.
+toyonly testing "stdin" "bzcat $FILES/blkid/squashfs.bz2 | blkid -" \
+ '-: TYPE="squashfs"\n' "" ""
+
#testing "minix" 'bzcat "$BDIR"/minix.bz2 | blkid -'
#adfs bfs btrfs cramfs jfs nilfs romfs
#vfat // fat32 fat12 fat16