From 7fa7b599f2ce2042cabe9bbfa7c92c7477e091af Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Fri, 19 Jul 2024 17:54:27 +0200 Subject: [PATCH] Add autopkgtest from upstream CI Original source: https://github.com/exfatprogs/exfatprogs/blob/1.2.4/.github/workflows/c-cpp.yml#L37 --- debian/tests/control | 4 ++++ debian/tests/create-files | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 debian/tests/create-files diff --git a/debian/tests/control b/debian/tests/control index b1bbe7e..c951620 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,3 +1,7 @@ Tests: fsck Depends: @ Restrictions: allow-stderr + +Tests: create-files +Depends: @ +Restrictions: isolation-machine, needs-root diff --git a/debian/tests/create-files b/debian/tests/create-files new file mode 100644 index 0000000..d7e89d6 --- /dev/null +++ b/debian/tests/create-files @@ -0,0 +1,35 @@ +#!/bin/bash + +# Original source: +# https://github.com/exfatprogs/exfatprogs/blob/1.2.4/.github/workflows/c-cpp.yml#L37 + +set -e + +mkdir "${AUTOPKGTEST_TMP}/mnt" +truncate -s 10G "${AUTOPKGTEST_TMP}/test.img" + +dev=$(losetup --show -f "${AUTOPKGTEST_TMP}/test.img") +mkfs.exfat ${dev} + +mount -t exfat ${dev} "${AUTOPKGTEST_TMP}/mnt" +cd "${AUTOPKGTEST_TMP}/mnt" + +i=1;while [ $i -le 10000 ];do touch file$i;if [ $? != 0 ]; then exit 1; fi; i=$(($i + 1));done +sync +rm -rf * + +i=1;while [ $i -le 10000 ];do mkdir dir$i;if [ $? != 0 ]; then exit 1; fi; i=$(($i + 1));done +sync +rm -rf * + +i=1;while [ $i -le 10000 ];do touch file$i;if [ $? != 0 ]; then exit 1; fi; i=$(($i + 1));done +i=1;while [ $i -le 10000 ];do mkdir dir$i;if [ $? != 0 ]; then exit 1; fi; i=$(($i + 1));done +sync + +fsck.exfat ${dev} +find . -delete +fsck.exfat ${dev} + +cd - +umount ${dev} +losetup -d ${dev} -- 2.39.5