]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - tests/scripts/mkdup
tests: remove pre-generated f_extent_htree image
[thirdparty/e2fsprogs.git] / tests / scripts / mkdup
CommitLineData
499d5ec5
TT
1#!/bin/sh
2OPTS="-O bigalloc -C 8192"
3SIZE=4096
4IMG=/tmp/foo.img
5TMP=$(mktemp)
6SIZE_A=15000
7SIZE_B=5000
8SIZE_C=20000
9
10DEBUGFS=./debugfs/debugfs
11MKE2FS=./misc/mke2fs
12FSCK=./e2fsck/e2fsck
13
14dd if=/dev/zero of=$IMG bs=1k count=$SIZE
15echo $MKE2FS -F -t ext4 -L test $OPTS test.img $SIZE
16$MKE2FS -F -t ext4 -L test $OPTS $IMG $SIZE
17dd if=/dev/zero of=$TMP bs=$SIZE_A count=1 >& /dev/null
18echo Writing $SIZE_A bytes to a
19$DEBUGFS -w -R "write $TMP a" $IMG
20BLKS=$(./debugfs/debugfs -R "blocks a" $IMG)
21cp /dev/null $TMP
22echo "Releasing blocks $BLKS"
23for i in $BLKS ; do echo "freeb $i" >> $TMP; done
24$DEBUGFS -w $IMG < $TMP >& /dev/null
25
26echo Writing $SIZE_B bytes to b
27dd if=/dev/zero of=$TMP bs=$SIZE_B count=1 >& /dev/null
28$DEBUGFS -w -R "write $TMP b" $IMG
29if [ -n "$SIZE_C" ]; then
30 BLKS=$(./debugfs/debugfs -R "blocks b" $IMG)
31 cp /dev/null $TMP
32 echo "Releasing blocks $BLKS"
33 for i in $BLKS ; do echo "freeb $i" >> $TMP; done
34 $DEBUGFS -w $IMG < $TMP >& /dev/null
35
36 echo Writing $SIZE_C bytes to c
37 dd if=/dev/zero of=$TMP bs=$SIZE_C count=1 >& /dev/null
38 $DEBUGFS -w -R "write $TMP c" $IMG
39fi
40echo "set_inode_field a mtime 201107040000" > $TMP
41echo "set_inode_field b mtime 201107050000" >> $TMP
42if [ -n "$SIZE_C" ]; then
43 echo "set_inode_field c mtime 201107060000" >> $TMP
44fi
45$DEBUGFS -w $IMG < $TMP >& /dev/null
46
47$FSCK -fy $IMG
48rm $TMP
49