depmod: fix return in sort_modules
[mit.git] / tests / test-modinfo / 04compressed.sh
blob90d5701dc3baff86fc86192eb1a9de614b25c16a
1 #! /bin/sh
2 # Test modinfo extraction on compressed modules.
4 [ -n "$CONFIG_HAVE_ZLIB" ] || exit 0
6 for ENDIAN in -le -be; do
7 for BITNESS in 32 64; do
9 gzip < tests/data/$BITNESS$ENDIAN/modinfo/modinfo-$BITNESS.ko > tests/tmp/modinfo-$BITNESS.ko.gz
11 # Inputs
12 MODTEST_OVERRIDE1=/lib/modules/$MODTEST_UNAME/modules.dep
13 MODTEST_OVERRIDE_WITH1=tests/tmp/modules.dep
14 export MODTEST_OVERRIDE1 MODTEST_OVERRIDE_WITH1
16 MODTEST_OVERRIDE2=/lib/modules/$MODTEST_UNAME/modinfo-$BITNESS.ko.gz
17 MODTEST_OVERRIDE_WITH2=tests/tmp/modinfo-$BITNESS.ko.gz
18 export MODTEST_OVERRIDE2 MODTEST_OVERRIDE_WITH2
20 echo "/lib/modules/$MODTEST_UNAME/modinfo-$BITNESS.ko.gz: /lib/modules/$MODTEST_UNAME/modinfo-crap-$BITNESS.ko.gz" > tests/tmp/modules.dep
22 # Test individual field extraction: by module search and abs. path
23 for file in modinfo-$BITNESS tests/tmp/modinfo-$BITNESS.ko.gz; do
24 [ "`./modinfo -F randomcrap $file 2>&1`" = "my random crap which I use to test stuff with" ]
25 [ "`./modinfo -F vermagic $file 2>&1`" = "my magic" ]
26 [ "`./modinfo -F author $file 2>&1`" = "AUTHOR" ]
27 [ "`./modinfo -F description $file 2>&1`" = "DESCRIPTION" ]
28 [ "`./modinfo -F alias $file 2>&1`" = "ALIAS1
29 ALIAS2" ] || [ "`modinfo -F alias $file 2>&1`" = "ALIAS2
30 ALIAS1" ]
31 [ "`./modinfo -F parm $file 2>&1`" = "foo:The number of foos on the card
32 described:A well-described parameter" ] ||
33 [ "`./modinfo -F parm $file 2>&1`" = "described:A well-described parameter
34 foo:The number of foos on the card" ]
36 [ "`./modinfo -F parmtype $file 2>&1`" = "described:uint
37 undescribed:int" ] ||
38 [ "`./modinfo -F parmtype $file 2>&1`" = "undescribed:int
39 described:uint" ]
40 [ "`./modinfo -F unknown $file 2>&1`" = "" ]
41 done
43 # Test multiple modules on cmdline.
44 [ "`./modinfo -F vermagic tests/tmp/modinfo-$BITNESS.ko.gz tests/tmp/modinfo-$BITNESS.ko.gz 2>&1`" = "my magic
45 my magic" ]
47 # Test 0-fill
48 [ "`./modinfo -0 -F alias tests/tmp/modinfo-$BITNESS.ko.gz 2>&1 | tr '\000' @`" = "ALIAS1@ALIAS2@" ]
50 done
51 done