2014-05-21 17:20:27 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# convert ext2/3/4 images to btrfs images, and make sure the results are
|
|
|
|
# clean.
|
|
|
|
|
2015-04-03 07:01:16 +00:00
|
|
|
LANG=C
|
2015-05-21 16:48:55 +00:00
|
|
|
SCRIPT_DIR=$(dirname $(readlink -f $0))
|
|
|
|
TOP=$(readlink -f $SCRIPT_DIR/../)
|
2016-06-03 13:54:32 +00:00
|
|
|
TEST_DEV=${TEST_DEV:-}
|
2015-04-03 07:01:16 +00:00
|
|
|
RESULTS="$TOP/tests/convert-tests-results.txt"
|
2016-06-03 13:54:32 +00:00
|
|
|
IMAGE="$TOP/tests/test.img"
|
2014-05-21 17:20:27 +00:00
|
|
|
|
2015-04-03 07:01:16 +00:00
|
|
|
source $TOP/tests/common
|
2016-06-03 13:28:44 +00:00
|
|
|
source $TOP/tests/common.convert
|
2014-05-21 17:20:27 +00:00
|
|
|
|
2016-06-03 02:34:25 +00:00
|
|
|
export TOP
|
|
|
|
export RESULTS
|
|
|
|
export LANG
|
2016-06-03 14:01:51 +00:00
|
|
|
export IMAGE
|
|
|
|
export TEST_DEV
|
2016-06-03 02:34:25 +00:00
|
|
|
|
2015-04-03 07:01:16 +00:00
|
|
|
rm -f $RESULTS
|
2014-05-21 17:20:27 +00:00
|
|
|
|
2016-11-10 17:57:38 +00:00
|
|
|
check_kernel_support
|
|
|
|
|
2016-06-03 02:34:25 +00:00
|
|
|
run_one_test() {
|
2016-06-22 09:30:24 +00:00
|
|
|
local testdir
|
2016-06-03 02:34:25 +00:00
|
|
|
local testname
|
|
|
|
|
2016-06-22 09:30:24 +00:00
|
|
|
testdir="$1"
|
|
|
|
testname=$(basename "$testdir")
|
2016-06-03 02:34:25 +00:00
|
|
|
echo " [TEST/conv] $testname"
|
2016-06-22 09:30:24 +00:00
|
|
|
cd "$testdir"
|
2016-06-03 02:34:25 +00:00
|
|
|
echo "=== Entering $testname" >> $RESULTS
|
|
|
|
if [ -x test.sh ]; then
|
2016-06-22 09:30:24 +00:00
|
|
|
# Only support custom test scripts
|
2016-06-03 02:34:25 +00:00
|
|
|
./test.sh
|
|
|
|
if [ $? -ne 0 ]; then
|
2016-06-22 09:30:24 +00:00
|
|
|
_fail "test failed for case $testname"
|
2016-06-03 02:34:25 +00:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
_fail "custom test script not found"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Test special images
|
|
|
|
for i in $(find $TOP/tests/convert-tests -maxdepth 1 -mindepth 1 -type d \
|
|
|
|
${TEST:+-name "$TEST"} | sort)
|
|
|
|
do
|
|
|
|
run_one_test "$i"
|
|
|
|
done
|