2 # Test modinfo extraction on compressed modules.
4 [ -n "$CONFIG_HAVE_ZLIB" ] ||
exit 0
6 for ENDIAN
in $TEST_ENDIAN; do
7 for BITNESS
in $TEST_BITS; do
11 # Copy modules instead of linking, so we can compress them
12 MODULE_DIR
=tests
/tmp
/lib
/modules
/$MODTEST_UNAME
14 cp tests
/data
/$BITNESS$ENDIAN/modinfo
/modinfo-
$BITNESS.ko \
17 gzip $MODULE_DIR/modinfo-
$BITNESS.ko
19 echo "/lib/modules/$MODTEST_UNAME/modinfo-$BITNESS.ko.gz: /lib/modules/$MODTEST_UNAME/modinfo-crap-$BITNESS.ko.gz" > $MODULE_DIR/modules.dep
21 # Test individual field extraction: by module search and abs. path
22 for file in modinfo-
$BITNESS $MODULE_DIR/modinfo-
$BITNESS.ko.gz
; do
23 [ "`modinfo -F randomcrap $file 2>&1`" = "my random crap which I use to test stuff with" ]
24 [ "`modinfo -F vermagic $file 2>&1`" = "my magic" ]
25 [ "`modinfo -F author $file 2>&1`" = "AUTHOR" ]
26 [ "`modinfo -F description $file 2>&1`" = "DESCRIPTION" ]
27 [ "`modinfo -F alias $file 2>&1`" = "ALIAS1
28 ALIAS2" ] ||
[ "`modinfo -F alias $file 2>&1`" = "ALIAS2
30 [ "`modinfo -F parm $file 2>&1`" = "foo:The number of foos on the card
31 described:A well-described parameter" ] ||
32 [ "`modinfo -F parm $file 2>&1`" = "described:A well-described parameter
33 foo:The number of foos on the card" ]
35 [ "`modinfo -F parmtype $file 2>&1`" = "described:uint
37 [ "`modinfo -F parmtype $file 2>&1`" = "undescribed:int
39 [ "`modinfo -F unknown $file 2>&1`" = "" ]
42 # Test multiple modules on cmdline.
43 [ "`modinfo -F vermagic $MODULE_DIR/modinfo-$BITNESS.ko.gz $MODULE_DIR/modinfo-$BITNESS.ko.gz 2>&1`" = "my magic
47 [ "`modinfo -0 -F alias $MODULE_DIR/modinfo-$BITNESS.ko.gz 2>&1 | tr '\000' @`" = "ALIAS1@ALIAS2@" ]