docs: don't forget to pass -I m4 to aclocal
[mit.git] / tests / test-modinfo / 02all.sh
blobeee36fada72dce4a9e9c6c7cb394986255adee5a
1 #! /bin/sh
3 # Test modinfo extraction: works for *any* endiannes.
4 for ENDIAN in -le -be; do
5 for BITNESS in 32 64; do
7 rm -rf tests/tmp/*
9 # Create inputs
10 MODULE_DIR=tests/tmp/lib/modules/$MODTEST_UNAME
11 mkdir -p $MODULE_DIR
12 ln tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko \
13 $MODULE_DIR
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" ]
25 # Expect 10 lines.
26 OUTPUT=`modinfo tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko 2>&1`
27 [ `echo "$OUTPUT" | wc -l` -eq 10 ]
29 # Test each one.
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 ]
46 # Test 0-fill
47 [ "`modinfo -0 tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko 2>&1 | tr -dc '\000' | tr '\000' @`" = "@@@@@@@@@@" ]
49 done
50 done