2 # Test modinfo extraction on compressed modules.
4 [ -n "$CONFIG_HAVE_ZLIB" ] ||
exit 0
6 for ENDIAN
in -le -be; do
7 for BITNESS
in 32 64; do
9 gzip < tests
/data
/$BITNESS$ENDIAN/modinfo
/modinfo-
$BITNESS.ko
> tests
/tmp
/modinfo-
$BITNESS.ko.gz
12 MODTEST_OVERRIDE1
=/lib
/modules
/$MODTEST_UNAME/modules.dep
13 MODTEST_OVERRIDE_WITH1
=tests
/tmp
/modules.dep
14 export MODTEST_OVERRIDE1 MODTEST_OVERRIDE_WITH1
16 MODTEST_OVERRIDE2
=/lib
/modules
/$MODTEST_UNAME/modinfo-
$BITNESS.ko.gz
17 MODTEST_OVERRIDE_WITH2
=tests
/tmp
/modinfo-
$BITNESS.ko.gz
18 export MODTEST_OVERRIDE2 MODTEST_OVERRIDE_WITH2
20 echo "/lib/modules/$MODTEST_UNAME/modinfo-$BITNESS.ko.gz: /lib/modules/$MODTEST_UNAME/modinfo-crap-$BITNESS.ko.gz" > tests
/tmp
/modules.dep
22 # Test individual field extraction: by module search and abs. path
23 for file in modinfo-
$BITNESS tests
/tmp
/modinfo-
$BITNESS.ko.gz
; do
24 [ "`./modinfo -F randomcrap $file 2>&1`" = "my random crap which I use to test stuff with" ]
25 [ "`./modinfo -F vermagic $file 2>&1`" = "my magic" ]
26 [ "`./modinfo -F author $file 2>&1`" = "AUTHOR" ]
27 [ "`./modinfo -F description $file 2>&1`" = "DESCRIPTION" ]
28 [ "`./modinfo -F alias $file 2>&1`" = "ALIAS1
29 ALIAS2" ] ||
[ "`modinfo -F alias $file 2>&1`" = "ALIAS2
31 [ "`./modinfo -F parm $file 2>&1`" = "foo:The number of foos on the card
32 described:A well-described parameter" ] ||
33 [ "`./modinfo -F parm $file 2>&1`" = "described:A well-described parameter
34 foo:The number of foos on the card" ]
36 [ "`./modinfo -F parmtype $file 2>&1`" = "described:uint
38 [ "`./modinfo -F parmtype $file 2>&1`" = "undescribed:int
40 [ "`./modinfo -F unknown $file 2>&1`" = "" ]
43 # Test multiple modules on cmdline.
44 [ "`./modinfo -F vermagic tests/tmp/modinfo-$BITNESS.ko.gz tests/tmp/modinfo-$BITNESS.ko.gz 2>&1`" = "my magic
48 [ "`./modinfo -0 -F alias tests/tmp/modinfo-$BITNESS.ko.gz 2>&1 | tr '\000' @`" = "ALIAS1@ALIAS2@" ]