depmod: export static device node information to modules.devname
[mit.git] / tests / test-depmod / 04maps.sh
blob8d30f8f26755f18cc8b5f2ef98bcc8d62410a2fb
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 # Expect no output.
23 [ "`depmod`" = "" ]
25 # Check PCI: expect 2 lines
26 [ `grep -vc '^#' < $MODULE_DIR/modules.pcimap` = 2 ]
28 [ "`grep pci_map $MODULE_DIR/modules.pcimap`" = "pci_map-$BITNESS 0x00000001 0x00000002 0x00000003 0x00000004 0x00000005 0x00000006 0x0
29 pci_map-$BITNESS 0x0000000b 0x0000000c 0x0000000d 0x0000000e 0x0000000f 0x00000010 0x0" ]
31 # Check USB: expect 2 lines
32 [ `grep -vc '^#' < $MODULE_DIR/modules.usbmap` = 2 ]
34 [ "`grep usb_map $MODULE_DIR/modules.usbmap`" = "usb_map-$BITNESS 0x0001 0x0002 0x0003 0x0004 0x0005 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0
35 usb_map-$BITNESS 0x000b 0x000c 0x000d 0x000e 0x000f 0x10 0x11 0x12 0x13 0x14 0x15 0x0" ]
37 # Check CCW: expect 2 lines
38 [ `grep -vc '^#' < $MODULE_DIR/modules.ccwmap` = 2 ]
40 [ "`grep ccw_map $MODULE_DIR/modules.ccwmap`" = "ccw_map-$BITNESS 0x000f 0x0001 0x03 0x0002 0x04
41 ccw_map-$BITNESS 0x000f 0x000b 0x0d 0x000c 0x0e" ]
43 # Check ieee1394: expect 2 lines
44 [ `grep -vc '^#' < $MODULE_DIR/modules.ieee1394map` = 2 ]
46 #%-20s 0x%08x 0x%06x 0x%06x 0x%06x 0x%06x\n",
47 #+ name, fw->match_flags, fw->vendor_id, fw->model_id,
48 #+ fw->specifier_id, fw->version);
49 [ "`grep ieee1394_map $MODULE_DIR/modules.ieee1394map`" = "ieee1394_map-$BITNESS 0x0000000c 0x000000 0x000000 0x00a02d 0x010001
50 ieee1394_map-$BITNESS 0x0000000c 0x000000 0x000000 0x00a02d 0x000100" ]
52 # Check pnp: expect 5 lines
53 [ `grep -vc '^#' < $MODULE_DIR/modules.isapnpmap` = 5 ]
55 #%-20s 0x%04x 0x%04x 0x00000000 0x%04x 0x%04x ...
56 # For normal table:
57 # name, 0xffff, 0xffff, 0x00000000, device, vendor
58 # For card table:
59 # name, vendor, device, driverinfo, device, vendor, [ device, vendor ]
60 [ "`grep pnp_map $MODULE_DIR/modules.isapnpmap`" = "pnp_map-$BITNESS 0xffff 0xffff 0x00000000 0x630e 0x0001
61 pnp_map-$BITNESS 0xffff 0xffff 0x00000000 0x630e 0x0000
62 pnp_map-$BITNESS 0xffff 0xffff 0x00000000 0x2d1d 0x0001
63 pnp_map-$BITNESS 0x9304 0x5071 0x00000000 0x9304 0x5071 0x9304 0x5171
64 pnp_map-$BITNESS 0x9304 0x8171 0x00000000 0x9304 0x8071 0x9304 0x8171 " ]
66 # Check input: expect 4 lines
67 [ `grep -vc '^#' < $MODULE_DIR/modules.inputmap` = 4 ]
69 # module matchBits bustype vendor product version evBits keyBits relBits absBits mscBits ledBits sndBits ffBits [swBits] driver_info
70 [ "`grep input_map $MODULE_DIR/modules.inputmap`" = "input_map-$BITNESS 0x10 0x0 0x0 0x0 0x0 2 0 0 0 0 0 0 0 0x0
71 input_map-$BITNESS 0x10 0x0 0x0 0x0 0x0 40000 0 0 0 0 0 0 0 0x0
72 input_map_new-$BITNESS 0x1010 0x0 0x0 0x0 0x0 2 0 0 0 0 0 0 0 1 0x0
73 input_map_new-$BITNESS 0x10 0x0 0x0 0x0 0x0 40000 0 0 0 0 0 0 0 0 0x0" ] ||
74 [ "`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
75 input_map_new-$BITNESS 0x10 0x0 0x0 0x0 0x0 40000 0 0 0 0 0 0 0 0 0x0
76 input_map-$BITNESS 0x10 0x0 0x0 0x0 0x0 2 0 0 0 0 0 0 0 0x0
77 input_map-$BITNESS 0x10 0x0 0x0 0x0 0x0 40000 0 0 0 0 0 0 0 0x0" ]
80 # Check of: expect 7 lines
81 [ `grep -vc '^#' < $MODULE_DIR/modules.ofmap` = 7 ]
83 # of module name type compatible
84 [ "`grep of_map $MODULE_DIR/modules.ofmap`" = "of_map-$BITNESS test_name_1 * *
85 of_map-$BITNESS * test_type_1 *
86 of_map-$BITNESS * * test_compat_1
87 of_map-$BITNESS test_name_2 test_type_2 *
88 of_map-$BITNESS test_name_3 * test_compat_2
89 of_map-$BITNESS * test_type_3 test_compat_3
90 of_map-$BITNESS test_name_4 test_type_4 test_compat_4" ]
92 mv $MODULE_DIR/modules.dep $MODULE_DIR/modules.dep.old
93 mv $MODULE_DIR/modules.pcimap $MODULE_DIR/modules.pcimap.old
94 mv $MODULE_DIR/modules.usbmap $MODULE_DIR/modules.usbmap.old
95 mv $MODULE_DIR/modules.ccwmap $MODULE_DIR/modules.ccwmap.old
96 mv $MODULE_DIR/modules.ieee1394map $MODULE_DIR/modules.ieee1394map.old
97 mv $MODULE_DIR/modules.isapnpmap $MODULE_DIR/modules.isapnpmap.old
98 mv $MODULE_DIR/modules.inputmap $MODULE_DIR/modules.inputmap.old
99 mv $MODULE_DIR/modules.ofmap $MODULE_DIR/modules.ofmap.old
101 # Synonyms
102 [ "`depmod -a`" = "" ]
103 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
104 diff -u $MODULE_DIR/modules.pcimap.old $MODULE_DIR/modules.pcimap
105 diff -u $MODULE_DIR/modules.usbmap.old $MODULE_DIR/modules.usbmap
106 diff -u $MODULE_DIR/modules.ccwmap.old $MODULE_DIR/modules.ccwmap
107 diff -u $MODULE_DIR/modules.ieee1394map.old $MODULE_DIR/modules.ieee1394map
108 diff -u $MODULE_DIR/modules.isapnpmap.old $MODULE_DIR/modules.isapnpmap
109 diff -u $MODULE_DIR/modules.inputmap.old $MODULE_DIR/modules.inputmap
110 diff -u $MODULE_DIR/modules.ofmap.old $MODULE_DIR/modules.ofmap
112 [ "`depmod -A`" = "" ]
113 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
114 diff -u $MODULE_DIR/modules.pcimap.old $MODULE_DIR/modules.pcimap
115 diff -u $MODULE_DIR/modules.usbmap.old $MODULE_DIR/modules.usbmap
116 diff -u $MODULE_DIR/modules.ccwmap.old $MODULE_DIR/modules.ccwmap
117 diff -u $MODULE_DIR/modules.ieee1394map.old $MODULE_DIR/modules.ieee1394map
118 diff -u $MODULE_DIR/modules.isapnpmap.old $MODULE_DIR/modules.isapnpmap
119 diff -u $MODULE_DIR/modules.inputmap.old $MODULE_DIR/modules.inputmap
120 diff -u $MODULE_DIR/modules.ofmap.old $MODULE_DIR/modules.ofmap
122 [ "`depmod -e -A`" = "" ]
123 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
124 diff -u $MODULE_DIR/modules.pcimap.old $MODULE_DIR/modules.pcimap
125 diff -u $MODULE_DIR/modules.usbmap.old $MODULE_DIR/modules.usbmap
126 diff -u $MODULE_DIR/modules.ccwmap.old $MODULE_DIR/modules.ccwmap
127 diff -u $MODULE_DIR/modules.ieee1394map.old $MODULE_DIR/modules.ieee1394map
128 diff -u $MODULE_DIR/modules.isapnpmap.old $MODULE_DIR/modules.isapnpmap
129 diff -u $MODULE_DIR/modules.inputmap.old $MODULE_DIR/modules.inputmap
130 diff -u $MODULE_DIR/modules.ofmap.old $MODULE_DIR/modules.ofmap
132 [ "`depmod -e -A $MODTEST_VERSION`" = "" ]
133 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
134 diff -u $MODULE_DIR/modules.pcimap.old $MODULE_DIR/modules.pcimap
135 diff -u $MODULE_DIR/modules.usbmap.old $MODULE_DIR/modules.usbmap
136 diff -u $MODULE_DIR/modules.ccwmap.old $MODULE_DIR/modules.ccwmap
137 diff -u $MODULE_DIR/modules.ieee1394map.old $MODULE_DIR/modules.ieee1394map
138 diff -u $MODULE_DIR/modules.isapnpmap.old $MODULE_DIR/modules.isapnpmap
139 diff -u $MODULE_DIR/modules.inputmap.old $MODULE_DIR/modules.inputmap
140 diff -u $MODULE_DIR/modules.ofmap.old $MODULE_DIR/modules.ofmap
142 # We expect the same from -n.
143 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
145 # Stdout versions.
146 depmod -n | grep -v '^#' > tests/tmp/stdout
147 diff -u tests/tmp/out tests/tmp/stdout
149 depmod -a -n | grep -v '^#' > $MODULE_DIR/modules.dep
150 diff -u tests/tmp/out tests/tmp/stdout
152 depmod -n -a $MODTEST_VERSION | grep -v '^#' > $MODULE_DIR/modules.dep
153 diff -u tests/tmp/out tests/tmp/stdout
155 depmod -e -n -A $MODTEST_VERSION | grep -v '^#' > $MODULE_DIR/modules.dep
156 diff -u tests/tmp/out tests/tmp/stdout
158 done
159 done