summaryrefslogtreecommitdiffstats
path: root/tests/23rdev-lifetime
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 04:09:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 04:09:40 +0000
commit256f011d2f256c8c2c05c37a518401199fa423bf (patch)
tree8dc9f04b281a2a8d080f0f327d11f33846be8e33 /tests/23rdev-lifetime
parentReleasing debian version 4.2+20230508-7. (diff)
downloadmdadm-256f011d2f256c8c2c05c37a518401199fa423bf.tar.xz
mdadm-256f011d2f256c8c2c05c37a518401199fa423bf.zip
Merging upstream version 4.2+20231026.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/23rdev-lifetime')
-rw-r--r--tests/23rdev-lifetime34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/23rdev-lifetime b/tests/23rdev-lifetime
new file mode 100644
index 0000000..1750b0d
--- /dev/null
+++ b/tests/23rdev-lifetime
@@ -0,0 +1,34 @@
+devname=${dev0##*/}
+devt=`cat /sys/block/$devname/dev`
+pid=""
+runtime=2
+
+clean_up_test() {
+ pill -9 $pid
+ echo clear > /sys/block/md0/md/array_state
+}
+
+trap 'clean_up_test' EXIT
+
+add_by_sysfs() {
+ while true; do
+ echo $devt > /sys/block/md0/md/new_dev
+ done
+}
+
+remove_by_sysfs(){
+ while true; do
+ echo remove > /sys/block/md0/md/dev-${devname}/state
+ done
+}
+
+echo md0 > /sys/module/md_mod/parameters/new_array || die "create md0 failed"
+
+add_by_sysfs &
+pid="$pid $!"
+
+remove_by_sysfs &
+pid="$pid $!"
+
+sleep $runtime
+exit 0