fix: typos and backwards compatibility

- forgot again assertContains isn't supported on bionic's shunit2
This commit is contained in:
Peter Šurda 2021-02-28 09:28:37 +01:00
parent 586cccf0d4
commit d691022aef
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
2 changed files with 7 additions and 7 deletions

View File

@ -34,7 +34,7 @@ function partition_list
{ {
local drive="$1" local drive="$1"
partitions="$(parted -m "$drive" -- print| \ partitions="$(parted -m "$drive" -- print| \
awk --field-separator=":" \ awk -F: \
'{if (NR > 2) '{if (NR > 2)
print $1 print $1
}')" }')"
@ -43,7 +43,7 @@ function partition_list
function find_unused function find_unused
{ {
local drive="$1" local drive="$1"
unused="$(parted -m "$drive" -- print|awk --field-separator=":" \ unused="$(parted -m "$drive" -- print|awk -F: \
'{if (NR > 2 && $1 >= 2 && $6 == "root unused") { '{if (NR > 2 && $1 >= 2 && $6 == "root unused") {
print $1 print $1
}}')|head -1" }}')|head -1"
@ -52,7 +52,7 @@ function find_unused
function find_oldest function find_oldest
{ {
local drive="$1" local drive="$1"
oldest="$(parted -m "$drive" -- print|awk --field-separator=":" \ oldest="$(parted -m "$drive" -- print|awk -F: \
'BEGIN 'BEGIN
{min="ZZZZ"} {min="ZZZZ"}
{if (NR > 2 && $1 >= 2 && $1 <= 4 && {if (NR > 2 && $1 >= 2 && $1 <= 4 &&
@ -66,7 +66,7 @@ function find_oldest
function find_newest function find_newest
{ {
local drive="$1" local drive="$1"
newest="$(parted -m "$drive" -- print|awk --field-separator=":" \ newest="$(parted -m "$drive" -- print|awk -F: \
'BEGIN 'BEGIN
{max=""} {max=""}
{if (NR > 2 && $1 >= 2 && $1 <= 4 && {if (NR > 2 && $1 >= 2 && $1 <= 4 &&
@ -81,7 +81,7 @@ function version_from_partnum
{ {
local drive="$1" local drive="$1"
local partnum="$2" local partnum="$2"
version="$(parted -m "$drive" -- print|awk --field-separator=":" \ version="$(parted -m "$drive" -- print|awk -F: \
'{if (NR > 2 && $1 == "'"$partnum"') { '{if (NR > 2 && $1 == "'"$partnum"') {
print $6 print $6
}}')" }}')"

View File

@ -30,7 +30,7 @@ function test_partitioning()
assertEquals "$max_version" "$version" assertEquals "$max_version" "$version"
find_unused "$img" find_unused "$img"
assertContains " 3 4 " "$unused" assertEquals 3 "$unused"
rename_partition "$img" 3 "root $min_version" rename_partition "$img" 3 "root $min_version"
find_oldest "$img" find_oldest "$img"
@ -40,7 +40,7 @@ function test_partitioning()
find_newest "$img" find_newest "$img"
assertEquals "$max_version" "$newest" assertEquals "$max_version" "$newest"
partition-list "$img" partition_list "$img"
assertEquals "1 2 3 4 5" "$partitions" assertEquals "1 2 3 4 5" "$partitions"
rm -f "$img" rm -f "$img"