aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyunchul Lee <hyc.lee@gmail.com>2022-08-02 08:31:03 +0900
committerHyunchul Lee <hyc.lee@gmail.com>2022-09-01 14:41:09 +0900
commita3da451b6235cde4401ab1783b0f950ba2a669ac (patch)
tree73e81f63e8842d2c803503d781b3fb8dff1bd884
parent2d1d8749a07c23adff48114d682eb2722712da7c (diff)
downloadexfatprogs-a3da451b6235cde4401ab1783b0f950ba2a669ac.tar.gz
tests: some modification of test_fsck.sh
Add '-s' option to fsck option, And remove comparision between repaired image and expected image in test_fsck.sh Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
-rw-r--r--tests/file_invalid_clus/exfat.img.expected.xzbin4048 -> 0 bytes
-rw-r--r--tests/large_file_invalid_clus/exfat.img.expected.xzbin48520 -> 0 bytes
-rwxr-xr-xtests/test_fsck.sh27
3 files changed, 9 insertions, 18 deletions
diff --git a/tests/file_invalid_clus/exfat.img.expected.xz b/tests/file_invalid_clus/exfat.img.expected.xz
deleted file mode 100644
index 08e992e..0000000
--- a/tests/file_invalid_clus/exfat.img.expected.xz
+++ /dev/null
Binary files differ
diff --git a/tests/large_file_invalid_clus/exfat.img.expected.xz b/tests/large_file_invalid_clus/exfat.img.expected.xz
deleted file mode 100644
index b31e710..0000000
--- a/tests/large_file_invalid_clus/exfat.img.expected.xz
+++ /dev/null
Binary files differ
diff --git a/tests/test_fsck.sh b/tests/test_fsck.sh
index 936db54..c53d8f3 100755
--- a/tests/test_fsck.sh
+++ b/tests/test_fsck.sh
@@ -4,13 +4,18 @@ TESTCASE_DIR=$1
NEED_LOOPDEV=$2
IMAGE_FILE=exfat.img
FSCK_PROG=fsck.exfat
-FSCK_OPTS=-y
+FSCK_PROG_2=fsck.exfat
+FSCK_OPTS="-y -s"
PASS_COUNT=0
cleanup() {
echo ""
echo "Passed ${PASS_COUNT} of ${TEST_COUNT}"
- exit
+ if [ ${PASS_COUNT} -ne ${TEST_COUNT} ]; then
+ exit 1
+ else
+ exit 0
+ fi
}
if [ $# -eq 0 ]; then
@@ -40,7 +45,7 @@ for TESTCASE_DIR in $TESTCASE_DIRS; do
# Run fsck for repair
$FSCK_PROG $FSCK_OPTS "$DEV_FILE"
- if [ $? -ne 1 ]; then
+ if [ $? -ne 1 ] && [ $? -ne 0 ]; then
echo ""
echo "Failed to repair ${TESTCASE_DIR}"
if [ $NEED_LOOPDEV ]; then
@@ -51,7 +56,7 @@ for TESTCASE_DIR in $TESTCASE_DIRS; do
echo ""
# Run fsck again
- $FSCK_PROG -n "$DEV_FILE"
+ $FSCK_PROG_2 "$DEV_FILE"
if [ $? -ne 0 ]; then
echo ""
echo "Failed, corrupted ${TESTCASE_DIR}"
@@ -61,20 +66,6 @@ for TESTCASE_DIR in $TESTCASE_DIRS; do
cleanup
fi
- if [ -e "${TESTCASE_DIR}/exfat.img.expected.xz" ]; then
- EXPECTED_FILE=${IMAGE_FILE}.expected
- unxz -cfk "${TESTCASE_DIR}/${EXPECTED_FILE}.xz" > "${EXPECTED_FILE}"
- diff <(xxd "${IMAGE_FILE}") <(xxd "${EXPECTED_FILE}")
- if [ $? -ne 0 ]; then
- echo ""
- echo "Failed ${TESTCASE_DIR}"
- if [ $NEED_LOOPDEV ]; then
- losetup -d "${DEV_FILE}"
- fi
- cleanup
- fi
- fi
-
echo ""
echo "Passed ${TESTCASE_DIR}"
PASS_COUNT=$((PASS_COUNT + 1))