2 # Test for modules.alias usage.
9 MODULE_DIR
=tests
/tmp
/lib
/modules
/$MODTEST_UNAME
10 mkdir
-p $MODULE_DIR/kernel
11 ln tests
/data
/$BITNESS/alias
/alias-
$BITNESS.ko \
14 SIZE
=`wc -c < tests/data/$BITNESS/alias/alias-$BITNESS.ko`
16 echo "alias_$BITNESS /lib/modules/$MODTEST_UNAME/kernel/alias-$BITNESS.ko:" > $MODULE_DIR/modules.dep.bin.temp
17 echo "foo /lib/modules/$MODTEST_UNAME/kernel/foo.ko:" >> $MODULE_DIR/modules.dep.bin.temp
18 modindex
-o $MODULE_DIR/modules.dep.bin
< $MODULE_DIR/modules.dep.bin.temp
20 rm -f $MODULE_DIR/modules.
alias
21 rm -f $MODULE_DIR/modules.
alias.bin
22 rm -f tests
/tmp
/etc
/modprobe.d
/modprobe.conf
24 cp tests
/data
/$BITNESS/complex
/complex_a-
$BITNESS.ko
$MODULE_DIR/kernel
/foo.ko
25 SIZE2
=`wc -c < $MODULE_DIR/kernel/foo.ko`
27 # Shouldn't complain if can't open modules.alias
28 [ "`modprobe bar 2>&1`" = "FATAL: Module bar not found." ]
30 # Now, alias found in modules.alias works.
31 echo "bar alias_$BITNESS" > $MODULE_DIR/modules.
alias.bin.temp
32 modindex
-o $MODULE_DIR/modules.
alias.bin
< $MODULE_DIR/modules.
alias.bin.temp
33 [ "`modprobe bar 2>&1`" = "INIT_MODULE: $SIZE " ]
35 # Normal alias should override it.
36 mkdir
-p tests
/tmp
/etc
/modprobe.d
37 echo 'alias bar foo' > tests
/tmp
/etc
/modprobe.d
/modprobe.conf
38 [ "`modprobe foo 2>&1`" = "INIT_MODULE: $SIZE2 " ]
40 # If there's a real module, alias from modules.alias must NOT override.
41 echo "foo alias_$BITNESS" > $MODULE_DIR/modules.
alias.bin.temp
42 modindex
-o $MODULE_DIR/modules.
alias.bin
< $MODULE_DIR/modules.
alias.bin.temp
43 [ "`modprobe foo 2>&1`" = "INIT_MODULE: $SIZE2 " ]
45 # If there's an install command, modules.alias must not override.
46 echo 'install bar echo foo' > tests
/tmp
/etc
/modprobe.d
/modprobe.conf
47 [ "`modprobe bar 2>&1`" = "SYSTEM: echo foo" ]
48 echo 'remove bar echo foo remove' > tests
/tmp
/etc
/modprobe.d
/modprobe.conf
49 [ "`modprobe -r bar 2>&1`" = "SYSTEM: echo foo remove" ]
51 # Should gather up options from other alias name as well.
52 echo "bar alias_$BITNESS" > $MODULE_DIR/modules.
alias.bin.temp
53 modindex
-o $MODULE_DIR/modules.
alias.bin
< $MODULE_DIR/modules.
alias.bin.temp
54 echo "options bar option1" > tests
/tmp
/etc
/modprobe.d
/modprobe.conf
55 echo "options alias_$BITNESS option2" >> tests
/tmp
/etc
/modprobe.d
/modprobe.conf
56 [ "`modprobe bar 2>&1`" = "INIT_MODULE: $SIZE option2 option1" ]
58 # Duplicated alias: both get probed (either order)
59 echo "bar foo" >> $MODULE_DIR/modules.
alias.bin.temp
60 modindex
-o $MODULE_DIR/modules.
alias.bin
< $MODULE_DIR/modules.
alias.bin.temp
61 OUT
="`modprobe bar 2>&1`"
63 [ "$OUT" = "INIT_MODULE: $SIZE option2 option1
64 INIT_MODULE: $SIZE2 option1" ] ||
[ "$OUT" = "INIT_MODULE: $SIZE2 option1
65 INIT_MODULE: $SIZE option2 option1" ]