test: add assert to parted test

This commit is contained in:
Peter Šurda 2021-02-26 22:41:37 +01:00
parent 2f16330445
commit 5a95731305
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
2 changed files with 11 additions and 2 deletions

7
tests/data/parted.dat Normal file
View File

@ -0,0 +1,7 @@
BYT;
T_E_M_P:17.2GB:file:512:512:gpt::;
1:1049kB:1074MB:1073MB::EFI system partition:boot, esp;
2:1075MB:2147MB:1073MB::root unused:;
3:2149MB:3221MB:1073MB::root unused:;
4:3222MB:4295MB:1073MB::root unused:;
5:4296MB:17.2GB:12.9GB::Encrypted:;

View File

@ -4,10 +4,12 @@ function test_partitioning()
{ {
local img local img
img=$(mktemp -u) img=$(mktemp -u)
dd if=/dev/zero of="$img" bs=1M seek=16384 count=0 dd if=/dev/zero of="$img" bs=1M seek=16384 count=0 2> /dev/null
setup_drive "$img" setup_drive "$img"
parted -ms "$img" -- print sed -i "s|T_E_M_P|$img|g;" tests/data/parted.dat
output=$(parted -ms "$img" -- print)
rm -f "$img" rm -f "$img"
assertEquals "$(cat tests/data/parted.dat)" "$output"
} }
function oneTimeSetUp() function oneTimeSetUp()