test: add partition rename test

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

7
tests/data/rename.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 renamed:;
3:2149MB:3221MB:1073MB::root unused:;
4:3222MB:4295MB:1073MB::root unused:;
5:4296MB:17.2GB:12.9GB::Encrypted:;

View File

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