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 # Found by reading modules.dep
18 OUTPUT1
=`modinfo modinfo-$BITNESS 2>&1 | md5sum`
19 # Found by absolute path.
20 OUTPUT2
=`modinfo /lib/modules/$MODTEST_UNAME/modinfo-$BITNESS.ko 2>&1 | md5sum`
22 # Same except for filename
23 [ x
"$OUTPUT1" = x
"$OUTPUT2" ]
26 OUTPUT
=`modinfo tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko 2>&1`
27 [ `echo "$OUTPUT" | wc -l` -eq 10 ]
30 [ "`echo "$OUTPUT" | grep filename`" = "filename: tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko" ]
31 [ "`echo "$OUTPUT" | grep vermagic`" = "vermagic: my magic" ]
32 [ "`echo "$OUTPUT" | grep author`" = "author: AUTHOR" ]
33 [ "`echo "$OUTPUT" | grep description`" = "description: DESCRIPTION" ]
34 [ "`echo "$OUTPUT" | grep ALIAS1`" = "alias: ALIAS1" ]
35 [ "`echo "$OUTPUT" | grep ALIAS2`" = "alias: ALIAS2" ]
36 [ "`echo "$OUTPUT" | grep foo`" = "parm: foo:The number of foos on the card" ]
37 [ "`echo "$OUTPUT" | grep ' described'`" = "parm: described:A well-described parameter (uint)" ]
38 [ "`echo "$OUTPUT" | grep ' undescribed'`" = "parm: undescribed:int" ]
40 # Test filename from modules.dep
41 [ "`modinfo modinfo-$BITNESS | grep filename`" = "filename: /lib/modules/$MODTEST_UNAME/modinfo-$BITNESS.ko" ]
43 # Test multiple modules on cmdline.
44 [ `modinfo tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko 2>&1 | wc -l` -eq 20 ]
47 [ "`modinfo -0 tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko 2>&1 | tr -dc '\000' | tr '\000' @`" = "@@@@@@@@@@" ]