From: Alessandro Astone <alessandro.astone@canonical.com>
Date: Fri, 19 Jul 2024 15:54:27 +0000 (+0200)
Subject: Add autopkgtest from upstream CI
X-Git-Tag: debian/1.2.4-2~2
X-Git-Url: https://git.sven.stormbind.net/?a=commitdiff_plain;h=7fa7b599f2ce2042cabe9bbfa7c92c7477e091af;p=sven%2Fexfatprogs.git

Add autopkgtest from upstream CI

Original source:
https://github.com/exfatprogs/exfatprogs/blob/1.2.4/.github/workflows/c-cpp.yml#L37
---

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}