modindex: getopt_long returns int not char (fix ppc64 bug)
[mit.git] / tests / test-depmod / 11quick.sh
blob44bfd82d82c6632776cdc35ef74bf3b7024dcc0d
1 #! /bin/sh
2 # Check that -A works correctly.
4 ENDIAN=-le
5 BITNESS=32
7 rm -rf tests/tmp/*
9 # Copy modules instead of linking, so we can play with their timestamps.
10 MODULE_DIR=tests/tmp/lib/modules/$MODTEST_UNAME
11 mkdir -p $MODULE_DIR
12 cp 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 # First time, there is no modules.dep, so it will be generated.
20 # Expect no output.
21 [ "`depmod -A 2>&1`" = "" ]
23 # Check modules.dep results: expect 5 lines
24 [ `grep -vc '^#' < $MODULE_DIR/modules.dep` = 5 ]
26 [ "`grep -w export_dep-$BITNESS.ko: $MODULE_DIR/modules.dep`" = "export_dep-$BITNESS.ko: export_nodep-$BITNESS.ko" ]
27 [ "`grep -w noexport_dep-$BITNESS.ko: $MODULE_DIR/modules.dep`" = "noexport_dep-$BITNESS.ko: export_nodep-$BITNESS.ko" ]
28 [ "`grep -w export_nodep-$BITNESS.ko: $MODULE_DIR/modules.dep`" = "export_nodep-$BITNESS.ko:" ]
29 [ "`grep -w noexport_nodep-$BITNESS.ko: $MODULE_DIR/modules.dep`" = "noexport_nodep-$BITNESS.ko:" ]
30 [ "`grep -w noexport_doubledep-$BITNESS.ko: $MODULE_DIR/modules.dep`" = "noexport_doubledep-$BITNESS.ko: export_dep-$BITNESS.ko export_nodep-$BITNESS.ko" ]
32 # Check modules.symbols results: expect 3 lines
33 [ `grep -vc '^#' < $MODULE_DIR/modules.symbols` = 3 ]
35 [ "`grep -w symbol:exported1 $MODULE_DIR/modules.symbols`" = "alias symbol:exported1 export_nodep_$BITNESS" ]
36 [ "`grep -w symbol:exported2 $MODULE_DIR/modules.symbols`" = "alias symbol:exported2 export_nodep_$BITNESS" ]
37 [ "`grep -w symbol:exported3 $MODULE_DIR/modules.symbols`" = "alias symbol:exported3 export_dep_$BITNESS" ]
39 cp $MODULE_DIR/modules.dep $MODULE_DIR/modules.dep.old
40 cp $MODULE_DIR/modules.symbols $MODULE_DIR/modules.symbols.old
42 # Now, second run should do nothing.
43 cp /dev/null $MODULE_DIR/modules.dep
44 cp /dev/null $MODULE_DIR/modules.symbols
45 [ "`depmod -A 2>&1`" = "" ]
46 diff -u /dev/null $MODULE_DIR/modules.dep
47 diff -u /dev/null $MODULE_DIR/modules.symbols
49 # Touch a directory, nothing.
50 sleep 1
51 touch $MODULE_DIR
53 [ "`depmod -A 2>&1`" = "" ]
54 diff -u /dev/null $MODULE_DIR/modules.dep
55 diff -u /dev/null $MODULE_DIR/modules.symbols
57 # Touch a non-module, nothing.
58 echo "Test" > $MODULE_DIR/README
59 [ "`depmod -A 2>&1`" = "" ]
60 diff -u /dev/null $MODULE_DIR/modules.dep
61 diff -u /dev/null $MODULE_DIR/modules.symbols
63 # Touch a module, wham.
64 touch $MODULE_DIR/noexport_doubledep-$BITNESS.ko
65 [ "`depmod -A 2>&1`" = "" ]
66 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep
67 diff -u $MODULE_DIR/modules.symbols.old $MODULE_DIR/modules.symbols
69 # Deleting a module does nothing.
70 cp /dev/null $MODULE_DIR/modules.dep
71 cp /dev/null $MODULE_DIR/modules.symbols
72 rm $MODULE_DIR/noexport_doubledep-$BITNESS.ko
73 [ "`depmod -A 2>&1`" = "" ]
74 diff -u /dev/null $MODULE_DIR/modules.dep
75 diff -u /dev/null $MODULE_DIR/modules.symbols