Skip to contentSkip to conversation

ktest: add a test case for rmdir empty snapshot

PATCH Applied Guoyu Ou 2 participants 2 messages Feb 13, 2024 – Feb 14, 2024

lore
Share & tools
lore

Guoyu Ou

author
#0 lore raw

PATCH 1/1 ktest: add a test case for rmdir empty snapshot

---
 tests/bcachefs/subvol.ktest | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
tests/bcachefs/subvol.ktest +18 -0
index 1915d84..4a50da2 100755
@@ -718,4 +718,22 @@ test_subvol_mv()
     bcachefs fsck ${ktest_scratch_dev[0]}
 }
 
+test_subvol_rmdir_empty_snapshot()
+{
+    run_quiet "" bcachefs format -f ${ktest_scratch_dev[0]}
+    mount -t bcachefs ${ktest_scratch_dev[0]} /mnt
+
+    cd /mnt
+    bcachefs subvolume create ./sub
+    cd sub
+    bcachefs subvolume create ./sub2
+    bcachefs subvolume snapshot . ./snap
+    rmdir ./snap
+
+    cd /
+    umount /mnt
+
+    bcachefs fsck ${ktest_scratch_dev[0]}
+}
+
 main "$@"
Signature · 1 line
2.43.0
#1 lore raw
Quoted 1 line · Guoyu Ou

Thanks! Applied.

Quoted 34 lines
---
 tests/bcachefs/subvol.ktest | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
tests/bcachefs/subvol.ktest +18 -0
index 1915d84..4a50da2 100755
@@ -718,4 +718,22 @@ test_subvol_mv()
     bcachefs fsck ${ktest_scratch_dev[0]}
 }
 
+test_subvol_rmdir_empty_snapshot()
+{
+    run_quiet "" bcachefs format -f ${ktest_scratch_dev[0]}
+    mount -t bcachefs ${ktest_scratch_dev[0]} /mnt
+
+    cd /mnt
+    bcachefs subvolume create ./sub
+    cd sub
+    bcachefs subvolume create ./sub2
+    bcachefs subvolume snapshot . ./snap
+    rmdir ./snap
+
+    cd /
+    umount /mnt
+
+    bcachefs fsck ${ktest_scratch_dev[0]}
+}
+
 main "$@"
Signature · 1 line
2.43.0