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