3 # Test modinfo extraction: works for *any* endiannes.
4 for ENDIAN
in -le -be; do
5 for BITNESS
in 32 64; do
10 MODULE_DIR
=tests
/tmp
/lib
/modules
/$MODTEST_UNAME
12 ln tests
/data
/$BITNESS$ENDIAN/modinfo
/modinfo-
$BITNESS.ko \
15 echo "/lib/modules/$MODTEST_UNAME/modinfo-$BITNESS.ko: /lib/modules/$MODTEST_UNAME/modinfo-crap-$BITNESS.ko" > $MODULE_DIR/modules.dep
17 # Test individual field extraction: by module search and abs. path
18 for file in modinfo-
$BITNESS tests
/data
/$BITNESS$ENDIAN/modinfo
/modinfo-
$BITNESS.ko
; do
19 [ "`modinfo -F randomcrap $file 2>&1`" = "my random crap which I use to test stuff with" ]
20 [ "`modinfo -F vermagic $file 2>&1`" = "my magic" ]
21 [ "`modinfo -F author $file 2>&1`" = "AUTHOR" ]
22 [ "`modinfo -a $file 2>&1`" = "AUTHOR" ]
23 [ "`modinfo -F description $file 2>&1`" = "DESCRIPTION" ]
24 [ "`modinfo -d $file 2>&1`" = "DESCRIPTION" ]
25 [ "`modinfo -F alias $file 2>&1`" = "ALIAS1
26 ALIAS2" ] ||
[ "`modinfo -F alias $file 2>&1`" = "ALIAS2
28 [ "`modinfo -F parm $file 2>&1`" = "foo:The number of foos on the card
29 described:A well-described parameter" ] ||
30 [ "`modinfo -F parm $file 2>&1`" = "described:A well-described parameter
31 foo:The number of foos on the card" ]
33 [ "`modinfo -F parmtype $file 2>&1`" = "described:uint
35 [ "`modinfo -F parmtype $file 2>&1`" = "undescribed:int
37 [ "`modinfo -F unknown $file 2>&1`" = "" ]
40 # Test filename output
41 [ "`modinfo -F filename modinfo-$BITNESS 2>&1`" = "/lib/modules/$MODTEST_UNAME/modinfo-$BITNESS.ko" ]
42 [ "`modinfo -n modinfo-$BITNESS 2>&1`" = "/lib/modules/$MODTEST_UNAME/modinfo-$BITNESS.ko" ]
43 [ "`modinfo -F filename tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko 2>&1`" = "tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko" ]
44 [ "`modinfo -n tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko 2>&1`" = "tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko" ]
46 # Test multiple modules on cmdline.
47 [ "`modinfo -F vermagic tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko 2>&1`" = "my magic
51 [ "`modinfo -0 -F alias tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko 2>&1 | tr '\000' @`" = "ALIAS1@ALIAS2@" ]