xref: /freebsd/sbin/fdisk/runtest.sh (revision 9657a0c35e572a310de0ba8a0d16a6bd61c88abf)
19657a0c3SPoul-Henning Kamp#!/bin/sh
29657a0c3SPoul-Henning Kamp# $FreeBSD$
39657a0c3SPoul-Henning Kamp
49657a0c3SPoul-Henning Kampset -e
59657a0c3SPoul-Henning KampMD=`mdconfig -a -t malloc -s 4m -x 63 -y 16`
69657a0c3SPoul-Henning Kampif [ ! -c /dev/${MD} ] ; then
79657a0c3SPoul-Henning Kamp	echo "MD device $MD did not materialize" 1>&2
89657a0c3SPoul-Henning Kamp	exit 2
99657a0c3SPoul-Henning Kampfi
109657a0c3SPoul-Henning Kamptrap "mdconfig -d -u ${MD}" EXIT INT TERM
119657a0c3SPoul-Henning Kamp
129657a0c3SPoul-Henning Kamp# Create an empty bootcode file to isolate our checksum from any changes
139657a0c3SPoul-Henning Kamp# which might happen to the boot code file.
149657a0c3SPoul-Henning Kampdd if=/dev/zero of=tmp count=1 > /dev/null 2>&1
159657a0c3SPoul-Henning Kamp./fdisk -b tmp -I $MD > /dev/null 2>&1
169657a0c3SPoul-Henning Kamprm tmp
179657a0c3SPoul-Henning Kamp
189657a0c3SPoul-Henning Kampc=`dd if=/dev/${MD} count=1 2>/dev/null | md5`
199657a0c3SPoul-Henning Kampif [ $c != 509b44919d3921502bd31237c4bb1f75 ] ; then
209657a0c3SPoul-Henning Kamp	echo "FAILED: fdisk -I gives bad checksum" 1>&2
219657a0c3SPoul-Henning Kamp	exit 1
229657a0c3SPoul-Henning Kampfi
239657a0c3SPoul-Henning Kampecho "PASSED: fdisk -I"
249657a0c3SPoul-Henning Kampexit 0
25