depmod: fix tabs in help output
[module-init-tools.git] / tests / test-depmod / 13compressed-maps.sh
blob0a991aca590665983517fd46b79e004e45f90e0e
1 #! /bin/sh
2 # Test of generation of 32-bit and 64-bit maps, gzipped modules.
4 [ -n "$CONFIG_HAVE_ZLIB" ] || exit 0
6 for ENDIAN in $TEST_ENDIAN; do
7 for BITNESS in $TEST_BITS; do
9 rm -rf tests/tmp/*
11 mkdir tests/tmp/data
12 for f in tests/data/$BITNESS$ENDIAN/map/*.ko; do
13 gzip < $f > tests/tmp/data/`basename $f .ko`.ko.gz
14 done
17 rm -rf tests/tmp/*
19 # Copy modules instead of linking, so we can compress them
20 MODULE_DIR=tests/tmp/lib/modules/$MODTEST_UNAME
21 mkdir -p $MODULE_DIR
22 cp tests/data/$BITNESS$ENDIAN/map/ccw_map-$BITNESS.ko \
23 tests/data/$BITNESS$ENDIAN/map/pci_map-$BITNESS.ko \
24 tests/data/$BITNESS$ENDIAN/map/usb_map-$BITNESS.ko \
25 tests/data/$BITNESS$ENDIAN/map/ieee1394_map-$BITNESS.ko \
26 tests/data/$BITNESS$ENDIAN/map/pnp_map-$BITNESS.ko \
27 tests/data/$BITNESS$ENDIAN/map/input_map-$BITNESS.ko \
28 tests/data/$BITNESS$ENDIAN/map/of_map-$BITNESS.ko \
29 tests/data/$BITNESS$ENDIAN/map/input_map_new-$BITNESS.ko \
30 $MODULE_DIR
31 gzip `find $MODULE_DIR -name '*.ko'`
33 touch tests/tmp/empty
35 # Expect no output.
36 [ "`depmod`" = "" ]
38 # Check PCI: expect 2 lines
39 [ `grep -vc '^#' < $MODULE_DIR/modules.pcimap` = 2 ]
41 [ "`grep pci_map $MODULE_DIR/modules.pcimap`" = "pci_map-$BITNESS 0x00000001 0x00000002 0x00000003 0x00000004 0x00000005 0x00000006 0x0
42 pci_map-$BITNESS 0x0000000b 0x0000000c 0x0000000d 0x0000000e 0x0000000f 0x00000010 0x0" ]
44 # Check USB: expect 2 lines
45 [ `grep -vc '^#' < $MODULE_DIR/modules.usbmap` = 2 ]
47 [ "`grep usb_map $MODULE_DIR/modules.usbmap`" = "usb_map-$BITNESS 0x0001 0x0002 0x0003 0x0004 0x0005 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0
48 usb_map-$BITNESS 0x000b 0x000c 0x000d 0x000e 0x000f 0x10 0x11 0x12 0x13 0x14 0x15 0x0" ]
50 # Check CCW: expect 2 lines
51 [ `grep -vc '^#' < $MODULE_DIR/modules.ccwmap` = 2 ]
53 [ "`grep ccw_map $MODULE_DIR/modules.ccwmap`" = "ccw_map-$BITNESS 0x000f 0x0001 0x03 0x0002 0x04
54 ccw_map-$BITNESS 0x000f 0x000b 0x0d 0x000c 0x0e" ]
56 # Check ieee1394: expect 2 lines
57 [ `grep -vc '^#' < $MODULE_DIR/modules.ieee1394map` = 2 ]
59 #%-20s 0x%08x 0x%06x 0x%06x 0x%06x 0x%06x\n",
60 #+ name, fw->match_flags, fw->vendor_id, fw->model_id,
61 #+ fw->specifier_id, fw->version);
62 [ "`grep ieee1394_map $MODULE_DIR/modules.ieee1394map`" = "ieee1394_map-$BITNESS 0x0000000c 0x000000 0x000000 0x00a02d 0x010001
63 ieee1394_map-$BITNESS 0x0000000c 0x000000 0x000000 0x00a02d 0x000100" ]
65 # Check input: expect 4 lines
66 [ `grep -vc '^#' < $MODULE_DIR/modules.inputmap` = 4 ]
68 # module matchBits bustype vendor product version evBits keyBits relBits absBits mscBits ledBits sndBits ffBits [swBits] driver_info
69 [ "`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
70 input_map_new-$BITNESS 0x10 0x0 0x0 0x0 0x0 40000 0 0 0 0 0 0 0 0 0x0
71 input_map-$BITNESS 0x10 0x0 0x0 0x0 0x0 2 0 0 0 0 0 0 0 0x0
72 input_map-$BITNESS 0x10 0x0 0x0 0x0 0x0 40000 0 0 0 0 0 0 0 0x0" ] || [ "`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" ]
77 # Check of: expect 7 lines
78 [ `grep -vc '^#' < $MODULE_DIR/modules.ofmap` = 7 ]
80 # of module name type compatible
81 [ "`grep of_map $MODULE_DIR/modules.ofmap`" = "of_map-$BITNESS test_name_1 * *
82 of_map-$BITNESS * test_type_1 *
83 of_map-$BITNESS * * test_compat_1
84 of_map-$BITNESS test_name_2 test_type_2 *
85 of_map-$BITNESS test_name_3 * test_compat_2
86 of_map-$BITNESS * test_type_3 test_compat_3
87 of_map-$BITNESS test_name_4 test_type_4 test_compat_4" ]
89 mv $MODULE_DIR/modules.dep $MODULE_DIR/modules.dep.old
90 mv $MODULE_DIR/modules.pcimap $MODULE_DIR/modules.pcimap.old
91 mv $MODULE_DIR/modules.usbmap $MODULE_DIR/modules.usbmap.old
92 mv $MODULE_DIR/modules.ccwmap $MODULE_DIR/modules.ccwmap.old
93 mv $MODULE_DIR/modules.ieee1394map $MODULE_DIR/modules.ieee1394map.old
94 mv $MODULE_DIR/modules.isapnpmap $MODULE_DIR/modules.isapnpmap.old
95 mv $MODULE_DIR/modules.inputmap $MODULE_DIR/modules.inputmap.old
96 mv $MODULE_DIR/modules.ofmap $MODULE_DIR/modules.ofmap.old
98 # Synonyms
99 [ "`depmod -a`" = "" ]
100 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
101 diff -u $MODULE_DIR/modules.pcimap.old $MODULE_DIR/modules.pcimap
102 diff -u $MODULE_DIR/modules.usbmap.old $MODULE_DIR/modules.usbmap
103 diff -u $MODULE_DIR/modules.ccwmap.old $MODULE_DIR/modules.ccwmap
104 diff -u $MODULE_DIR/modules.ieee1394map.old $MODULE_DIR/modules.ieee1394map
105 diff -u $MODULE_DIR/modules.isapnpmap.old $MODULE_DIR/modules.isapnpmap
106 diff -u $MODULE_DIR/modules.inputmap.old $MODULE_DIR/modules.inputmap
107 diff -u $MODULE_DIR/modules.ofmap.old $MODULE_DIR/modules.ofmap
109 [ "`depmod -A`" = "" ]
110 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
111 diff -u $MODULE_DIR/modules.pcimap.old $MODULE_DIR/modules.pcimap
112 diff -u $MODULE_DIR/modules.usbmap.old $MODULE_DIR/modules.usbmap
113 diff -u $MODULE_DIR/modules.ccwmap.old $MODULE_DIR/modules.ccwmap
114 diff -u $MODULE_DIR/modules.ieee1394map.old $MODULE_DIR/modules.ieee1394map
115 diff -u $MODULE_DIR/modules.isapnpmap.old $MODULE_DIR/modules.isapnpmap
116 diff -u $MODULE_DIR/modules.inputmap.old $MODULE_DIR/modules.inputmap
117 diff -u $MODULE_DIR/modules.ofmap.old $MODULE_DIR/modules.ofmap
119 [ "`depmod -e -F /empty -A`" = "" ]
120 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
121 diff -u $MODULE_DIR/modules.pcimap.old $MODULE_DIR/modules.pcimap
122 diff -u $MODULE_DIR/modules.usbmap.old $MODULE_DIR/modules.usbmap
123 diff -u $MODULE_DIR/modules.ccwmap.old $MODULE_DIR/modules.ccwmap
124 diff -u $MODULE_DIR/modules.ieee1394map.old $MODULE_DIR/modules.ieee1394map
125 diff -u $MODULE_DIR/modules.isapnpmap.old $MODULE_DIR/modules.isapnpmap
126 diff -u $MODULE_DIR/modules.inputmap.old $MODULE_DIR/modules.inputmap
127 diff -u $MODULE_DIR/modules.ofmap.old $MODULE_DIR/modules.ofmap
129 [ "`depmod -e -F /empty -A $MODTEST_VERSION`" = "" ]
130 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
131 diff -u $MODULE_DIR/modules.pcimap.old $MODULE_DIR/modules.pcimap
132 diff -u $MODULE_DIR/modules.usbmap.old $MODULE_DIR/modules.usbmap
133 diff -u $MODULE_DIR/modules.ccwmap.old $MODULE_DIR/modules.ccwmap
134 diff -u $MODULE_DIR/modules.ieee1394map.old $MODULE_DIR/modules.ieee1394map
135 diff -u $MODULE_DIR/modules.isapnpmap.old $MODULE_DIR/modules.isapnpmap
136 diff -u $MODULE_DIR/modules.inputmap.old $MODULE_DIR/modules.inputmap
137 diff -u $MODULE_DIR/modules.ofmap.old $MODULE_DIR/modules.ofmap
139 # We expect the same from -n.
140 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
142 # Stdout versions.
143 depmod -n | grep -v '^#' > tests/tmp/stdout
144 diff -u tests/tmp/out tests/tmp/stdout
146 depmod -a -n | grep -v '^#' > $MODULE_DIR/modules.dep
147 diff -u tests/tmp/out tests/tmp/stdout
149 depmod -n -a $MODTEST_VERSION | grep -v '^#' > $MODULE_DIR/modules.dep
150 diff -u tests/tmp/out tests/tmp/stdout
152 depmod -e -F /empty -n -A $MODTEST_VERSION | grep -v '^#' > $MODULE_DIR/modules.dep
153 diff -u tests/tmp/out tests/tmp/stdout
155 done
156 done