1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
#! /bin/sh
# Test various config file errors.
rm -rf tests/tmp/*
MODULE_DIR=tests/tmp/lib/modules/$MODTEST_UNAME
mkdir -p $MODULE_DIR
touch $MODULE_DIR/modules.dep
# Test bad alias syntax
mkdir -p tests/tmp/etc/modprobe.d
cat > tests/tmp/etc/modprobe.d/modprobe.conf <<EOF
alias
alias foo
EOF
[ "`modprobe foo 2>&1`" = "WARNING: /etc/modprobe.d/modprobe.conf line 1: ignoring bad line starting with 'alias'
WARNING: /etc/modprobe.d/modprobe.conf line 2: ignoring bad line starting with 'alias'
FATAL: Module foo not found." ]
# Bad option syntax
cat > tests/tmp/etc/modprobe.d/modprobe.conf <<EOF
options
options foo
EOF
[ "`modprobe foo 2>&1`" = "WARNING: /etc/modprobe.d/modprobe.conf line 1: ignoring bad line starting with 'options'
WARNING: /etc/modprobe.d/modprobe.conf line 2: ignoring bad line starting with 'options'
FATAL: Module foo not found." ]
# Bad include syntax
cat > tests/tmp/etc/modprobe.d/modprobe.conf <<EOF
include
EOF
[ "`modprobe foo 2>&1`" = "WARNING: /etc/modprobe.d/modprobe.conf line 1: ignoring bad line starting with 'include'
FATAL: Module foo not found." ]
# Bad install syntax
cat > tests/tmp/etc/modprobe.d/modprobe.conf <<EOF
install
install foo
EOF
[ "`modprobe foo 2>&1`" = "WARNING: /etc/modprobe.d/modprobe.conf line 1: ignoring bad line starting with 'install'
WARNING: /etc/modprobe.d/modprobe.conf line 2: ignoring bad line starting with 'install'
FATAL: Module foo not found." ]
# Bad remove syntax
cat > tests/tmp/etc/modprobe.d/modprobe.conf <<EOF
remove
remove foo
EOF
[ "`modprobe foo 2>&1`" = "WARNING: /etc/modprobe.d/modprobe.conf line 1: ignoring bad line starting with 'remove'
WARNING: /etc/modprobe.d/modprobe.conf line 2: ignoring bad line starting with 'remove'
FATAL: Module foo not found." ]
# Complete junk
cat > tests/tmp/etc/modprobe.d/modprobe.conf <<EOF
complete junk and stuff
rubbish
EOF
[ "`modprobe foo 2>&1`" = "WARNING: /etc/modprobe.d/modprobe.conf line 1: ignoring bad line starting with 'complete'
WARNING: /etc/modprobe.d/modprobe.conf line 2: ignoring bad line starting with 'rubbish'
FATAL: Module foo not found." ]
# Line numbering counted correctly.
echo "#comment" > tests/tmp/etc/modprobe.d/modprobe.conf
echo "remove" >> tests/tmp/etc/modprobe.d/modprobe.conf
[ "`modprobe foo 2>&1`" = "WARNING: /etc/modprobe.d/modprobe.conf line 2: ignoring bad line starting with 'remove'
FATAL: Module foo not found." ]
echo "" > tests/tmp/etc/modprobe.d/modprobe.conf
echo "remove" >> tests/tmp/etc/modprobe.d/modprobe.conf
[ "`modprobe foo 2>&1`" = "WARNING: /etc/modprobe.d/modprobe.conf line 2: ignoring bad line starting with 'remove'
FATAL: Module foo not found." ]
echo " # Comment" > tests/tmp/etc/modprobe.d/modprobe.conf
echo "remove" >> tests/tmp/etc/modprobe.d/modprobe.conf
[ "`modprobe foo 2>&1`" = "WARNING: /etc/modprobe.d/modprobe.conf line 2: ignoring bad line starting with 'remove'
FATAL: Module foo not found." ]
echo " # Comment \\" > tests/tmp/etc/modprobe.d/modprobe.conf
echo "with multiple lines" >> tests/tmp/etc/modprobe.d/modprobe.conf
echo "remove" >> tests/tmp/etc/modprobe.d/modprobe.conf
[ "`modprobe foo 2>&1`" = "WARNING: /etc/modprobe.d/modprobe.conf line 3: ignoring bad line starting with 'remove'
FATAL: Module foo not found." ]
echo "remove foo \\" > tests/tmp/etc/modprobe.d/modprobe.conf
echo " bar" >> tests/tmp/etc/modprobe.d/modprobe.conf
echo "remove" >> tests/tmp/etc/modprobe.d/modprobe.conf
[ "`modprobe foo 2>&1`" = "WARNING: /etc/modprobe.d/modprobe.conf line 3: ignoring bad line starting with 'remove'
FATAL: Module foo not found." ]
|