- Add a conf.sh file for executing common functions with gnop
- Use attach_md for attaching md(4) devices - Don't hardcode /tmp for temporary files, which violates the kyua sandbox MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
06908bcb39
commit
72670c33c2
@ -4,4 +4,11 @@
|
||||
class="nop"
|
||||
base=`basename $0`
|
||||
|
||||
gnop_test_cleanup()
|
||||
{
|
||||
[ -c /dev/${us}.nop ] && gnop destroy ${us}.nop
|
||||
geom_test_cleanup
|
||||
}
|
||||
trap gnop_test_cleanup ABRT EXIT INT TERM
|
||||
|
||||
. `dirname $0`/../geom_subr.sh
|
||||
|
@ -5,21 +5,16 @@
|
||||
|
||||
echo "1..1"
|
||||
|
||||
us=45
|
||||
us=$(attach_md -t malloc -s 1M) || exit 1
|
||||
|
||||
mdconfig -a -t malloc -s 1M -u $us || exit 1
|
||||
|
||||
gnop create /dev/md${us} || exit 1
|
||||
gnop create /dev/${us} || exit 1
|
||||
|
||||
# Size of created device should be 1MB.
|
||||
|
||||
size=`diskinfo /dev/md${us}.nop | awk '{print $3}'`
|
||||
size=`diskinfo /dev/${us}.nop | awk '{print $3}'`
|
||||
|
||||
if [ $size -eq 1048576 ]; then
|
||||
echo "ok 1"
|
||||
else
|
||||
echo "not ok 1"
|
||||
fi
|
||||
|
||||
gnop destroy md${us}.nop
|
||||
mdconfig -d -u $us
|
||||
|
@ -3,20 +3,19 @@
|
||||
|
||||
. `dirname $0`/conf.sh
|
||||
|
||||
us=45
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
src=`mktemp $base.XXXXXX` || exit 1
|
||||
dst=`mktemp $base.XXXXXX` || exit 1
|
||||
|
||||
echo "1..1"
|
||||
|
||||
dd if=/dev/random of=${src} bs=1m count=1 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s 1M -u $us || exit 1
|
||||
us=$(attach_md -t malloc -s 1M) || exit 1
|
||||
|
||||
gnop create /dev/md${us} || exit 1
|
||||
gnop create /dev/${us} || exit 1
|
||||
|
||||
dd if=${src} of=/dev/md${us}.nop bs=1m count=1 >/dev/null 2>&1
|
||||
dd if=/dev/md${us}.nop of=${dst} bs=1m count=1 >/dev/null 2>&1
|
||||
dd if=${src} of=/dev/${us}.nop bs=1m count=1 >/dev/null 2>&1
|
||||
dd if=/dev/${us}.nop of=${dst} bs=1m count=1 >/dev/null 2>&1
|
||||
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "not ok 1"
|
||||
@ -24,6 +23,4 @@ else
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
gnop destroy md${us}.nop
|
||||
mdconfig -d -u $us
|
||||
rm -f ${src} ${dst}
|
||||
|
Loading…
Reference in New Issue
Block a user