summaryrefslogtreecommitdiffstats
path: root/debian/tests/create-files
blob: d7e89d653fb98a6a99575a9d6487edb797f375c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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}