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