3 # convert ext2/3/4 images to btrfs images, and make sure the results are
7 SCRIPT_DIR=$(dirname $(readlink -f "$0"))
9 TOP=$(readlink -f "$SCRIPT_DIR/../")
10 if [ -f "$TOP/configure.ac" ]; then
12 TEST_TOP="$TOP/tests/"
15 # external, defaults to system binaries
16 TOP=$(dirname `which btrfs`)
17 TEST_TOP="$SCRIPT_DIR"
18 INTERNAL_BIN="$TEST_TOP"
21 # assume external, TOP set from commandline
22 TEST_TOP="$SCRIPT_DIR"
23 INTERNAL_BIN="$TEST_TOP"
25 if ! [ -x "$TOP/btrfs" ]; then
26 echo "ERROR: cannot execute btrfs from TOP=$TOP"
29 TEST_DEV=${TEST_DEV:-}
30 RESULTS="$TEST_TOP/convert-tests-results.txt"
31 IMAGE="$TEST_TOP/test.img"
33 source "$TEST_TOP/common"
34 source "$TEST_TOP/common.convert"
47 check_kernel_support_reiserfs
48 # anything expected by common.convert
49 check_global_prereq getfacl
50 check_global_prereq setfacl
51 check_global_prereq md5sum
58 testname=$(basename "$testdir")
59 echo " [TEST/conv] $testname"
61 echo "=== Entering $testname" >> "$RESULTS"
62 if [ -x test.sh ]; then
63 # Only support custom test scripts
66 if [[ $TEST_LOG =~ dump ]]; then
67 # the logs can be large and may exceed the
68 # limits, use 4MB for now
69 tail -c 3900000 "$RESULTS"
71 _fail "test failed for case $testname"
74 _fail "custom test script not found"
79 for i in $(find "$TEST_TOP/convert-tests" -maxdepth 1 -mindepth 1 -type d \
80 ${TEST:+-name "$TEST"} | sort)