depmod: fix tabs in help output
[module-init-tools.git] / tests / test-depmod / 04maps.sh
blobc676c1baedf4edf819adfc3fff3f6f216dba4122
1 #! /bin/sh
2 # Test of generation of 32-bit and 64-bit maps
4 for ENDIAN in $TEST_ENDIAN; do
5 for BITNESS in $TEST_BITS; do
7 rm -rf tests/tmp/*
9 # Create inputs
10 MODULE_DIR=tests/tmp/lib/modules/$MODTEST_UNAME
11 mkdir -p $MODULE_DIR
12 ln tests/data/$BITNESS$ENDIAN/map/ccw_map-$BITNESS.ko \
13 tests/data/$BITNESS$ENDIAN/map/pci_map-$BITNESS.ko \
14 tests/data/$BITNESS$ENDIAN/map/usb_map-$BITNESS.ko \
15 tests/data/$BITNESS$ENDIAN/map/ieee1394_map-$BITNESS.ko \
16 tests/data/$BITNESS$ENDIAN/map/pnp_map-$BITNESS.ko \
17 tests/data/$BITNESS$ENDIAN/map/input_map-$BITNESS.ko \
18 tests/data/$BITNESS$ENDIAN/map/of_map-$BITNESS.ko \
19 tests/data/$BITNESS$ENDIAN/map/input_map_new-$BITNESS.ko \
20 $MODULE_DIR
22 touch tests/tmp/empty
24 # Expect no output.
25 [ "`depmod`" = "" ]
27 # Check PCI: expect 2 lines
28 [ `grep -vc '^#' < $MODULE_DIR/modules.pcimap` = 2 ]
30 [ "`grep pci_map $MODULE_DIR/modules.pcimap`" = "pci_map-$BITNESS 0x00000001 0x00000002 0x00000003 0x00000004 0x00000005 0x00000006 0x0
31 pci_map-$BITNESS 0x0000000b 0x0000000c 0x0000000d 0x0000000e 0x0000000f 0x00000010 0x0" ]
33 # Check USB: expect 2 lines
34 [ `grep -vc '^#' < $MODULE_DIR/modules.usbmap` = 2 ]
36 [ "`grep usb_map $MODULE_DIR/modules.usbmap`" = "usb_map-$BITNESS 0x0001 0x0002 0x0003 0x0004 0x0005 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0
37 usb_map-$BITNESS 0x000b 0x000c 0x000d 0x000e 0x000f 0x10 0x11 0x12 0x13 0x14 0x15 0x0" ]
39 # Check CCW: expect 2 lines
40 [ `grep -vc '^#' < $MODULE_DIR/modules.ccwmap` = 2 ]
42 [ "`grep ccw_map $MODULE_DIR/modules.ccwmap`" = "ccw_map-$BITNESS 0x000f 0x0001 0x03 0x0002 0x04
43 ccw_map-$BITNESS 0x000f 0x000b 0x0d 0x000c 0x0e" ]
45 # Check ieee1394: expect 2 lines
46 [ `grep -vc '^#' < $MODULE_DIR/modules.ieee1394map` = 2 ]
48 #%-20s 0x%08x 0x%06x 0x%06x 0x%06x 0x%06x\n",
49 #+ name, fw->match_flags, fw->vendor_id, fw->model_id,
50 #+ fw->specifier_id, fw->version);
51 [ "`grep ieee1394_map $MODULE_DIR/modules.ieee1394map`" = "ieee1394_map-$BITNESS 0x0000000c 0x000000 0x000000 0x00a02d 0x010001
52 ieee1394_map-$BITNESS 0x0000000c 0x000000 0x000000 0x00a02d 0x000100" ]
54 # Check pnp: expect 5 lines
55 [ `grep -vc '^#' < $MODULE_DIR/modules.isapnpmap` = 5 ]
57 #%-20s 0x%04x 0x%04x 0x00000000 0x%04x 0x%04x ...
58 # For normal table:
59 # name, 0xffff, 0xffff, 0x00000000, device, vendor
60 # For card table:
61 # name, vendor, device, driverinfo, device, vendor, [ device, vendor ]
62 [ "`grep pnp_map $MODULE_DIR/modules.isapnpmap`" = "pnp_map-$BITNESS 0xffff 0xffff 0x00000000 0x630e 0x0001
63 pnp_map-$BITNESS 0xffff 0xffff 0x00000000 0x630e 0x0000
64 pnp_map-$BITNESS 0xffff 0xffff 0x00000000 0x2d1d 0x0001
65 pnp_map-$BITNESS 0x9304 0x5071 0x00000000 0x9304 0x5071 0x9304 0x5171
66 pnp_map-$BITNESS 0x9304 0x8171 0x00000000 0x9304 0x8071 0x9304 0x8171 " ]
68 # Check input: expect 4 lines
69 [ `grep -vc '^#' < $MODULE_DIR/modules.inputmap` = 4 ]
71 # module matchBits bustype vendor product version evBits keyBits relBits absBits mscBits ledBits sndBits ffBits [swBits] driver_info
72 [ "`grep input_map $MODULE_DIR/modules.inputmap`" = "input_map-$BITNESS 0x10 0x0 0x0 0x0 0x0 2 0 0 0 0 0 0 0 0x0
73 input_map-$BITNESS 0x10 0x0 0x0 0x0 0x0 40000 0 0 0 0 0 0 0 0x0
74 input_map_new-$BITNESS 0x1010 0x0 0x0 0x0 0x0 2 0 0 0 0 0 0 0 1 0x0
75 input_map_new-$BITNESS 0x10 0x0 0x0 0x0 0x0 40000 0 0 0 0 0 0 0 0 0x0" ] ||
76 [ "`grep input_map $MODULE_DIR/modules.inputmap`" = "input_map_new-$BITNESS 0x1010 0x0 0x0 0x0 0x0 2 0 0 0 0 0 0 0 1 0x0
77 input_map_new-$BITNESS 0x10 0x0 0x0 0x0 0x0 40000 0 0 0 0 0 0 0 0 0x0
78 input_map-$BITNESS 0x10 0x0 0x0 0x0 0x0 2 0 0 0 0 0 0 0 0x0
79 input_map-$BITNESS 0x10 0x0 0x0 0x0 0x0 40000 0 0 0 0 0 0 0 0x0" ]
82 # Check of: expect 7 lines
83 [ `grep -vc '^#' < $MODULE_DIR/modules.ofmap` = 7 ]
85 # of module name type compatible
86 [ "`grep of_map $MODULE_DIR/modules.ofmap`" = "of_map-$BITNESS test_name_1 * *
87 of_map-$BITNESS * test_type_1 *
88 of_map-$BITNESS * * test_compat_1
89 of_map-$BITNESS test_name_2 test_type_2 *
90 of_map-$BITNESS test_name_3 * test_compat_2
91 of_map-$BITNESS * test_type_3 test_compat_3
92 of_map-$BITNESS test_name_4 test_type_4 test_compat_4" ]
94 mv $MODULE_DIR/modules.dep $MODULE_DIR/modules.dep.old
95 mv $MODULE_DIR/modules.pcimap $MODULE_DIR/modules.pcimap.old
96 mv $MODULE_DIR/modules.usbmap $MODULE_DIR/modules.usbmap.old
97 mv $MODULE_DIR/modules.ccwmap $MODULE_DIR/modules.ccwmap.old
98 mv $MODULE_DIR/modules.ieee1394map $MODULE_DIR/modules.ieee1394map.old
99 mv $MODULE_DIR/modules.isapnpmap $MODULE_DIR/modules.isapnpmap.old
100 mv $MODULE_DIR/modules.inputmap $MODULE_DIR/modules.inputmap.old
101 mv $MODULE_DIR/modules.ofmap $MODULE_DIR/modules.ofmap.old
103 # Synonyms
104 [ "`depmod -a`" = "" ]
105 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
106 diff -u $MODULE_DIR/modules.pcimap.old $MODULE_DIR/modules.pcimap
107 diff -u $MODULE_DIR/modules.usbmap.old $MODULE_DIR/modules.usbmap
108 diff -u $MODULE_DIR/modules.ccwmap.old $MODULE_DIR/modules.ccwmap
109 diff -u $MODULE_DIR/modules.ieee1394map.old $MODULE_DIR/modules.ieee1394map
110 diff -u $MODULE_DIR/modules.isapnpmap.old $MODULE_DIR/modules.isapnpmap
111 diff -u $MODULE_DIR/modules.inputmap.old $MODULE_DIR/modules.inputmap
112 diff -u $MODULE_DIR/modules.ofmap.old $MODULE_DIR/modules.ofmap
114 [ "`depmod -A`" = "" ]
115 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
116 diff -u $MODULE_DIR/modules.pcimap.old $MODULE_DIR/modules.pcimap
117 diff -u $MODULE_DIR/modules.usbmap.old $MODULE_DIR/modules.usbmap
118 diff -u $MODULE_DIR/modules.ccwmap.old $MODULE_DIR/modules.ccwmap
119 diff -u $MODULE_DIR/modules.ieee1394map.old $MODULE_DIR/modules.ieee1394map
120 diff -u $MODULE_DIR/modules.isapnpmap.old $MODULE_DIR/modules.isapnpmap
121 diff -u $MODULE_DIR/modules.inputmap.old $MODULE_DIR/modules.inputmap
122 diff -u $MODULE_DIR/modules.ofmap.old $MODULE_DIR/modules.ofmap
124 [ "`depmod -e -F /empty -A`" = "" ]
125 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
126 diff -u $MODULE_DIR/modules.pcimap.old $MODULE_DIR/modules.pcimap
127 diff -u $MODULE_DIR/modules.usbmap.old $MODULE_DIR/modules.usbmap
128 diff -u $MODULE_DIR/modules.ccwmap.old $MODULE_DIR/modules.ccwmap
129 diff -u $MODULE_DIR/modules.ieee1394map.old $MODULE_DIR/modules.ieee1394map
130 diff -u $MODULE_DIR/modules.isapnpmap.old $MODULE_DIR/modules.isapnpmap
131 diff -u $MODULE_DIR/modules.inputmap.old $MODULE_DIR/modules.inputmap
132 diff -u $MODULE_DIR/modules.ofmap.old $MODULE_DIR/modules.ofmap
134 [ "`depmod -e -F /empty -A $MODTEST_VERSION`" = "" ]
135 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
136 diff -u $MODULE_DIR/modules.pcimap.old $MODULE_DIR/modules.pcimap
137 diff -u $MODULE_DIR/modules.usbmap.old $MODULE_DIR/modules.usbmap
138 diff -u $MODULE_DIR/modules.ccwmap.old $MODULE_DIR/modules.ccwmap
139 diff -u $MODULE_DIR/modules.ieee1394map.old $MODULE_DIR/modules.ieee1394map
140 diff -u $MODULE_DIR/modules.isapnpmap.old $MODULE_DIR/modules.isapnpmap
141 diff -u $MODULE_DIR/modules.inputmap.old $MODULE_DIR/modules.inputmap
142 diff -u $MODULE_DIR/modules.ofmap.old $MODULE_DIR/modules.ofmap
144 # We expect the same from -n.
145 grep -hv '^#' $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.pcimap.old $MODULE_DIR/modules.usbmap.old $MODULE_DIR/modules.ccwmap.old $MODULE_DIR/modules.ieee1394map.old $MODULE_DIR/modules.isapnpmap.old $MODULE_DIR/modules.inputmap.old $MODULE_DIR/modules.ofmap.old > tests/tmp/out
147 # Stdout versions.
148 depmod -n | grep -v '^#' > tests/tmp/stdout
149 diff -u tests/tmp/out tests/tmp/stdout
151 depmod -a -n | grep -v '^#' > $MODULE_DIR/modules.dep
152 diff -u tests/tmp/out tests/tmp/stdout
154 depmod -n -a $MODTEST_VERSION | grep -v '^#' > $MODULE_DIR/modules.dep
155 diff -u tests/tmp/out tests/tmp/stdout
157 depmod -e -F /empty -n -A $MODTEST_VERSION | grep -v '^#' > $MODULE_DIR/modules.dep
158 diff -u tests/tmp/out tests/tmp/stdout
160 done
161 done