depmod: fix tabs in help output
[module-init-tools.git] / tests / test-modinfo / 04compressed.sh
blobafc09308a82199965e2e3923de63668ca7a05ff0
1 #! /bin/sh
2 # Test modinfo extraction on compressed modules.
4 [ -n "$CONFIG_HAVE_ZLIB" ] || exit 0
6 for ENDIAN in $TEST_ENDIAN; do
7 for BITNESS in $TEST_BITS; do
9 rm -rf tests/tmp/*
11 # Copy modules instead of linking, so we can compress them
12 MODULE_DIR=tests/tmp/lib/modules/$MODTEST_UNAME
13 mkdir -p $MODULE_DIR
14 cp tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko \
15 $MODULE_DIR
17 gzip $MODULE_DIR/modinfo-$BITNESS.ko
19 echo "/lib/modules/$MODTEST_UNAME/modinfo-$BITNESS.ko.gz: /lib/modules/$MODTEST_UNAME/modinfo-crap-$BITNESS.ko.gz" > $MODULE_DIR/modules.dep
21 # Test individual field extraction: by module search and abs. path
22 for file in modinfo-$BITNESS $MODULE_DIR/modinfo-$BITNESS.ko.gz; do
23 [ "`modinfo -F randomcrap $file 2>&1`" = "my random crap which I use to test stuff with" ]
24 [ "`modinfo -F vermagic $file 2>&1`" = "my magic" ]
25 [ "`modinfo -F author $file 2>&1`" = "AUTHOR" ]
26 [ "`modinfo -F description $file 2>&1`" = "DESCRIPTION" ]
27 [ "`modinfo -F alias $file 2>&1`" = "ALIAS1
28 ALIAS2" ] || [ "`modinfo -F alias $file 2>&1`" = "ALIAS2
29 ALIAS1" ]
30 [ "`modinfo -F parm $file 2>&1`" = "foo:The number of foos on the card
31 described:A well-described parameter" ] ||
32 [ "`modinfo -F parm $file 2>&1`" = "described:A well-described parameter
33 foo:The number of foos on the card" ]
35 [ "`modinfo -F parmtype $file 2>&1`" = "described:uint
36 undescribed:int" ] ||
37 [ "`modinfo -F parmtype $file 2>&1`" = "undescribed:int
38 described:uint" ]
39 [ "`modinfo -F unknown $file 2>&1`" = "" ]
40 done
42 # Test multiple modules on cmdline.
43 [ "`modinfo -F vermagic $MODULE_DIR/modinfo-$BITNESS.ko.gz $MODULE_DIR/modinfo-$BITNESS.ko.gz 2>&1`" = "my magic
44 my magic" ]
46 # Test 0-fill
47 [ "`modinfo -0 -F alias $MODULE_DIR/modinfo-$BITNESS.ko.gz 2>&1 | tr '\000' @`" = "ALIAS1@ALIAS2@" ]
49 done
50 done