depmod: fix tabs in help output
[module-init-tools.git] / tests / test-modprobe / 26blacklist.sh
blob482ee9356c03dd3c1c8df811497253e44e475850
1 #! /bin/sh
2 # Test for blacklist usage.
4 BITNESS=32
6 rm -rf tests/tmp/*
8 # Create inputs
9 MODULE_DIR=tests/tmp/lib/modules/$MODTEST_UNAME
10 mkdir -p $MODULE_DIR/kernel
11 ln tests/data/$BITNESS/alias/alias-$BITNESS.ko \
12 $MODULE_DIR/kernel
14 SIZE=`wc -c < tests/data/$BITNESS/alias/alias-$BITNESS.ko`
16 echo "/lib/modules/$MODTEST_UNAME/kernel/alias-$BITNESS.ko:" > $MODULE_DIR/modules.dep
17 echo "/lib/modules/$MODTEST_UNAME/kernel/foo.ko:" >> $MODULE_DIR/modules.dep
18 cp tests/data/$BITNESS/complex/complex_a-$BITNESS.ko $MODULE_DIR/kernel/foo.ko
19 SIZE2=`wc -c < $MODULE_DIR/kernel/foo.ko`
21 # First, alias found in modules.alias works.
22 echo "alias bar alias-$BITNESS" > $MODULE_DIR/modules.alias
23 [ "`modprobe bar 2>&1`" = "INIT_MODULE: $SIZE " ]
25 # Blacklist makes it fail.
26 mkdir -p tests/tmp/etc/modprobe.d
27 echo "blacklist alias-$BITNESS" > tests/tmp/etc/modprobe.d/modprobe.conf
28 [ "`modprobe bar 2>&1`" = "FATAL: Module bar not found." ]
30 # Blacklist doesn't effect other aliases.
31 echo "alias bar foo" >> $MODULE_DIR/modules.alias
32 [ "`modprobe bar 2>&1`" = "INIT_MODULE: $SIZE2 " ]
34 # Blacklist both.
35 echo "blacklist foo" >> tests/tmp/etc/modprobe.d/modprobe.conf
36 [ "`modprobe bar 2>&1`" = "FATAL: Module bar not found." ]
38 # Remove blacklist, all works.
39 rm -f tests/tmp/etc/modprobe.d/modprobe.conf
40 RESULT="`modprobe bar 2>&1`"
41 [ "$RESULT" = "INIT_MODULE: $SIZE
42 INIT_MODULE: $SIZE2 " ] || [ "$RESULT" = "INIT_MODULE: $SIZE2
43 INIT_MODULE: $SIZE " ]