docs: don't forget to pass -I m4 to aclocal
[mit.git] / tests / test-modinfo / 03field.sh
blob55bdb8416cc1c820ca7c2e3ac819813fa2cb3523
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 # 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
27 ALIAS1" ]
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
34 undescribed:int" ] ||
35 [ "`modinfo -F parmtype $file 2>&1`" = "undescribed:int
36 described:uint" ]
37 [ "`modinfo -F unknown $file 2>&1`" = "" ]
38 done
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
48 my magic" ]
50 # Test 0-fill
51 [ "`modinfo -0 -F alias tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko 2>&1 | tr '\000' @`" = "ALIAS1@ALIAS2@" ]
53 done
54 done