[PATCH 04/14] tests: test new modprobe features

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Keegan McAllister <keegan@xxxxxxxxxxx>
---
 tests/test-modprobe/29moduledir.sh  |   34 ++++++++++++++++++++++++++++++++++
 tests/test-modprobe/30brokenlink.sh |   25 +++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 0 deletions(-)
 create mode 100755 tests/test-modprobe/29moduledir.sh
 create mode 100755 tests/test-modprobe/30brokenlink.sh

diff --git a/tests/test-modprobe/29moduledir.sh b/tests/test-modprobe/29moduledir.sh
new file mode 100755
index 0000000..5fa1b79
--- /dev/null
+++ b/tests/test-modprobe/29moduledir.sh
@@ -0,0 +1,34 @@
+#! /bin/sh
+# Test the 'moduledir' config option
+
+BITNESS=32
+
+rm -rf tests/tmp/*
+
+MODULE_DIR=tests/tmp/not_lib/modules/$MODTEST_UNAME
+mkdir -p $MODULE_DIR
+touch $MODULE_DIR/modules.dep
+
+# Create a simple config file.
+mkdir -p tests/tmp/etc/modprobe.d
+cat > tests/tmp/etc/modprobe.d/modprobe.conf <<EOF
+moduledir /not_lib/modules
+install export_nodep-$BITNESS echo Installing export_nodep
+EOF
+
+[ "`modprobe foo 2>&1`" = "FATAL: Module foo not found." ]
+
+# Create inputs
+ln tests/data/$BITNESS/normal/export_nodep-$BITNESS.ko \
+   $MODULE_DIR
+
+# Now create modules.dep
+cat > $MODULE_DIR/modules.dep <<EOF
+export_nodep-$BITNESS.ko:
+EOF
+
+# Empty /sys/module/ for install commands
+mkdir -p tests/tmp/sys/module
+
+# Test install
+[ "`modprobe export_nodep-$BITNESS 2>&1`" = "SYSTEM: echo Installing export_nodep" ]
diff --git a/tests/test-modprobe/30brokenlink.sh b/tests/test-modprobe/30brokenlink.sh
new file mode 100755
index 0000000..4aa4019
--- /dev/null
+++ b/tests/test-modprobe/30brokenlink.sh
@@ -0,0 +1,25 @@
+#! /bin/sh
+# Test that config files which are broken symlinks are ignored
+
+rm -rf tests/tmp/*
+
+MODULE_DIR=tests/tmp/lib/modules/$MODTEST_UNAME
+mkdir -p $MODULE_DIR
+touch $MODULE_DIR/modules.dep
+
+# Create a broken symlink in the config dir
+mkdir -p tests/tmp/etc/modprobe.d
+ln -s this_file_does_not_exist tests/tmp/etc/modprobe.d/broken.conf
+
+# Test without verbose
+[ "`modprobe foo 2>&1`" = "FATAL: Module foo not found." ]
+
+# Test with verbose
+[ "`modprobe -v foo 2>&1`" = "WARNING: Config file does not actually exist (broken symlink?): broken.conf
+FATAL: Module foo not found." ]
+
+# Test a file broken in a different way
+touch tests/tmp/etc/modprobe.d/noperm.conf
+chmod 000 tests/tmp/etc/modprobe.d/noperm.conf
+[ "`modprobe foo 2>&1`" = "WARNING: Failed to open config file noperm.conf: Permission denied
+FATAL: Module foo not found." ]
-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux