sysdeploy/tests/drive.sh

26 lines
619 B
Bash
Raw Normal View History

2021-02-26 22:19:36 +01:00
#!/bin/bash
function test_partitioning()
{
local img
img=$(mktemp -u)
2021-02-26 22:41:37 +01:00
dd if=/dev/zero of="$img" bs=1M seek=16384 count=0 2> /dev/null
setup_drive "$img"
2021-02-26 22:46:54 +01:00
output=$(parted -ms "$img" -- print)
2021-02-26 22:41:37 +01:00
sed -i "s|T_E_M_P|$img|g;" tests/data/parted.dat
2021-02-26 22:46:54 +01:00
assertEquals "$(cat tests/data/parted.dat)" "$output"
rename_partition "$img" 2 "root renamed"
2021-02-26 22:41:37 +01:00
output=$(parted -ms "$img" -- print)
2021-02-26 22:46:54 +01:00
sed -i "s|T_E_M_P|$img|g;" tests/data/rename.dat
assertEquals "$(cat tests/data/rename.dat)" "$output"
2021-02-26 22:19:36 +01:00
rm -f "$img"
}
function oneTimeSetUp()
{
. drive.inc
}
# Load shUnit2.
. /usr/bin/shunit2