makedevs.tests 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #!/bin/sh
  2. # Copyright 2008 by Denys Vlasenko
  3. # Licensed under GPLv2, see file LICENSE in this source tree.
  4. . ./testing.sh
  5. test x"`id -u`" = x"0" || {
  6. echo "SKIPPED: makedevs (must be root to test this)"
  7. exit 0
  8. }
  9. unset LANG
  10. unset LC_COLLATE
  11. unset LC_ALL
  12. # ls -ln is showing date. Need to remove that, it's variable
  13. # sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces
  14. # cut: remove date
  15. FILTER_LS="sed -e 's/, */,/g' -e 's/ */ /g' | cut -d' ' -f 1-5,9-"
  16. # cut: remove size+date
  17. FILTER_LS2="sed -e 's/, */,/g' -e 's/ */ /g' | cut -d' ' -f 1-4,9-"
  18. # testing "test name" "options" "expected result" "file input" "stdin"
  19. rm -rf makedevs.testdir
  20. mkdir makedevs.testdir
  21. optional FEATURE_MAKEDEVS_TABLE FEATURE_FIND_NOT FEATURE_FIND_TYPE FEATURE_LS_RECURSIVE FEATURE_LS_SORTFILES FEATURE_LS_TIMESTAMPS
  22. testing "makedevs -d ../makedevs.device_table.txt ." \
  23. "(cd makedevs.testdir && makedevs -d ../makedevs.device_table.txt . 2>&1);
  24. find makedevs.testdir ! -type d | sort | xargs ls -lnR | $FILTER_LS" \
  25. "\
  26. rootdir=.
  27. table='../makedevs.device_table.txt'
  28. crw-rw-rw- 1 0 0 5,1 makedevs.testdir/dev/console
  29. crw-r----- 1 0 5 29,0 makedevs.testdir/dev/fb0
  30. crw-r----- 1 0 5 29,32 makedevs.testdir/dev/fb1
  31. crw-r----- 1 0 5 29,64 makedevs.testdir/dev/fb2
  32. crw-r----- 1 0 5 29,96 makedevs.testdir/dev/fb3
  33. brw-r----- 1 0 0 3,0 makedevs.testdir/dev/hda
  34. brw-r----- 1 0 0 3,1 makedevs.testdir/dev/hda1
  35. brw-r----- 1 0 0 3,10 makedevs.testdir/dev/hda10
  36. brw-r----- 1 0 0 3,11 makedevs.testdir/dev/hda11
  37. brw-r----- 1 0 0 3,12 makedevs.testdir/dev/hda12
  38. brw-r----- 1 0 0 3,13 makedevs.testdir/dev/hda13
  39. brw-r----- 1 0 0 3,14 makedevs.testdir/dev/hda14
  40. brw-r----- 1 0 0 3,15 makedevs.testdir/dev/hda15
  41. brw-r----- 1 0 0 3,2 makedevs.testdir/dev/hda2
  42. brw-r----- 1 0 0 3,3 makedevs.testdir/dev/hda3
  43. brw-r----- 1 0 0 3,4 makedevs.testdir/dev/hda4
  44. brw-r----- 1 0 0 3,5 makedevs.testdir/dev/hda5
  45. brw-r----- 1 0 0 3,6 makedevs.testdir/dev/hda6
  46. brw-r----- 1 0 0 3,7 makedevs.testdir/dev/hda7
  47. brw-r----- 1 0 0 3,8 makedevs.testdir/dev/hda8
  48. brw-r----- 1 0 0 3,9 makedevs.testdir/dev/hda9
  49. brw-r----- 1 0 0 3,64 makedevs.testdir/dev/hdb
  50. brw-r----- 1 0 0 3,65 makedevs.testdir/dev/hdb1
  51. brw-r----- 1 0 0 3,74 makedevs.testdir/dev/hdb10
  52. brw-r----- 1 0 0 3,75 makedevs.testdir/dev/hdb11
  53. brw-r----- 1 0 0 3,76 makedevs.testdir/dev/hdb12
  54. brw-r----- 1 0 0 3,77 makedevs.testdir/dev/hdb13
  55. brw-r----- 1 0 0 3,78 makedevs.testdir/dev/hdb14
  56. brw-r----- 1 0 0 3,79 makedevs.testdir/dev/hdb15
  57. brw-r----- 1 0 0 3,66 makedevs.testdir/dev/hdb2
  58. brw-r----- 1 0 0 3,67 makedevs.testdir/dev/hdb3
  59. brw-r----- 1 0 0 3,68 makedevs.testdir/dev/hdb4
  60. brw-r----- 1 0 0 3,69 makedevs.testdir/dev/hdb5
  61. brw-r----- 1 0 0 3,70 makedevs.testdir/dev/hdb6
  62. brw-r----- 1 0 0 3,71 makedevs.testdir/dev/hdb7
  63. brw-r----- 1 0 0 3,72 makedevs.testdir/dev/hdb8
  64. brw-r----- 1 0 0 3,73 makedevs.testdir/dev/hdb9
  65. crw-rw---- 1 0 0 13,64 makedevs.testdir/dev/input/event0
  66. crw-rw---- 1 0 0 13,65 makedevs.testdir/dev/input/event1
  67. crw-rw---- 1 0 0 13,66 makedevs.testdir/dev/input/event2
  68. crw-rw---- 1 0 0 13,67 makedevs.testdir/dev/input/event3
  69. crw-r----- 1 0 0 13,63 makedevs.testdir/dev/input/mice
  70. crw-rw---- 1 0 0 13,32 makedevs.testdir/dev/input/mouse0
  71. crw-rw---- 1 0 0 13,33 makedevs.testdir/dev/input/mouse1
  72. crw-rw---- 1 0 0 13,34 makedevs.testdir/dev/input/mouse2
  73. crw-rw---- 1 0 0 13,35 makedevs.testdir/dev/input/mouse3
  74. crw-r----- 1 0 0 1,2 makedevs.testdir/dev/kmem
  75. brw-r----- 1 0 0 7,0 makedevs.testdir/dev/loop0
  76. brw-r----- 1 0 0 7,1 makedevs.testdir/dev/loop1
  77. crw-r----- 1 0 0 1,1 makedevs.testdir/dev/mem
  78. crw-r----- 1 0 0 90,0 makedevs.testdir/dev/mtd0
  79. crw-r----- 1 0 0 90,2 makedevs.testdir/dev/mtd1
  80. crw-r----- 1 0 0 90,4 makedevs.testdir/dev/mtd2
  81. crw-r----- 1 0 0 90,6 makedevs.testdir/dev/mtd3
  82. brw-r----- 1 0 0 31,0 makedevs.testdir/dev/mtdblock0
  83. brw-r----- 1 0 0 31,1 makedevs.testdir/dev/mtdblock1
  84. brw-r----- 1 0 0 31,2 makedevs.testdir/dev/mtdblock2
  85. brw-r----- 1 0 0 31,3 makedevs.testdir/dev/mtdblock3
  86. crw-rw---- 1 0 0 10,200 makedevs.testdir/dev/net/tun
  87. crw-rw-rw- 1 0 0 1,3 makedevs.testdir/dev/null
  88. crw-rw-rw- 1 0 0 10,1 makedevs.testdir/dev/psaux
  89. crw-rw-rw- 1 0 0 5,2 makedevs.testdir/dev/ptmx
  90. crw-rw-rw- 1 0 0 2,0 makedevs.testdir/dev/ptyp0
  91. crw-rw-rw- 1 0 0 2,1 makedevs.testdir/dev/ptyp1
  92. crw-rw-rw- 1 0 0 2,2 makedevs.testdir/dev/ptyp2
  93. crw-rw-rw- 1 0 0 2,3 makedevs.testdir/dev/ptyp3
  94. crw-rw-rw- 1 0 0 2,4 makedevs.testdir/dev/ptyp4
  95. crw-rw-rw- 1 0 0 2,5 makedevs.testdir/dev/ptyp5
  96. crw-rw-rw- 1 0 0 2,6 makedevs.testdir/dev/ptyp6
  97. crw-rw-rw- 1 0 0 2,7 makedevs.testdir/dev/ptyp7
  98. crw-rw-rw- 1 0 0 2,8 makedevs.testdir/dev/ptyp8
  99. crw-rw-rw- 1 0 0 2,9 makedevs.testdir/dev/ptyp9
  100. brw-r----- 1 0 0 1,1 makedevs.testdir/dev/ram
  101. brw-r----- 1 0 0 1,0 makedevs.testdir/dev/ram0
  102. brw-r----- 1 0 0 1,1 makedevs.testdir/dev/ram1
  103. brw-r----- 1 0 0 1,2 makedevs.testdir/dev/ram2
  104. brw-r----- 1 0 0 1,3 makedevs.testdir/dev/ram3
  105. crw-rw-rw- 1 0 0 1,8 makedevs.testdir/dev/random
  106. crw-r----- 1 0 0 10,135 makedevs.testdir/dev/rtc
  107. crw-rw-rw- 1 0 0 5,0 makedevs.testdir/dev/tty
  108. crw-rw-rw- 1 0 0 4,0 makedevs.testdir/dev/tty0
  109. crw-rw-rw- 1 0 0 4,1 makedevs.testdir/dev/tty1
  110. crw-rw-rw- 1 0 0 4,2 makedevs.testdir/dev/tty2
  111. crw-rw-rw- 1 0 0 4,3 makedevs.testdir/dev/tty3
  112. crw-rw-rw- 1 0 0 4,4 makedevs.testdir/dev/tty4
  113. crw-rw-rw- 1 0 0 4,5 makedevs.testdir/dev/tty5
  114. crw-rw-rw- 1 0 0 4,6 makedevs.testdir/dev/tty6
  115. crw-rw-rw- 1 0 0 4,7 makedevs.testdir/dev/tty7
  116. crw-rw-rw- 1 0 0 57,0 makedevs.testdir/dev/ttyP0
  117. crw-rw-rw- 1 0 0 57,1 makedevs.testdir/dev/ttyP1
  118. crw-rw-rw- 1 0 0 57,2 makedevs.testdir/dev/ttyP2
  119. crw-rw-rw- 1 0 0 57,3 makedevs.testdir/dev/ttyP3
  120. crw-rw-rw- 1 0 0 4,64 makedevs.testdir/dev/ttyS0
  121. crw-rw-rw- 1 0 0 4,65 makedevs.testdir/dev/ttyS1
  122. crw-rw-rw- 1 0 0 4,66 makedevs.testdir/dev/ttyS2
  123. crw-rw-rw- 1 0 0 4,67 makedevs.testdir/dev/ttyS3
  124. crw-rw-rw- 1 0 0 3,0 makedevs.testdir/dev/ttyp0
  125. crw-rw-rw- 1 0 0 3,1 makedevs.testdir/dev/ttyp1
  126. crw-rw-rw- 1 0 0 3,2 makedevs.testdir/dev/ttyp2
  127. crw-rw-rw- 1 0 0 3,3 makedevs.testdir/dev/ttyp3
  128. crw-rw-rw- 1 0 0 3,4 makedevs.testdir/dev/ttyp4
  129. crw-rw-rw- 1 0 0 3,5 makedevs.testdir/dev/ttyp5
  130. crw-rw-rw- 1 0 0 3,6 makedevs.testdir/dev/ttyp6
  131. crw-rw-rw- 1 0 0 3,7 makedevs.testdir/dev/ttyp7
  132. crw-rw-rw- 1 0 0 3,8 makedevs.testdir/dev/ttyp8
  133. crw-rw-rw- 1 0 0 3,9 makedevs.testdir/dev/ttyp9
  134. crw-rw-rw- 1 0 0 1,9 makedevs.testdir/dev/urandom
  135. crw-rw-rw- 1 0 0 1,5 makedevs.testdir/dev/zero
  136. " \
  137. "" ""
  138. SKIP=
  139. # clean up
  140. rm -rf makedevs.testdir
  141. exit $FAILCOUNT