toybox/tests/blkid.test
<<
>>
Prefs
   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 "msdos" "BLKID msdos" \
  32  'temp.img: SEC_TYPE="msdos" LABEL="mymsdos" UUID="6E1E-0851" TYPE="vfat"\n' \
  33  "" ""
  34
  35# We use -s here because toybox blkid can't do ntfs volume labels yet.
  36testing "ntfs" "BLKID ntfs -s UUID -s TYPE" \
  37  'temp.img: UUID="6EE1BF3808608585" TYPE="ntfs"\n' "" ""
  38testing "reiserfs" "BLKID reiser3" \
  39  'temp.img: LABEL="myreiser" UUID="a5b99bec-45cc-41d7-986e-32f4b6fc28f2" TYPE="reiserfs"\n' \
  40  "" ""
  41testing "squashfs" "BLKID squashfs" 'temp.img: TYPE="squashfs"\n' "" ""
  42testing "vfat" "BLKID vfat" \
  43  'temp.img: SEC_TYPE="msdos" LABEL="myvfat" UUID="7356-B91D" TYPE="vfat"\n' \
  44  "" ""
  45testing "xfs" "BLKID xfs" \
  46  'temp.img: LABEL="XFS_test" UUID="d63a1dc3-27d5-4dd4-8b38-f4f97f495c6f" TYPE="xfs"\n' \
  47  "" ""
  48
  49# Unlike util-linux's blkid, toybox blkid can read from stdin.
  50toyonly testing "stdin" "bzcat $FILES/blkid/squashfs.bz2 | blkid -" \
  51  '-: TYPE="squashfs"\n' "" ""
  52
  53#testing "minix" 'bzcat "$BDIR"/minix.bz2 | blkid -'
  54#adfs bfs btrfs cramfs jfs nilfs romfs
  55#vfat  // fat32 fat12 fat16
  56
  57bzcat $FILES/blkid/ext3.bz2 > temp.img
  58testcmd "-o value -s" "-o value -s TYPE temp.img" 'ext3\n' "" ""
  59testcmd "-o export" "-o export temp.img" 'DEVNAME=temp.img\nLABEL=myext3\nUUID=79d1c877-1a0f-4e7d-b21d-fc32ae3ef101\nSEC_TYPE=ext2\nTYPE=ext3\n' "" ""
  60rm temp.img
  61