mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-24 23:22:27 +00:00
btrfs-progs: Add some simple end-to-end tests for btrfs-convert
These use the system's mke2fs, and don't require loop devices or root privileges. They don't pick up anything with the default flags right now, but they do pick up some sanitizer issues when the tools are compiled with any of -fsanitize={address,memory,thread}. Signed-off-by: Adam Buchbinder <abuchbinder@google.com> Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
parent
700c3ca9b1
commit
2100836188
2
Makefile
2
Makefile
@ -21,7 +21,7 @@ libbtrfs_objects = send-stream.o send-utils.o rbtree.o btrfs-list.o crc32c.o \
|
||||
libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \
|
||||
crc32c.h list.h kerncompat.h radix-tree.h extent-cache.h \
|
||||
extent_io.h ioctl.h ctree.h btrfsck.h
|
||||
TESTS = fsck-tests.sh
|
||||
TESTS = fsck-tests.sh convert-tests.sh
|
||||
|
||||
INSTALL = install
|
||||
prefix ?= /usr/local
|
||||
|
35
tests/convert-tests.sh
Normal file
35
tests/convert-tests.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# convert ext2/3/4 images to btrfs images, and make sure the results are
|
||||
# clean.
|
||||
#
|
||||
|
||||
here=`pwd`
|
||||
|
||||
_fail()
|
||||
{
|
||||
echo "$*" | tee -a convert-tests-results.txt
|
||||
exit 1
|
||||
}
|
||||
|
||||
rm -f convert-tests-results.txt
|
||||
rm -f test.img
|
||||
|
||||
test(){
|
||||
echo " [TEST] $1"
|
||||
shift
|
||||
echo "creating ext image with: $*" >> convert-tests-results.txt
|
||||
# 256MB is the smallest acceptable btrfs image.
|
||||
dd if=/dev/zero of=$here/test.img bs=1024 count=$((256*1024)) \
|
||||
>> convert-tests-results.txt 2>&1 || _fail "dd failed"
|
||||
$* -F $here/test.img >> convert-tests-results.txt 2>&1 \
|
||||
|| _fail "filesystem create failed"
|
||||
$here/btrfs-convert $here/test.img >> convert-tests-results.txt 2>&1 \
|
||||
|| _fail "btrfs-convert failed"
|
||||
$here/btrfsck $here/test.img >> convert-tests-results.txt 2>&1 \
|
||||
|| _fail "btrfsck detected errors"
|
||||
}
|
||||
|
||||
test "ext2, 4k blocksize" mke2fs -b 4096
|
||||
test "ext3, 4k blocksize" mke2fs -j -b 4096
|
||||
test "ext4, 4k blocksize" mke2fs -t ext4 -b 4096
|
Loading…
Reference in New Issue
Block a user