modprobe: remove flock() because it never worked anyway
[mit.git] / tests / test-depmod / 08basedir.sh
blobaddb94d32186e07cf3cede05f4f534c1e7c332cd
1 #! /bin/sh
2 # Simple tests of generation of 32-bit and 64-bit modules.dep with basedir
4 for ENDIAN in -le -be; do
5 for BITNESS in 32 64; do
7 rm -rf tests/tmp/*
9 # Create inputs
10 MODULE_DIR=tests/tmp/BASEDIR/lib/modules/$MODTEST_UNAME
11 mkdir -p $MODULE_DIR
12 ln tests/data/$BITNESS$ENDIAN/normal/export_dep-$BITNESS.ko \
13 tests/data/$BITNESS$ENDIAN/normal/noexport_dep-$BITNESS.ko \
14 tests/data/$BITNESS$ENDIAN/normal/export_nodep-$BITNESS.ko \
15 tests/data/$BITNESS$ENDIAN/normal/noexport_nodep-$BITNESS.ko \
16 tests/data/$BITNESS$ENDIAN/normal/noexport_doubledep-$BITNESS.ko \
17 $MODULE_DIR
19 # Expect no output.
20 [ "`./depmod -b /BASEDIR 2>&1`" = "" ]
22 # Check results: expect 5 lines
23 [ `grep -vc '^#' < $MODULE_DIR/modules.dep` = 5 ]
25 [ "`grep -w export_dep-$BITNESS.ko: $MODULE_DIR/modules.dep`" = "export_dep-$BITNESS.ko: export_nodep-$BITNESS.ko" ]
26 [ "`grep -w noexport_dep-$BITNESS.ko: $MODULE_DIR/modules.dep`" = "noexport_dep-$BITNESS.ko: export_nodep-$BITNESS.ko" ]
27 [ "`grep -w export_nodep-$BITNESS.ko: $MODULE_DIR/modules.dep`" = "export_nodep-$BITNESS.ko:" ]
28 [ "`grep -w noexport_nodep-$BITNESS.ko: $MODULE_DIR/modules.dep`" = "noexport_nodep-$BITNESS.ko:" ]
29 [ "`grep -w noexport_doubledep-$BITNESS.ko: $MODULE_DIR/modules.dep`" = "noexport_doubledep-$BITNESS.ko: export_dep-$BITNESS.ko export_nodep-$BITNESS.ko" ]
31 mv $MODULE_DIR/modules.dep $MODULE_DIR/modules.dep.old
33 # Synonyms
34 [ "`./depmod -b /BASEDIR -a`" = "" ]
35 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
36 mv $MODULE_DIR/modules.dep $MODULE_DIR/modules.dep.old
38 [ "`./depmod -b /BASEDIR -A`" = "" ]
39 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
40 mv $MODULE_DIR/modules.dep $MODULE_DIR/modules.dep.old
42 [ "`./depmod -b /BASEDIR -e -A`" = "" ]
43 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
44 mv $MODULE_DIR/modules.dep $MODULE_DIR/modules.dep.old
46 [ "`./depmod -b /BASEDIR -e -A $MODTEST_VERSION`" = "" ]
47 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
48 mv $MODULE_DIR/modules.dep $MODULE_DIR/modules.dep.old
50 [ "`./depmod --basedir /BASEDIR -e -A $MODTEST_VERSION 2>&1`" = "" ]
51 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
52 mv $MODULE_DIR/modules.dep $MODULE_DIR/modules.dep.old
54 [ "`./depmod --basedir=/BASEDIR -e -A $MODTEST_VERSION`" = "" ]
55 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
56 mv $MODULE_DIR/modules.dep $MODULE_DIR/modules.dep.old
58 # Combined should form stdout versions.
59 grep -vh '^#' $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.symbols > $MODULE_DIR/modules.all.old
61 # Stdout versions.
62 ./depmod -b /BASEDIR -n | grep -v '^#' > $MODULE_DIR/modules.all
63 diff -u $MODULE_DIR/modules.all.old $MODULE_DIR/modules.all
64 mv $MODULE_DIR/modules.all $MODULE_DIR/modules.all.old
66 ./depmod -b /BASEDIR -a -n | grep -v '^#' > $MODULE_DIR/modules.all
67 diff -u $MODULE_DIR/modules.all.old $MODULE_DIR/modules.all
68 mv $MODULE_DIR/modules.all $MODULE_DIR/modules.all.old
70 ./depmod -b /BASEDIR -n -a $MODTEST_VERSION | grep -v '^#' > $MODULE_DIR/modules.all
71 diff -u $MODULE_DIR/modules.all.old $MODULE_DIR/modules.all
72 mv $MODULE_DIR/modules.all $MODULE_DIR/modules.all.old
74 ./depmod -b /BASEDIR -e -n -A $MODTEST_VERSION | grep -v '^#' > $MODULE_DIR/modules.all
75 diff -u $MODULE_DIR/modules.all.old $MODULE_DIR/modules.all
76 mv $MODULE_DIR/modules.all $MODULE_DIR/modules.all.old
78 done
79 done