#!/bin/sh
# DF-2936 run: baseline demonstration (run as root in the guest)
# Success criterion (bug present):
#   - kldload exits 0 AND prints a file id (load "succeeded")
#   - kldstat -m boom reports the module ABSENT while kldstat lists the FILE
#   - MOD_UNLOAD was dispatched at kldload time, not at kldunload time
#   - SYSUNINIT still runs at kldunload for the destroyed module
set -x
cd /tmp/df2936
kldload ./boom.ko; echo "KLDLOAD_RC=$?"
kldstat
kldstat -m boom; echo "KLDSTAT_M_RC=$?"
kldunload boom; echo "KLDUNLOAD_RC=$?"
kldstat
dmesg | tail -20
