btrfs-progs: tests: add test case to verify convert rollback output

The new new test case is to make sure the rollback output for a fixed
content converted fs contains the string "ext2_saved/image".

As we have a bug in the past where after the string "ext2_saved", we can
have some unterminated garbage.

Signed-off-by: Qu Wenruo <wqu@suse.com>
This commit is contained in:
Qu Wenruo 2024-07-15 14:43:48 +09:30 committed by David Sterba
parent a927cb1b0a
commit 6f99038a5f
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
#!/bin/bash
# Make sure "btrfs-convert -r" is outputting the correct filename
source "$TEST_TOP/common" || exit
source "$TEST_TOP/common.convert" || exit
setup_root_helper
prepare_test_dev
check_global_prereq mkfs.ext4
check_prereq btrfs-convert
check_prereq btrfs
convert_test_prep_fs ext4 mke2fs -t ext4 -b 4096
run_check_umount_test_dev
convert_test_do_convert
# Rollback and save the output.
run_check_stdout "$TOP/btrfs-convert" --rollback "$TEST_DEV" | \
grep -q "ext2_saved/image" || _fail "rollback filename output is corruptedd"