summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2023-06-01 09:27:49 +0200
committerJes Sorensen <jes@trained-monkey.org>2023-10-26 23:28:23 +0200
commitae5f13a971bc309e0e25087421119b86daf2e510 (patch)
treeabf7fe56135a8b36da993ccdda587857cce46424 /tests
parentmdadm: refactor ident->name handling (diff)
downloadmdadm-ae5f13a971bc309e0e25087421119b86daf2e510.tar.xz
mdadm-ae5f13a971bc309e0e25087421119b86daf2e510.zip
mdadm: define ident_set_devname()
Use dedicated set method for ident->devname. Now, devname validation is done early for modes where device is created (Build, Create and Assemble). The rules, used for devname validation are derived from config file. It could cause regression with execeptional cases where existing device has name which doesn't match criteria for Manage and Grow modes. It is low risk and those modes are not omitted from early devname validation. Use can used main numbered devnode to avoid this problem. Messages exposed to user are changed so it might cause a regression in negative scenarios. Error codes are not changed. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/00createnames3
-rw-r--r--tests/templates/names_template7
2 files changed, 10 insertions, 0 deletions
diff --git a/tests/00createnames b/tests/00createnames
index 064eeef2..a95e7d2b 100644
--- a/tests/00createnames
+++ b/tests/00createnames
@@ -39,3 +39,6 @@ mdadm -S "/dev/md0"
names_create "/dev/md0" "name"
names_verify "/dev/md0" "empty" "name"
mdadm -S "/dev/md0"
+
+# Devnode is a special ignore keyword. Should be rejected.
+names_create "<ignore>" "name", "true"
diff --git a/tests/templates/names_template b/tests/templates/names_template
index 8d2b5c81..6181bfaa 100644
--- a/tests/templates/names_template
+++ b/tests/templates/names_template
@@ -2,6 +2,7 @@
function names_create() {
local DEVNAME=$1
local NAME=$2
+ local NEG_TEST=$3
if [[ -z "$NAME" ]]; then
mdadm -CR "$DEVNAME" -l0 -n 1 $dev0 --force
@@ -9,6 +10,12 @@ function names_create() {
mdadm -CR "$DEVNAME" --name="$NAME" --metadata=1.2 -l0 -n 1 $dev0 --force
fi
+ if [[ "$NEG_TEST" == "true" ]]; then
+ [[ "$?" == "0" ]] && return 0
+ echo "Negative verification failed"
+ exit 1
+ fi
+
if [[ "$?" != "0" ]]; then
echo "Cannot create device."
exit 1