fix: typos and backwards compatibility
- forgot again assertContains isn't supported on bionic's shunit2
This commit is contained in:
parent
586cccf0d4
commit
d691022aef
10
drive.inc
10
drive.inc
|
@ -34,7 +34,7 @@ function partition_list
|
|||
{
|
||||
local drive="$1"
|
||||
partitions="$(parted -m "$drive" -- print| \
|
||||
awk --field-separator=":" \
|
||||
awk -F: \
|
||||
'{if (NR > 2)
|
||||
print $1
|
||||
}')"
|
||||
|
@ -43,7 +43,7 @@ function partition_list
|
|||
function find_unused
|
||||
{
|
||||
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") {
|
||||
print $1
|
||||
}}')|head -1"
|
||||
|
@ -52,7 +52,7 @@ function find_unused
|
|||
function find_oldest
|
||||
{
|
||||
local drive="$1"
|
||||
oldest="$(parted -m "$drive" -- print|awk --field-separator=":" \
|
||||
oldest="$(parted -m "$drive" -- print|awk -F: \
|
||||
'BEGIN
|
||||
{min="ZZZZ"}
|
||||
{if (NR > 2 && $1 >= 2 && $1 <= 4 &&
|
||||
|
@ -66,7 +66,7 @@ function find_oldest
|
|||
function find_newest
|
||||
{
|
||||
local drive="$1"
|
||||
newest="$(parted -m "$drive" -- print|awk --field-separator=":" \
|
||||
newest="$(parted -m "$drive" -- print|awk -F: \
|
||||
'BEGIN
|
||||
{max=""}
|
||||
{if (NR > 2 && $1 >= 2 && $1 <= 4 &&
|
||||
|
@ -81,7 +81,7 @@ function version_from_partnum
|
|||
{
|
||||
local drive="$1"
|
||||
local partnum="$2"
|
||||
version="$(parted -m "$drive" -- print|awk --field-separator=":" \
|
||||
version="$(parted -m "$drive" -- print|awk -F: \
|
||||
'{if (NR > 2 && $1 == "'"$partnum"') {
|
||||
print $6
|
||||
}}')"
|
||||
|
|
|
@ -30,7 +30,7 @@ function test_partitioning()
|
|||
assertEquals "$max_version" "$version"
|
||||
|
||||
find_unused "$img"
|
||||
assertContains " 3 4 " "$unused"
|
||||
assertEquals 3 "$unused"
|
||||
|
||||
rename_partition "$img" 3 "root $min_version"
|
||||
find_oldest "$img"
|
||||
|
@ -40,7 +40,7 @@ function test_partitioning()
|
|||
find_newest "$img"
|
||||
assertEquals "$max_version" "$newest"
|
||||
|
||||
partition-list "$img"
|
||||
partition_list "$img"
|
||||
assertEquals "1 2 3 4 5" "$partitions"
|
||||
|
||||
rm -f "$img"
|
||||
|
|
Loading…
Reference in New Issue
Block a user