8 test -n "$VMDIR" || fail "must pass --with-vm to configure to run unit tests"
14 ln -s $KSRC/arch/i386/boot/bzImage kernel.bin
15 ln -s $VMDIR/hda.dsk hda.dsk
18 MEM=128 # Avoids kmalloc failures that clutter output.
24 unit_tests="table_t crc_t forward_t"
25 unit_tests_comma=`echo $unit_tests | sed 's/ /,/g'`
26 if test "$KVERSION" = 2.6; then
27 prereq_modules="openflow_mod.ko"
28 unit_mod="unit_mod.ko"
29 elif test "$KVERSION" = 2.4; then
30 prereq_modules="compat24_mod.o openflow_mod.o"
33 fail "\$KVERSION not set"
37 for d in $prereq_modules; do
38 load_prereqs="$load_prereqs
43 ln -s $KSRC/System.map $KSRC/vmlinux unit.cd
44 for d in $prereq_modules $unit_mod; do
45 ln -s $builddir/$d unit.cd
47 cat > unit.cd/runme <<EOF
50 insmod $unit_mod 'run="$unit_tests_comma"' || true
53 chmod a+x unit.cd/runme
55 $top_srcdir/switch/utilities/start-test-vm -f unit unit.conf
57 grep -3 FAIL unit.log && fail "Unit test failed (see tmp/unit.log)"
58 for d in $unit_tests; do
59 grep -F -q "$d: PASS" unit.log || fail "$d didn't pass (see tmp/unit.log)"
64 echo "Unit tests passed"