aboutsummaryrefslogtreecommitdiff
path: root/tests/blkid.test
blob: 5bfce435b0e9dbcac1aae01a7738d1e54b29a652 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash

[ -f testing.sh ] && . testing.sh

#testing "name" "command" "result" "infile" "stdin"

function BLKID()
{
  file=$1
  shift
  bzcat $FILES/blkid/$file.bz2 > temp.img
  # e2fsprogs' blkid outputs trailing spaces; no other blkid does.
  blkid "$@" temp.img | sed 's/ $//'
  rm temp.img
}

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" "BLKID ext3" \
  'temp.img: LABEL="myext3" UUID="79d1c877-1a0f-4e7d-b21d-fc32ae3ef101" SEC_TYPE="ext2" TYPE="ext3"\n' \
  "" "" 
testing "ext4" "BLKID ext4" \
  'temp.img: LABEL="myext4" UUID="dc4b7c00-c0c0-4600-af7e-0335f09770fa" TYPE="ext4"\n' \
  "" ""
testing "f2fs" "BLKID f2fs" \
  'temp.img: LABEL="myf2fs" UUID="b53d3619-c204-4c0b-8504-36363578491c" TYPE="f2fs"\n' \
  "" ""
testing "msdos" "BLKID msdos" \
  'temp.img: SEC_TYPE="msdos" LABEL="mymsdos" UUID="6E1E-0851" TYPE="vfat"\n' \
  "" ""

# We use -s here because toybox blkid can't do ntfs volume labels yet.
testing "ntfs" "BLKID ntfs -s UUID -s TYPE" \
  'temp.img: UUID="6EE1BF3808608585" TYPE="ntfs"\n' "" ""
testing "reiserfs" "BLKID reiser3" \
  'temp.img: LABEL="myreiser" UUID="a5b99bec-45cc-41d7-986e-32f4b6fc28f2" TYPE="reiserfs"\n' \
  "" ""
testing "squashfs" "BLKID squashfs" 'temp.img: TYPE="squashfs"\n' "" ""
testing "vfat" "BLKID vfat" \
  'temp.img: SEC_TYPE="msdos" LABEL="myvfat" UUID="7356-B91D" 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