modindex: getopt_long returns int not char (fix ppc64 bug)
[mit.git] / tests / test-modprobe / 20oldstyle.sh
blob5e898dc0009332b34e16cf64b3f61e62ad2c38fd
1 #! /bin/sh
2 # Test old-style module crap.
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/drivers/type
11 ln tests/data/$BITNESS/normal/noexport_nodep-$BITNESS.ko \
12 $MODULE_DIR/drivers/type
14 mkdir -p $MODULE_DIR/other/type
15 ln tests/data/$BITNESS/normal/export_nodep-$BITNESS.ko \
16 $MODULE_DIR/other/type
18 # Set up modules.dep file.
19 echo "# A comment" > $MODULE_DIR/modules.dep
20 echo "/lib/modules/$MODTEST_UNAME/drivers/type/noexport_nodep-$BITNESS.ko:" >> $MODULE_DIR/modules.dep
21 echo "/lib/modules/$MODTEST_UNAME/other/type/export_nodep-$BITNESS.ko:" >> $MODULE_DIR/modules.dep
23 SIZE1=`wc -c < tests/data/$BITNESS/normal/noexport_nodep-$BITNESS.ko`
24 SIZE2=`wc -c < tests/data/$BITNESS/normal/export_nodep-$BITNESS.ko`
26 # -l lists all of them (either order)
27 [ "`modprobe -l 2>&1`" = "/lib/modules/$MODTEST_UNAME/drivers/type/noexport_nodep-$BITNESS.ko
28 /lib/modules/$MODTEST_UNAME/other/type/export_nodep-$BITNESS.ko" ] ||
29 [ "`modprobe -l 2>&1`" = "/lib/modules/$MODTEST_UNAME/other/type/export_nodep-$BITNESS.ko
30 /lib/modules/$MODTEST_UNAME/drivers/type/noexport_nodep-$BITNESS.ko" ]
32 # -l -t foo lists none of them.
33 [ "`modprobe -l -t foo 2>&1`" = "" ]
35 # -l -t type lists all of them (either order)
36 [ "`modprobe -l -t type 2>&1`" = "/lib/modules/$MODTEST_UNAME/drivers/type/noexport_nodep-$BITNESS.ko
37 /lib/modules/$MODTEST_UNAME/other/type/export_nodep-$BITNESS.ko" ] ||
38 [ "`modprobe -l -t type 2>&1`" = "/lib/modules/$MODTEST_UNAME/other/type/export_nodep-$BITNESS.ko
39 /lib/modules/$MODTEST_UNAME/drivers/type/noexport_nodep-$BITNESS.ko" ]
41 # -l -t drivers lists one.
42 [ "`modprobe -l -t drivers 2>&1`" = "/lib/modules/$MODTEST_UNAME/drivers/type/noexport_nodep-$BITNESS.ko" ]
44 # -l -t drivers/type lists one.
45 [ "`modprobe -l -t drivers/type 2>&1`" = "/lib/modules/$MODTEST_UNAME/drivers/type/noexport_nodep-$BITNESS.ko" ]
47 # -l -t other lists one.
48 [ "`modprobe -l -t other 2>&1`" = "/lib/modules/$MODTEST_UNAME/other/type/export_nodep-$BITNESS.ko" ]
50 # -l -t other/type lists one.
51 [ "`modprobe -l -t other/type 2>&1`" = "/lib/modules/$MODTEST_UNAME/other/type/export_nodep-$BITNESS.ko" ]
53 # Wildcard works.
54 [ "`modprobe -l -t type 'noexport-nodep*' 2>&1`" = "/lib/modules/$MODTEST_UNAME/drivers/type/noexport_nodep-$BITNESS.ko" ]
56 # -t type without -l not supported
57 modprobe -t type 2>&1 | grep -q Usage
58 modprobe -a -t type 2>&1 | grep -q Usage
60 # -a with one arg succeeds.
61 [ "`modprobe -a noexport_nodep-$BITNESS 2>&1`" = "INIT_MODULE: $SIZE1 " ]
62 # ... even with - and _ confused.
63 [ "`modprobe -a noexport-nodep_$BITNESS 2>&1`" = "INIT_MODULE: $SIZE1 " ]
65 # With two args succeeds.
66 [ "`modprobe -a noexport_nodep-$BITNESS export_nodep-$BITNESS 2>&1`" = "INIT_MODULE: $SIZE1
67 INIT_MODULE: $SIZE2 " ]
69 # Does second even if first screws up.
70 [ "`modprobe -a crap export_nodep-$BITNESS 2>&1`" = "WARNING: Module crap not found.
71 INIT_MODULE: $SIZE2 " ]