summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-11-09 18:59:14 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2022-11-09 19:06:14 +0100
commit9cd4b7fc69881ef38b9143d0192b97ca08224788 (patch)
tree5b84a2165ebe2491292049a36784987aebe8b856
parent78eba7665565690faccef21f721e94143b5abf7f (diff)
downloadalpine-conf-9cd4b7fc69881ef38b9143d0192b97ca08224788.zip
setup-disk: fix typo in error message
and add test from missing block device
-rw-r--r--setup-disk.in2
-rwxr-xr-xtests/setup_disk_test11
2 files changed, 11 insertions, 2 deletions
diff --git a/setup-disk.in b/setup-disk.in
index 6400b3b..c726da9 100644
--- a/setup-disk.in
+++ b/setup-disk.in
@@ -1541,7 +1541,7 @@ if [ $# -gt 0 ]; then
for i in "$@"; do
j=$(readlink -f "$i" | sed 's:^/dev/::; s:/:!:g')
if ! [ -e "$ROOT/sys/block/$j/device" ]; then
- die "$i is not a suitable for partitioning"
+ die "$i is not a block device suitable for partitioning"
fi
diskdevs="$diskdevs /dev/${j//!//}"
done
diff --git a/tests/setup_disk_test b/tests/setup_disk_test
index 65b7ada..654bfea 100755
--- a/tests/setup_disk_test
+++ b/tests/setup_disk_test
@@ -5,7 +5,8 @@ init_tests \
setup_disk_usage \
setup_disk_mode_none \
setup_disk_none \
- setup_disk_func_find_disks
+ setup_disk_func_find_disks \
+ setup_disk_non_existing_block_dev
setup_disk_usage_body() {
test_usage setup-disk
@@ -72,3 +73,11 @@ setup_disk_func_find_disks_body() {
setup-disk
}
+setup_disk_non_existing_block_dev_body() {
+ init_env
+ atf_check -s not-exit:0 \
+ -e match:"/dev/vda is not a block device suitable for partitioning" \
+ -o match:"swapoff" \
+ setup-disk -m sys /dev/vda
+}
+