• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3[ -f testing.sh ] && . testing.sh
4
5#testing "name" "command" "result" "infile" "stdin"
6
7function BLKID()
8{
9  file=$1
10  shift
11  bzcat $FILES/blkid/$file.bz2 > temp.img
12  # e2fsprogs' blkid outputs trailing spaces; no other blkid does.
13  blkid "$@" temp.img | sed 's/ $//'
14  rm temp.img
15}
16
17testing "cramfs" "BLKID cramfs" \
18  'temp.img: LABEL="mycramfs" TYPE="cramfs"\n' "" ""
19testing "ext2" "BLKID ext2" \
20  'temp.img: LABEL="myext2" UUID="e59093ba-4135-4fdb-bcc4-f20beae4dfaf" TYPE="ext2"\n' \
21  "" ""
22testing "ext3" "BLKID ext3" \
23  'temp.img: LABEL="myext3" UUID="79d1c877-1a0f-4e7d-b21d-fc32ae3ef101" SEC_TYPE="ext2" TYPE="ext3"\n' \
24  "" ""
25testing "ext4" "BLKID ext4" \
26  'temp.img: LABEL="myext4" UUID="dc4b7c00-c0c0-4600-af7e-0335f09770fa" TYPE="ext4"\n' \
27  "" ""
28testing "f2fs" "BLKID f2fs" \
29  'temp.img: LABEL="myf2fs" UUID="b53d3619-c204-4c0b-8504-36363578491c" TYPE="f2fs"\n' \
30  "" ""
31testing "iso" "BLKID iso" \
32  'temp.img: LABEL="CDROM" UUID="2023-02-08-04-47-27-00" TYPE="iso9660"\n' \
33  "" ""
34testing "msdos" "BLKID msdos" \
35  'temp.img: SEC_TYPE="msdos" LABEL="mymsdos" UUID="6E1E-0851" TYPE="vfat"\n' \
36  "" ""
37
38# We use -s here because toybox blkid can't do ntfs volume labels yet.
39testing "ntfs" "BLKID ntfs -s UUID -s TYPE" \
40  'temp.img: UUID="6EE1BF3808608585" TYPE="ntfs"\n' "" ""
41testing "reiserfs" "BLKID reiser3" \
42  'temp.img: LABEL="myreiser" UUID="a5b99bec-45cc-41d7-986e-32f4b6fc28f2" TYPE="reiserfs"\n' \
43  "" ""
44testing "squashfs" "BLKID squashfs" 'temp.img: TYPE="squashfs"\n' "" ""
45testing "vfat" "BLKID vfat" \
46  'temp.img: SEC_TYPE="msdos" LABEL="myvfat" UUID="7356-B91D" TYPE="vfat"\n' \
47  "" ""
48testing "xfs" "BLKID xfs" \
49  'temp.img: LABEL="XFS_test" UUID="d63a1dc3-27d5-4dd4-8b38-f4f97f495c6f" TYPE="xfs"\n' \
50  "" ""
51
52# Unlike util-linux's blkid, toybox blkid can read from stdin.
53toyonly testing "stdin" "bzcat $FILES/blkid/squashfs.bz2 | blkid -" \
54  '-: TYPE="squashfs"\n' "" ""
55
56#testing "minix" 'bzcat "$BDIR"/minix.bz2 | blkid -'
57#adfs bfs btrfs cramfs jfs nilfs romfs
58#vfat  // fat32 fat12 fat16
59
60bzcat $FILES/blkid/ext3.bz2 > temp.img
61testcmd "-o value -s" "-o value -s TYPE temp.img" 'ext3\n' "" ""
62testcmd "-o export" "-o export temp.img" 'DEVNAME=temp.img\nLABEL=myext3\nUUID=79d1c877-1a0f-4e7d-b21d-fc32ae3ef101\nSEC_TYPE=ext2\nTYPE=ext3\n' "" ""
63rm temp.img
64