tests: allow crc32c to be a built-in or have a different name

Alex Chiang achiang at hp.com
Thu Apr 17 19:55:31 PDT 2008


test/run.sh assumes that the CRC32c kernel library is:

	- a module
	- named crc32c

These assumptions may or may not be true, viz.:

	- it could be a built-in
	- it could be called libcrc32c (on ia64 this is so)

So let's give run.sh a little flexibility. First, we blindly try
to insmod crfs.ko. If that fails, then we guess that maybe the
crc32c lib isn't loaded, so modprobe it (under either name), and
then try the insmod again.

If the final insmod fails, then something is really wrong, and we
bail.

This adds a little noise to the test run output, but noise is
preferable to test suite abort due to bad assumptions.

Signed-off-by: Alex Chiang <achiang at hp.com>
---
diff -r fb4148080e26 -r 68b8a3de42aa tests/run.sh
--- a/tests/run.sh	Thu Apr 17 20:11:47 2008 -0600
+++ b/tests/run.sh	Thu Apr 17 20:46:24 2008 -0600
@@ -202,16 +202,19 @@ while ! listening; do
 	count=$((count + 1))
 done
 
-#sigh
-modprobe crc32c || \
-	fail "modprobe crc32c failed"
-
 # I like to see debugging warnings in the console, but
 # we can be smarter if this bothers people
 dmesg -n8
 
-insmod $topdir/lk/crfs.ko || \
-	fail "insmod $topdir/lk/crfs.ko failed"
+insmod $topdir/lk/crfs.ko
+if [ $? != 0 ]; then
+	#sigh
+	modprobe crc32c || modprobe libcrc32c || \
+		fail "modprobe crc32c failed"
+
+	insmod $topdir/lk/crfs.ko || \
+		fail "insmod $topdir/lk/crfs.ko failed"
+fi
 
 if [ -n "$debugging" ]; then
 	if ! check_mounted "/sys/kernel/debug"; then



More information about the crfs-devel mailing list