diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2003-04-13 21:34:16 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2003-04-13 21:34:16 +0000 |
commit | 9657a0c35e572a310de0ba8a0d16a6bd61c88abf (patch) | |
tree | b2f8b033d12c9553d046062bce46e4f33bbdf258 /sbin/fdisk | |
parent | 2373499592909238ef480e464dacea2c66cfd5b1 (diff) | |
download | src-9657a0c35e572a310de0ba8a0d16a6bd61c88abf.tar.gz src-9657a0c35e572a310de0ba8a0d16a6bd61c88abf.zip |
Pull in the encoding/decoding functions for struct dos_partition.
Add a very simple regression test for "fdisk -I".
Notes
Notes:
svn path=/head/; revision=113451
Diffstat (limited to 'sbin/fdisk')
-rw-r--r-- | sbin/fdisk/Makefile | 6 | ||||
-rw-r--r-- | sbin/fdisk/runtest.sh | 24 |
2 files changed, 30 insertions, 0 deletions
diff --git a/sbin/fdisk/Makefile b/sbin/fdisk/Makefile index 9a5fb9b64a7e..8f0d8e925096 100644 --- a/sbin/fdisk/Makefile +++ b/sbin/fdisk/Makefile @@ -1,7 +1,13 @@ # $FreeBSD$ PROG= fdisk +SRCS= fdisk.c geom_mbr_enc.c WARNS= 4 MAN= fdisk.8 +.PATH: ${.CURDIR}/../../sys/geom + .include <bsd.prog.mk> + +test: ${PROG} + sh ${.CURDIR}/runtest.sh diff --git a/sbin/fdisk/runtest.sh b/sbin/fdisk/runtest.sh new file mode 100644 index 000000000000..24ab20ba72fa --- /dev/null +++ b/sbin/fdisk/runtest.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# $FreeBSD$ + +set -e +MD=`mdconfig -a -t malloc -s 4m -x 63 -y 16` +if [ ! -c /dev/${MD} ] ; then + echo "MD device $MD did not materialize" 1>&2 + exit 2 +fi +trap "mdconfig -d -u ${MD}" EXIT INT TERM + +# Create an empty bootcode file to isolate our checksum from any changes +# which might happen to the boot code file. +dd if=/dev/zero of=tmp count=1 > /dev/null 2>&1 +./fdisk -b tmp -I $MD > /dev/null 2>&1 +rm tmp + +c=`dd if=/dev/${MD} count=1 2>/dev/null | md5` +if [ $c != 509b44919d3921502bd31237c4bb1f75 ] ; then + echo "FAILED: fdisk -I gives bad checksum" 1>&2 + exit 1 +fi +echo "PASSED: fdisk -I" +exit 0 |