diff options
author | Karel Zak | 2014-10-07 14:54:58 +0200 |
---|---|---|
committer | Karel Zak | 2014-10-07 14:54:58 +0200 |
commit | 5f176957297578382b825ed8636342d4a10b9389 (patch) | |
tree | 35cff191a4b125052e9dcac2f47d6ce05bc83a87 | |
parent | libmount: fix mnt_is_readonly() #ifdef (diff) | |
download | kernel-qcow2-util-linux-5f176957297578382b825ed8636342d4a10b9389.tar.gz kernel-qcow2-util-linux-5f176957297578382b825ed8636342d4a10b9389.tar.xz kernel-qcow2-util-linux-5f176957297578382b825ed8636342d4a10b9389.zip |
tests: add sfdisk test
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | tests/commands.sh | 1 | ||||
-rw-r--r-- | tests/expected/sfdisk/dos | 0 | ||||
-rw-r--r-- | tests/expected/sfdisk/dos-activate | 11 | ||||
-rw-r--r-- | tests/expected/sfdisk/dos-read-dump | 26 | ||||
-rw-r--r-- | tests/expected/sfdisk/dos-simple-commas | 28 | ||||
-rw-r--r-- | tests/expected/sfdisk/dos-simple-space | 24 | ||||
-rw-r--r-- | tests/expected/sfdisk/dos-write-dump | 9 | ||||
-rwxr-xr-x | tests/ts/sfdisk/dos | 90 |
8 files changed, 189 insertions, 0 deletions
diff --git a/tests/commands.sh b/tests/commands.sh index 0a3062872..4c7455e4c 100644 --- a/tests/commands.sh +++ b/tests/commands.sh @@ -38,6 +38,7 @@ TS_CMD_DMESG=${TS_CMD_DMESG-"$top_builddir/dmesg"} TS_CMD_EJECT=${TS_CMD_EJECT-"$top_builddir/eject"} TS_CMD_FALLOCATE=${TS_CMD_FALLOCATE-"$top_builddir/fallocate"} TS_CMD_FDISK=${TS_CMD_FDISK-"$top_builddir/fdisk"} +TS_CMD_SFDISK=${TS_CMD_SFDISK-"$top_builddir/sfdisk"} TS_CMD_FINDMNT=${TS_CMD_FINDMNT-"$top_builddir/findmnt"} TS_CMD_FSCKCRAMFS=${TS_CMD_FSCKCRAMFS:-"$top_builddir/fsck.cramfs"} TS_CMD_FSCKMINIX=${TS_CMD_FSCKMINIX:-"$top_builddir/fsck.minix"} diff --git a/tests/expected/sfdisk/dos b/tests/expected/sfdisk/dos new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/expected/sfdisk/dos diff --git a/tests/expected/sfdisk/dos-activate b/tests/expected/sfdisk/dos-activate new file mode 100644 index 000000000..23be9ee6a --- /dev/null +++ b/tests/expected/sfdisk/dos-activate @@ -0,0 +1,11 @@ + +Disk <removed>: 100 cylinders, 32 heads, 32 sectors/track +Units: sectors of 512 bytes, counting from 0 + + Device Boot Start End #sectors Id System +<removed>1 * 2048 8191 6144 83 Linux +<removed>2 8192 14335 6144 82 Linux swap / Solaris +<removed>3 14336 20479 6144 83 Linux +<removed>4 20480 102399 81920 5 Extended +<removed>5 20481 26624 6144 83 Linux +<removed>6 26626 102399 75774 83 Linux diff --git a/tests/expected/sfdisk/dos-read-dump b/tests/expected/sfdisk/dos-read-dump new file mode 100644 index 000000000..c463a0e47 --- /dev/null +++ b/tests/expected/sfdisk/dos-read-dump @@ -0,0 +1,26 @@ +sfdisk: Checking that no-one is using this disk right now ... +sfdisk: OK +sfdisk: <removed>: unrecognized partition table type +sfdisk: No partitions found +sfdisk: Warning: partition 5 does not end at a cylinder boundary +sfdisk: Warning: partition [6] does not start at a cylinder boundary + +Disk <removed>: 100 cylinders, 32 heads, 32 sectors/track +Old situation: +New situation: +Units: sectors of 512 bytes, counting from 0 + + Device Boot Start End #sectors Id System +<removed>1 * 2048 8191 6144 83 Linux +<removed>2 8192 14335 6144 82 Linux swap / Solaris +<removed>3 14336 20479 6144 83 Linux +<removed>4 20480 102399 81920 5 Extended +<removed>5 20481 26624 6144 83 Linux +<removed>6 26626 102399 75774 83 Linux +Successfully wrote the new partition table + +sfdisk: If you created or changed a DOS partition, /dev/foo7, say, then use dd(1) +to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1 +(See fdisk(8).) +Re-reading the partition table ... + diff --git a/tests/expected/sfdisk/dos-simple-commas b/tests/expected/sfdisk/dos-simple-commas new file mode 100644 index 000000000..4c41f50f3 --- /dev/null +++ b/tests/expected/sfdisk/dos-simple-commas @@ -0,0 +1,28 @@ +sfdisk: Checking that no-one is using this disk right now ... +sfdisk: OK +sfdisk: <removed>: unrecognized partition table type +sfdisk: No partitions found +sfdisk: Warning: partition 5 does not end at a cylinder boundary +sfdisk: Warning: partition [6] does not start at a cylinder boundary +sfdisk: Warning: no primary partition is marked bootable (active) +This does not matter for LILO, but the DOS MBR will not boot this disk. + +Disk <removed>: 100 cylinders, 32 heads, 32 sectors/track +Old situation: +New situation: +Units: sectors of 512 bytes, counting from 0 + + Device Boot Start End #sectors Id System +<removed>1 2048 8191 6144 83 Linux +<removed>2 8192 14335 6144 82 Linux swap / Solaris +<removed>3 14336 20479 6144 83 Linux +<removed>4 20480 102399 81920 5 Extended +<removed>5 20481 26624 6144 83 Linux +<removed>6 26626 102399 75774 83 Linux +Successfully wrote the new partition table + +sfdisk: If you created or changed a DOS partition, /dev/foo7, say, then use dd(1) +to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1 +(See fdisk(8).) +Re-reading the partition table ... + diff --git a/tests/expected/sfdisk/dos-simple-space b/tests/expected/sfdisk/dos-simple-space new file mode 100644 index 000000000..137130f05 --- /dev/null +++ b/tests/expected/sfdisk/dos-simple-space @@ -0,0 +1,24 @@ +sfdisk: Checking that no-one is using this disk right now ... +sfdisk: OK +sfdisk: <removed>: unrecognized partition table type +sfdisk: No partitions found +sfdisk: Warning: no primary partition is marked bootable (active) +This does not matter for LILO, but the DOS MBR will not boot this disk. + +Disk <removed>: 100 cylinders, 32 heads, 32 sectors/track +Old situation: +New situation: +Units: sectors of 512 bytes, counting from 0 + + Device Boot Start End #sectors Id System +<removed>1 2048 8191 6144 83 Linux +<removed>2 8192 14335 6144 82 Linux swap / Solaris +<removed>3 1 2047 2047 83 Linux +<removed>4 0 - 0 0 Empty +Successfully wrote the new partition table + +sfdisk: If you created or changed a DOS partition, /dev/foo7, say, then use dd(1) +to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1 +(See fdisk(8).) +Re-reading the partition table ... + diff --git a/tests/expected/sfdisk/dos-write-dump b/tests/expected/sfdisk/dos-write-dump new file mode 100644 index 000000000..4d069d21f --- /dev/null +++ b/tests/expected/sfdisk/dos-write-dump @@ -0,0 +1,9 @@ +# partition table of <removed> +unit: sectors + +<removed>1 : start= 2048, size= 6144, Id=83, bootable +<removed>2 : start= 8192, size= 6144, Id=82 +<removed>3 : start= 14336, size= 6144, Id=83 +<removed>4 : start= 20480, size= 81920, Id= 5 +<removed>5 : start= 20481, size= 6144, Id=83 +<removed>6 : start= 26626, size= 75774, Id=83 diff --git a/tests/ts/sfdisk/dos b/tests/ts/sfdisk/dos new file mode 100755 index 000000000..26126f058 --- /dev/null +++ b/tests/ts/sfdisk/dos @@ -0,0 +1,90 @@ +#!/bin/bash + +# +# This file is part of util-linux. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="MBR" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_FDISK" + +ts_skip_nonroot + +# set global variable TS_DEVICE +ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3 + + +ts_init_subtest "simple-commas" +$TS_CMD_SFDISK --unit S ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <<EOF +2048,6144,L +8192,6144,S +14336,6144, +20480,,E +,6144, +,, +EOF +ts_fdisk_clean $TS_DEVICE +udevadm settle +ts_finalize_subtest + + +ts_init_subtest "activate" +$TS_CMD_SFDISK --activate ${TS_DEVICE} 1 >> $TS_OUTPUT 2>&1 +$TS_CMD_SFDISK --unit S --list ${TS_DEVICE} >> $TS_OUTPUT 2>&1 +ts_fdisk_clean $TS_DEVICE +udevadm settle +ts_finalize_subtest + + +ts_init_subtest "simple-space" +$TS_CMD_WIPEFS -a ${TS_DEVICE} &> /dev/null +$TS_CMD_SFDISK --unit S ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <<EOF +2048,6144,L +8192,6144,S +,, +EOF +ts_fdisk_clean $TS_DEVICE +udevadm settle +ts_finalize_subtest + + +ts_init_subtest "read-dump" +$TS_CMD_WIPEFS -a ${TS_DEVICE} &> /dev/null +$TS_CMD_SFDISK --unit S ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <<EOF +unit: sectors + +${TS_DEVICE}1 : start= 2048, size= 6144, Id=83, bootable +${TS_DEVICE}2 : start= 8192, size= 6144, Id=82 +${TS_DEVICE}3 : start= 14336, size= 6144, Id=83 +${TS_DEVICE}4 : start= 20480, size= 81920, Id= 5 +${TS_DEVICE}5 : start= 20481, size= 6144, Id=83 +${TS_DEVICE}6 : start= 26626, size= 75774, Id=83 +EOF +ts_fdisk_clean $TS_DEVICE +udevadm settle +ts_finalize_subtest + + +ts_init_subtest "write-dump" +$TS_CMD_SFDISK --unit S --dump ${TS_DEVICE} >> $TS_OUTPUT 2>&1 +ts_fdisk_clean $TS_DEVICE +ts_finalize_subtest + + +rmmod scsi_debug +ts_finalize |