blkid.test 2.2 KB

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