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

Alex Chiang achiang at hp.com
Fri Apr 18 10:37:15 PDT 2008


* Paul Collins <paul at burly.ondioline.org>:
> Alex Chiang <achiang at hp.com> writes:
> 
> > 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.
> 
> How about "modinfo -F depends crfs.ko"?

Sure, how about this:

diff -r fb4148080e26 -r 66eb4344dd2e tests/run.sh
--- a/tests/run.sh	Thu Apr 17 20:11:47 2008 -0600
+++ b/tests/run.sh	Fri Apr 18 11:36:09 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 `modinfo -F depends $topdir/lk/crfs.ko` || \
+		fail "modprobe `modinfo -F depends $topdir/lk/crfs.ko` 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