#!/bin/sh # Regression test for D33416 vm_fault: Fix vm_fault_populate()'s handling of VM_FAULT_WIRE # Bug report: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260347 # Test scenario by: martin # Fixed by 88642d978a99 [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 [ -d /usr/src/sys ] || exit 0 builddir=`sysctl kern.version | grep @ | sed 's/.*://'` [ -d "$builddir" ] && export KERNBUILDDIR=$builddir || exit 0 export SYSDIR=`echo $builddir | sed 's#/sys.*#/sys#'` . ../default.cfg odir=`pwd` dir=$RUNDIR/skeleton mkdir -p $dir cd $dir cat > skeleton.c < #include #include /* uprintf */ #include #include /* defines used in kernel.h */ #include /* types used in module initialization */ #define BUFFER_SIZE 10*1000*1024 // 10 MB static char gBuffer[BUFFER_SIZE]; static int demo_init (void) { for (int i=0; i Makefile < EOF make old=`sysctl -n vm.stats.vm.v_wire_count` kldload $dir/skeleton.ko kldunload $dir/skeleton.ko leak=$((`sysctl -n vm.stats.vm.v_wire_count` - old)) if [ $leak -gt 25 ]; then echo "Test leaked $leak pages in the skeleton.ko module" s=1 else s=0 fi cd $odir rm -rf $dir exit $s